Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 52374 - Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c
Summary: Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: Inclusion, InVCS
: 74413 100897 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-29 10:08 UTC by Carl Bach
Modified: 2005-08-04 09:11 UTC (History)
18 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Suggested patch to glibc (dl-tls.patch,622 bytes, patch)
2004-12-18 14:58 UTC, Ed Catmur
Details | Diff
glibc-2.3.4-fix-_dl_next_tls_modid-assert.patch (glibc-2.3.4-fix-_dl_next_tls_modid-assert.patch,8.93 KB, patch)
2005-03-15 07:46 UTC, Martin Schlemmer (RETIRED)
Details | Diff
glibc-2.3.5-fix-_dl_next_tls_modid-assert.patch (glibc-2.3.5-fix-_dl_next_tls_modid-assert.patch,7.82 KB, patch)
2005-05-09 02:30 UTC, Bernard Cafarelli
Details | Diff
Patch adapted from Fedora 1.49-1.50 cvs libc fix (glibc-2.3.5-fix-_dl_next_tls_modid-assert.patch,1.15 KB, patch)
2005-06-23 18:41 UTC, Phill
Details | Diff
patch to add line to glibc-2.3.5.ebuild (glibc-2.3.5.ebuild.diff,493 bytes, patch)
2005-06-23 18:50 UTC, Phill
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carl Bach 2004-05-29 10:08:36 UTC
Gxine 0.3.3 refuses to work.

gxine server: trying to connect to already running instance of gxine (/root/.gxine/socket)...
connect: Connection refused
server: socket '/root/.gxine/socket' created
Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 72: _dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx' failed!

Portage 2.0.50-r7 (default-x86-1.4, gcc-3.4.0, glibc-2.3.3_pre20040420-r0, 2.6.6-love4)
=================================================================
System uname: 2.6.6-love4 i686 AMD Athlon(TM) MP 2400+
Gentoo Base System version 1.4.15
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon-mp -funroll-loops -fomit-frame-pointer -pipe -ftracer -ffast-math"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=athlon-mp -funroll-loops -fomit-frame-pointer -pipe -ftracer -ffast-math"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp.easynet.nl/mirror/gentoo/ http://ftp.easynet.nl/mirror/gentoo/ http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X alsa apm avi berkdb bonobo crypt cups curl directfb encode esd evo faad fbcon ffmpeg flac fltk foomaticdb gdbm gif gnome gpm gstreamer gtk gtk2 guile imlib java jpeg ldap libg++ libwww live mad mikmod mmx motif mozilla mpeg mpeg4 ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl slang spell sse ssl svga tcltk tcpd tiff truetype usb wmf wmv x86 xine xinerama xml2 xmms xv zlib"

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Carl Bach 2004-05-30 04:27:08 UTC
The error also exists with gcc 3.4.0-r5 and a recompile of xine-lib and gxine.
Comment 2 Blu3 2004-08-15 11:25:30 UTC
The root cause of this is ABI incompatibilities stemming from the USE=nptl on x86_64 (amd64).
Comment 3 Ben Ford 2004-11-05 09:37:03 UTC
last comment was over two months ago.  Do we have a solution or not?
Comment 4 Tassilo Horn 2004-11-10 05:17:09 UTC
I still have this problem and don't use x86_64. I have USE="ntpl" the newest (~86) glibc, gcc, xine-lib etc.

What I've tried:

emerge -C gettext libvorbis win32codecs divx4linux libdvdcss alsa-lib pkgconfigflac libsdl libfame xvid libtheora speex xine-lib codeine

emerge gettext libvorbis win32codecs divx4linux libdvdcss alsa-lib pkgconfig flac libsdl libfame xvid libtheora speex xine-lib codeine -v

This was suggested in the forums to solve the problem but it still exists here.

root@inspiron> emerge info                     /usr/portage/media-video/codeine
Portage 2.0.51-r3 (default-x86-2004.2, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.8-ck7 i686)
=================================================================
System uname: 2.6.8-ck7 i686 Intel(R) Pentium(R) 4 Mobile CPU 1.40GHz
Gentoo Base System version 1.6.6
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r6
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -mtune=pentium4m -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -mtune=pentium4m -Os -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache distlocks fixpackages sandbox"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://mir.zyrianes.net/gentoo/ http://mir.zyrianes.net/gentoo/ http://www.gigaload.org/gentoo.org/ ftp://ftp.easynet.nl/mirror/gentoo/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ http://ftp.easynet.nl/mirror/gentoo/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acpi alsa ansi auctex audiofile avi berkdb bitmap-fonts bzlib cdparanoiacdr crypt cups dio dvd emacs encode faac faad flac flood freetype ftp gdbm gif gnutls gpm gprof graphviz gstreamer gtk gtk2 icq imagemagick imap imlib imlib2 ipv6 ithreads jabber jack jack-tmpfs java javascript jikes jpeg jpeg2k kde libwwwlive mad mikmod mmx mmx2 mng motif mozxmlterm mpeg ncurses network nls no_wxgtk1 nptl offensive oggvorbis openal opengl pam pcmcia pdflib pic png pnp qt quicktime readline real rtc ruby sdl slang slp speex sse ssl svg tcpd tetex theora threads tidy tiff truetype type1 unicode usb videos wmf wxwindows x86 xine xml2 xpmxprint xv xvid zlib linguas_de"
Comment 5 giggles1 2004-11-11 09:17:15 UTC
I have this problem as well with xine, on ~x86 (intel) with nvidia drivers.

There is some more information about this, including apparently a way to reproduce it in the last post at 

https://bugzilla.ubuntu.com/show_bug.cgi?id=1724

Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.9-gentoo-r3 i686)
Comment 6 Stefan Jones (RETIRED) gentoo-dev 2004-11-15 19:28:12 UTC
This is a glibc bug, look at the output of:

strace -e open xine

Last line just before crapping out:

open("/usr/lib/libGLU.so.1", O_RDONLY)  = 6
open("/usr/lib/opengl/nvidia/lib/libGLcore.so.1", O_RDONLY) = 6
open("/usr/lib/opengl/nvidia/lib/tls/libnvidia-tls.so.1", O_RDONLY) = 6
Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 72: _dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx' failed!

Looks like dlopening the Nvidia driver with tls support makes it crap out.

Can you verify the above on your systems.
Comment 7 giggles1 2004-11-16 09:18:08 UTC
Same result here
Comment 8 Sloan Poe 2004-11-24 05:02:44 UTC
I just did a test after reading the last post.  I ran opengl-update xorg-x11.  Then I ran xine with no problems, whereas before a was getting this same error.  I'm running nvidial drivers 1.0.6111.  I'm also using "nptl".

sloan
Comment 9 Christoph Peltz 2004-11-26 02:35:53 UTC
Same result, but it  seems to get only with xine (and relatet apps like pornview and vlc), other media-apps work. And the opengl-update works.

Here is my strace-output

open("/usr/lib/libGLU.so.1", O_RDONLY)  = 8
open("/usr/lib/opengl/nvidia/lib/libGLcore.so.1", O_RDONLY) = 8
open("/usr/lib/opengl/nvidia/lib/tls/libnvidia-tls.so.1", O_RDONLY) = 8
Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 72: _dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx' failed!

BTW: What this tls-support, I never heard of it.
Comment 10 Mike Perry 2004-12-04 07:52:58 UTC
I get the exact same results. opengl-update xorg-x11 is a valid workaround. Here is my emerge info:

Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.9-gentoo-r6 i686)
=================================================================
System uname: 2.6.9-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.6.7
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux26-headers-2.6.8.1,sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://gentoo.mirrors.pair.com/ http://distro.ibiblio.org/pub/Linux/distributions/gentoo/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo ftp://gentoo.mirrors.pair.com/ ftp://mirrors.tds.net/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="3dnowex S3TC X aalib acpi aim alsa apm ared aredmem arts audiofile avi berkdb bindist bitmap-fonts bzlib cdinstall cdparanoia cdr crypt cups dbm directfb divx4linux doc dvd dvdread encode esd ethereal exif f77 fam fbcon fbdev fdftk flacfoomaticdb fortran freetype fs ftp gdbm gif gimp gimpprint glut gnokii gnome gpm graphviz gs gstreamer gtk gtk2 gtkhtml icq imagemagick imap imlib ipv6 java javascript jikes jp2 jpeg jpeg2k kde kerberos krb4 ldap libg++ libwww lzw lzw-tiff mad maildir mikmod mime mmx motif mozcalendar mozdevelop mozilla mozsvg mozxmlterm mpeg mplayer ncurses net network nls nodroproot nptl nvidia offensive oggvorbis ooo-kde opengl oscar oss pam pda pdf pdflib perl pic png posix python qdbm qt quicktime readline recode rtc samba scanner sdl slang sndfile sockets socks5 speedo spell sqlite sse ssl svg svga tcltk tcpd threads tiff tokenizer truetype type1 usb vim-with-x wifi wxwindows x86 xchattext xface xine xml xml2 xmms xosd xpm xprint xscreensaver xsl xv xvid yahoo zlib"
Comment 11 Ed Catmur 2004-12-17 20:52:46 UTC
So apparently this is to do with the nvidia drivers needing fast thread-local storage (TLS) for OpenGL thread support, and messing with registers they don't have a right to. Leastways, that's what I gather from this thread: http://lists.freebsd.org/pipermail/freebsd-threads/2003-June/000530.html

(Kids, this is why closed code is A Bad Thing.)

Now, I only get the bug with vlc - not with gxine etc., unlike some. This suggests a possible workaround may be to experiment with CFLAGS and USE flags. Anyone up for it?

Another workaround that WFM is to use LD_PRELOAD=/usr/lib/opengl/nvidia/lib/libGL.so.1:/usr/lib/opengl/nvidia/lib/tls/libnvidia-tls.so.1 - it seems loading the nvidia TLS early on prevents the bug showing up. Either put it in your environment or write wrappers for affected apps.
Comment 12 Stephane Loeuillet 2004-12-18 03:16:31 UTC
*** Bug 74413 has been marked as a duplicate of this bug. ***
Comment 13 Ed Catmur 2004-12-18 12:34:24 UTC
Or apparently not - read http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=219352#msg122 and try the test case there.

This suggests that the success or failure is due to supplementary libraries (plugins to vlc, xine-lib, etc) not being available. This interpretation is strengthened by the fact that LD_PRELOAD works as a workaround, changing the order of loading libraries, in accordance with the analysis in the link.

(Speculation: something is not being cleaned up correctly when a library dependency is unfulfilled.)

So this is not a nvidia bug, it is a glibc/ld bug and nvidia/tls is just the trigger.
Comment 14 Ed Catmur 2004-12-18 13:01:41 UTC
Please reassign to the glibc maintainers.
Comment 15 Ed Catmur 2004-12-18 13:10:31 UTC
Further information:

The analysis on the debian bug is correct. When the plugin library fails to find its library dependencies it is unloaded and the thread-local variable dl_tls_dtv_gaps is set to TRUE to mark that the dtv array may have holes:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/dl-open.c?rev=1.116&content-type=text/x-cvsweb-markup&cvsroot=glibc&only_with_tag=MAIN
(line 620, _dl_open())

Unfortunately dl-tls.c assumes incorrectly that dl_tls_dtv_gaps is never set to TRUE at program startup, leading to some incorrect code caught by the assertion:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/generic/dl-tls.c?rev=1.44&content-type=text/x-cvsweb-markup&cvsroot=glibc
(line 65 onwards, _dl_next_tls_modid())

I'm currently compiling with the obvious fix:
-      /* If the following would not be true we mustn't have assumed
-        there is a gap.  */
-      assert (result <= GL(dl_tls_max_dtv_idx));
+      /* If the following is true we shouldn't have assumed there is a gap.  */
+      if (result > GL(dl_tls_max_dtv_idx))
+         goto nogaps;

This is probably buggy though, it needs looking at by someone who understands the internals, either someone on the gentoo glibc team or if not upstream it to the glibc developers.
Comment 16 Ed Catmur 2004-12-18 14:58:54 UTC
Created attachment 46301 [details, diff]
Suggested patch to glibc

This is the patch I settled on. It's an rcs diff against Gentoo
glibc-2.3.4.20041102.

It works, with vlc and with the testcase on the debian bts.

I think it may even be the correct patch, but it needs review by someone who
knows glibc/dl/tls internals better.
Comment 17 Marcos González 2004-12-25 03:29:50 UTC
The LDPRELOAD fix allows me to start Totem again with the xinelib backend. But there isn't any final solution yet?
Comment 18 Prakash Punnoor 2004-12-28 11:11:31 UTC
@Ed Catmur

Very nice, finally xine runs w/o problems and openoffice-ximian, too, with nvidia glx being used. Nice patch!
Comment 19 Stephane Loeuillet 2004-12-31 02:16:04 UTC
good news :

i just installed nvidia-glx 6629-r1
and now, gxine launches, while previously it triggered this error

work-around or real fix ? (i did not touch/emerge glibc for a long time)
Comment 20 Andreas Simon 2005-02-26 04:35:35 UTC
The bug is still there with sys-libs/glibc-2.3.4.20050125.
Comment 21 Andreas Simon 2005-03-05 07:55:30 UTC
Ed Catmur's patch works for glibc-2.3.4.20050125 too.
I use that now for several days and haven't seen any ill effect.
Thanks for the patch.

I hope that it gets applied eventually.
Comment 22 Ed Catmur 2005-03-12 18:22:03 UTC
Screw this, I've upstreamed it myself.

http://sources.redhat.com/bugzilla/show_bug.cgi?id=786 - let's see what happens.
Comment 23 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-15 07:46:11 UTC
Created attachment 53527 [details, diff]
glibc-2.3.4-fix-_dl_next_tls_modid-assert.patch

Yeah, sorry, was fairly inactive the last year and a half.  Anyhow, here is the
proper patch with all the context JJ left out - busy testing.
Comment 24 Martin Schlemmer (RETIRED) gentoo-dev 2005-03-15 07:47:08 UTC
PS: its against 2.3.4.20050125 .. I'll check later how much effort it will be to backport.
Comment 25 Ed Catmur 2005-03-15 10:49:19 UTC
Yes, that fixes it for me as well. Thanks for taking this up.
Comment 26 Jeremy Huddleston (RETIRED) gentoo-dev 2005-03-15 22:15:32 UTC
The fix is also in 20050125-r1 which will be leaving package.mask soon
Comment 27 Andreas Simon 2005-03-19 13:52:57 UTC
20050125-r1 fixed it for me as well. Thanks.
Comment 28 James 2005-05-08 12:02:30 UTC
The current portage, glibc-2.3.5 seems to have broken this again.
Comment 29 Bernard Cafarelli gentoo-dev 2005-05-08 14:21:50 UTC
I can confirm glibc 2.3.5 has the problem back, but looking at the ebuild the patch (or its equivalent) is not applied. The old one from 2.3.4 does not apply cleanly though...
Comment 30 Ed Catmur 2005-05-08 16:04:10 UTC
We need to apply this diff (off the RH glibc cvs):

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/generic/dl-tls.c.diff?r1=1.49&r2=1.50&cvsroot=glibc

Yes, it's from March 20th - guess 2.3.5 was rolled quite a while ago.
Comment 31 Bernard Cafarelli gentoo-dev 2005-05-09 02:28:38 UTC
Indeed, all fixes from the 2.3.4 patch were applied in 2.3.5 except for this one.

I have edited the patch to apply cleanly to 2.3.5, and everything works fine again (it may be better to keep the additional test case in the ebuild if the patch is applied)
Comment 32 Bernard Cafarelli gentoo-dev 2005-05-09 02:30:44 UTC
Created attachment 58456 [details, diff]
glibc-2.3.5-fix-_dl_next_tls_modid-assert.patch

Adapted from 2.3.4 patch
Comment 33 Jure Repinc 2005-05-18 11:39:18 UTC
I have just experienced this bug when trying to run Totem and Kaffeine with
glibc 2.3.5 AMD64 system.
Comment 34 Bernard Cafarelli gentoo-dev 2005-05-26 05:26:07 UTC
Open Office 2 32bit binary is also affected on amd64 (see
http://forums.gentoo.org/viewtopic-p-2442616.html)
Comment 35 Phill 2005-06-23 18:41:32 UTC
Created attachment 61823 [details, diff]
Patch adapted from Fedora 1.49-1.50 cvs libc fix
Comment 36 Phill 2005-06-23 18:50:12 UTC
Created attachment 61824 [details, diff]
patch to add line to glibc-2.3.5.ebuild

These two patches fixed the problem when I used them in my portage overlay. 
Open Office 2 beta works now.  This was taken strait from the Fedora/RedHat CVS
update page refrenced by Ed above.  I have not tested it much yet so I am not
sure what it all breaks or fixes.
Comment 37 SpanKY gentoo-dev 2005-07-09 17:55:45 UTC
*** Bug 93880 has been marked as a duplicate of this bug. ***
Comment 38 Jeremy Huddleston (RETIRED) gentoo-dev 2005-07-14 01:38:27 UTC
the patch is in cvs and will be in 2.3.5-r1
Comment 39 Jakub Moc (RETIRED) gentoo-dev 2005-07-31 08:39:57 UTC
*** Bug 100897 has been marked as a duplicate of this bug. ***
Comment 40 Martin Schlemmer (RETIRED) gentoo-dev 2005-08-04 09:11:52 UTC
In 2.3.5-r1.