Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 194076 - Gentoo specific segfault with sys-libs/glibc (NPTL) and gcc-4.1.2
Summary: Gentoo specific segfault with sys-libs/glibc (NPTL) and gcc-4.1.2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 292044 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-28 11:49 UTC by Christian Schoenebeck
Modified: 2009-11-08 14:33 UTC (History)
8 users (show)

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


Attachments
tiny test case which demonstrates the problem (nptl_test.c,1.94 KB, text/plain)
2007-09-28 11:51 UTC, Christian Schoenebeck
Details
a working ebuild disable-nptl-bug-check (linuxsampler-9999.ebuild,2.17 KB, patch)
2008-09-19 07:13 UTC, wayne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schoenebeck 2007-09-28 11:49:15 UTC
While investigating a crash of linuxsampler on Gentoo systems, we found that there's a Gentoo specific bug either in sys-libs/glibc or in sys-kernel/gentoo-sources which causes a segfault when another thread is cancelled while being in a lock state.

I will upload a small C file in a minute which demonstrates the problem.

We tested this problem with various other distributions (i.e. Debian and couple RPM based ones), also using NPTL enabled glibc with the same version and we didn't encounter this problem. So I'm quite sure that this is a Gentoo specific bug.

Reproducible: Always

Steps to Reproduce:
1. gcc nptl_test.c -lpthread
2. ./a.out  # <-- will segfault on a NPTL enabled Gentoo system
3. LD_ASSUME_KERNEL="2.4.1" ./a.out  # <-- this one succeeds (if glibc was not compiled with nptlonly)

Actual Results:  
The test case segfaults when using NPTL glibc:

cuse@mini ~/Desktop/glibc $ gdb ./a.out
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) run
Starting program: /home/cuse/Desktop/glibc/a.out
[Thread debugging using libthread_db enabled]
[New Thread -1210095952 (LWP 1255)]
[New Thread -1210098800 (LWP 1258)]
2nd thread is running

Program received signal SIGABRT, Aborted.
[Switching to Thread -1210098800 (LWP 1258)]
0xb7f53410 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7f53410 in __kernel_vsyscall ()
#1  0xb7e1f691 in raise () from /lib/tls/libc.so.6
#2  0xb7e20dc8 in abort () from /lib/tls/libc.so.6
#3  0xb7f4c5a7 in ?? () from /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
#4  0xb7f4cbc9 in ?? () from /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
#5  0xb7f4ce32 in ?? () from /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
#6  0xb7f4d45b in _Unwind_ForcedUnwind ()
   from /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1
#7  0xb7f2d1e6 in _Unwind_ForcedUnwind () from /lib/tls/libpthread.so.0
#8  0xb7f2ac71 in __pthread_unwind () from /lib/tls/libpthread.so.0
#9  0xb7f2393a in sigcancel_handler () from /lib/tls/libpthread.so.0
#10 <signal handler called>
#11 0xb7f53410 in __kernel_vsyscall ()
#12 0xb7f2af6e in __lll_mutex_lock_wait () from /lib/tls/libpthread.so.0
#13 0xb7f26dcf in _L_mutex_lock_50 () from /lib/tls/libpthread.so.0
#14 0xb7f267bd in pthread_mutex_lock () from /lib/tls/libpthread.so.0
#15 0x08048833 in __pthread_launcher (p=0x0) at nptl_test.c:22
#16 0xb7f244bb in start_thread () from /lib/tls/libpthread.so.0
#17 0xb7eb433e in clone () from /lib/tls/libc.so.6
(gdb)


Expected Results:  
The given test case should pass without a segfault, like when running it without NPTL glibc like here:

cuse@mini ~/Desktop/glibc $ LD_ASSUME_KERNEL="2.4.1" ./a.out
2nd thread is running
TEST PASSED! :-)

cuse@mini ~ $ emerge --info
Portage 2.1.3.9 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.5-r4, 2.6.22-gentoo-r5 i686)
=================================================================
System uname: 2.6.22-gentoo-r5 i686 VIA Nehemiah
Timestamp of tree: Thu, 27 Sep 2007 09:30:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17
dev-lang/python:     2.4.4-r5
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=i686 -msse -mmmx -mfpmath=sse -fomit-frame-pointer -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo"
CXXFLAGS="-O3 -march=i686 -msse -mmmx -mfpmath=sse -fomit-frame-pointer -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="de_DE@euro"
LINGUAS="de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa arts berkdb bitmap-fonts cairo cdr cli cracklib crypt cups dbus dri dts dvb dvd dvdr dvdread emboss encode evo fam gdbm gif gpm hal iconv insecure-drivers ipv6 isdnlog jack jpeg kde lcms mad midi mikmod mmx mp3 mpeg mudflap ncurses nls nptl ogg opengl openmp oss pam pcre pdf perl plugin png pppd python qt3 qt3support qt4 quicktime readline reflection sdl session soundtouch spell spl sse ssl svg tcpd theora tiff truetype truetype-fonts type1-fonts unicode usb vorbis x264 x86 xine xml xorg xv xvid zlib" ALSA_CARDS="via82xx ice1712" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="via vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Christian Schoenebeck 2007-09-28 11:51:05 UTC
Created attachment 132071 [details]
tiny test case which demonstrates the problem

Here's the promised small C file which shows the segfault on NPTL enabled glibc on Gentoo systems.
Comment 2 SpanKY gentoo-dev 2007-09-28 19:39:46 UTC
works fine for me on glibc-2.6.1
Comment 3 Christian Schoenebeck 2007-11-09 13:13:10 UTC
I just updated to glibc 2.6.1, the problem still exists! So that's why I reopened this bug report now.
Comment 4 matt 2007-11-09 18:21:56 UTC
matt@thing /tmp/bug194076 $ gcc nptl_test.c -lpthread
matt@thing /tmp/bug194076 $ ./a.out 
2nd thread is running
Aborted
matt@thing /tmp/bug194076 $ emerge --info
Portage 2.1.3.16 (default-linux/x86/2007.0, gcc-3.4.6, glibc-2.6.1-r0, 2.6.21-gentoo-r4 i686)
=================================================================
System uname: 2.6.21-gentoo-r4 i686 Pentium III (Coppermine)
Timestamp of tree: Mon, 29 Oct 2007 22:50:01 +0000
app-shells/bash:     3.2_p17
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo/ http://mirror.datapipe.net/gentoo http://gentoo.mirrors.pair.com/ http://mirrors.tds.net/gentoo http://mirrors.tds.net/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo ftp://mirrors.tds.net/gentoo rsync://mirrors.tds.net/gentoo http://gps2.aura-online.co.uk/distfiles"
LINGUAS="en en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.168.16/portage"
USE="7zip X Xaw3d a52 aac aalib acpi agg aliaschain alsa apache2 asm audiofile berkdb bitmap-fonts blas blender-game bzip2 cairo cdda cddb cdr chardet cli corba cpudetection cracklib crypt css cups daap devfs26 dga dillo directfb divx4linux dri dts dv dvd dvdr dvdread dvi effects encode examples fame fbcon ffmpeg fftw firefox flac fortran fpx gdbm gif gimpprint gpm graphviz gs gsl gstreamer gtk gtkhtml hdri httpd iconv imagemagick imap inkjar isdnlog javacomm javascript jbig joystick jpeg jpeg2k lame lcms libcaca libsamplerate lua lzo mad matroska midi mikmod mjpeg mmx mng modplug mozcalendar moznocompose moznomail mozplaintext mp3 mpeg mpeg4 mudflap musepack music musicbrainz ncurses network nls nodrm nptl nptlonly nvidia ogg openexr opengl openmp oscar pam pcre pdf perl pg-hier pg-intdatetime pg-vacuumdelay php physfs pike plotutils png portaudio ppds pppd python qt3 qt3support qt4 quicktime readline reflection rtc ruby sasl scenarios sdk sdl sdl-image session slang sndfile soundtouch speex spell spl sse ssl stream svg svga t1lib tagwriting tcl tcltk tetex theora threads tiff tk truetype truetype-fonts tta type1-fonts unicode usb v4l v4l2 vcd vidix vim-with-x vlm vorbis webdav wxwindows x264 x86 xanim xchattext xml xorg xosd xpm xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" LIRC_DEVICES="hauppauge" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

matt@thing /tmp/bug194076 $ LD_ASSUME_KERNEL="2.4.1" ./a.out
./a.out: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
matt@thing /tmp/bug194076 $ 
Comment 5 Christian Schoenebeck 2007-11-09 18:30:51 UTC
I also tried the test case with various other kernel and glibc versions, even on completely different Gentoo boxes with different hardware, same result, it crashs!

So couldn't it be that some Gentoo specific glibc patch causes this problem?

The bad thing is, as with glibc 2.6.x TLS seems not to be supported anymore, so you cannot circumvent this problem with the LD_ASSUME_KERNEL workaround anymore. And stepping back, that is downgrading glibc doesn't seem to be an easy move on Gentoo either.

As a direct cause of this problem, winecfg for example crashes immediately on my Gentoo boxes.
Comment 6 SpanKY gentoo-dev 2007-11-09 19:30:52 UTC
i dont think TLS means what you think it means

non-TLS stuff is not supported in glibc-2.6.1+ anymore, nor is linuxthreads (and therefore <=linux-2.4)

conversely, all the machines i test on, your test case runs just fine

i'm skeptical there is any patch in the Gentoo patchset which would cause this.  but it's pretty trivial for you to test:
USE=vanilla emerge glibc

the same goes for the kernel where we apply two things and nothing else:
 - security fixes from mainline
 - specific drivers needed for the LiveCD
but again, it's trivial for you to verify: grab a kernel from kernel.org (or just use sys-kernel/vanilla-sources)

also, i see you're still running gcc-3.4.x.  that version is not supported.  upgrade to gcc-4.1.x.
Comment 7 Christian Schoenebeck 2007-11-10 00:38:25 UTC
I know there are a lot of reports against glibc, but simply ignoring this report and closing it as WORKSFORME is contra-productive.

Fact is, I tested it on three different Gentoo machines, two servers and one desktop and all have this issue, PLUS I asked on #gentoo-dev-help for people to try this test case, and the first person who tried it confirmed that this test case aborts on his box as well (see comment #4).

This test case is very simple, I see only three factors that could cause this issue: a) glibc, b) kernel, c) hardware

Since this test case failed on a Pentium Dual Core, Pentium III, Athlon XP and on a VIA processor box, chances are low that its caused by hardware.

I tried a lot of different kernel versions, with all kind of kernel settings (w & w/o preemption, single core, SMP, static & dynamic kernel modules, ...) and I also tried plain, untouched vanilla sources (as you suggested), always with the same result: the test case aborts. So chances are pretty low that its caused by the kernel either.

So what would you say remains? glibc, right?

And BTW I'm NOT using gcc-3.x, if you look thoroughly at my posts you'll see that I used gcc 4.x. You were refering to comment #4 I guess, which was NOT from me, but from the person on IRC who was so kind to try the test case for me on his box.

Regarding your suggestion to use "USE=vanilla emerge glibc" to compile an unpatched glibc: I don't know if you ever tried it, but this USE flag won't prevent glibc to be patched, all Gentoo patches were still applied to the glibc tarball and I couldn't find anything about this USE flag in the glibc ebuild files either.
But anyway, I hacked the glibc ebuild manually (with a portage overlay) to not apply the Gentoo patch set. Unfortunately it doesn't compile yet. I'll try to manually re-enable the most mandatory patches, so that it compiles at least...

If anybody else is reading this, please try the uploaded test case and report whether it aborts on your box or not!
Comment 8 Marc-Olivier Barre 2007-12-09 18:52:05 UTC
Just tested here against glibc 2.6.1 with nptlonly use flag. It does crash.
Comment 9 Leonid Kostrykin 2007-12-11 00:53:13 UTC
I can confirm this with glibc-2.6.1-r0 and nptlonly USE-Flag too.
Comment 10 Thomas Kuther 2007-12-11 16:33:16 UTC
Test succeeds here with glibc-2.7 on ~amd64, and also inside a 32bit chroot ~x86 environment.
Comment 11 Marc-Olivier Barre 2007-12-11 22:22:20 UTC
Ok. let's have a third emerge --info for a non working system. Now I'd like to see the ones from the working system. I suspect some weird toolchain problem. It's has already been demonstrated that the kernel, glibc, CPU, gcc, or CFLAGS don't seem to matter. it might be a specific combination of those. binutils might be worth checking too.

-----------------------------------------------------------------------
Portage 2.1.3.19 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23.9-rt12 i686)
=================================================================
System uname: 2.6.23.9-rt12 i686 Intel(R) Pentium(R) M processor 1.73GHz
Timestamp of tree: Mon, 10 Dec 2007 19:17:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=pentium-m -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache collision-protect distlocks metadata-transfer parallel-fetch sandbox sfperms splitdebug strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ "
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LINGUAS="fr"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/pro-audio /usr/portage/local/layman/xeffects /usr/portage/local/marco /usr/portage/local/x4x-portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 acl acpi alsa bash-completion bitmap-fonts branding cairo cli cracklib crypt dbus dri dvd encode firefox flac fontconfig fortran gdbm glitz gtk hal iconv iproute2 isdnlog jack jpeg lcms libnotify logrotate midi mmx mng mpeg mudflap ncurses newspr nls nptl nptlonly ogg opengl openmp pam pcmcia pcre pdf perl png pppd python readline reflection sdl session shout spl sse sse2 ssl startup-notification stream svg tcpd theora truetype truetype-fonts type1-fonts unicode vim-syntax vorbis webdav win32codec x86 xcomposite xinerama xml xorg xpm xscreensaver xv zlib" ALSA_CARDS="hdsp" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard evdev wacom synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fr" USERLAND="GNU" VIDEO_CARDS="radeon"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
-------------------------------------------------------------------

Another interesting fact. On my system binutils-2.17.ebuild seems to be dated 2007-06-25. I wonder when Christian noticed this first in LS. 

-------------------------------------------------------------------
marco@michel /usr/portage/sys-devel/binutils $ ls -ltr
total 148
-rw-r--r-- 1 root root   162 2004-04-19 08:48 metadata.xml
-rw-r--r-- 1 root root   566 2006-03-30 16:07 binutils-2.15.ebuild
-rw-r--r-- 1 root root   369 2006-05-22 07:06 binutils-2.16.91.0.6.ebuild
-rw-r--r-- 1 root root   612 2006-09-17 00:06 binutils-2.16.1-r3.ebuild
-rw-r--r-- 1 root root   367 2007-04-23 20:36 binutils-2.17.50.0.12.ebuild
-rw-r--r-- 1 root root   434 2007-06-25 10:06 binutils-2.17.ebuild
-rw-r--r-- 1 root root   372 2007-07-01 22:06 binutils-2.17.50.0.16.ebuild
-rw-r--r-- 1 root root   305 2007-07-26 07:06 binutils-2.17.50.0.17.ebuild
-rw-r--r-- 1 root root   299 2007-09-12 04:36 binutils-2.18.50.0.1.ebuild
-rw-r--r-- 1 root root   299 2007-10-06 16:31 binutils-2.18.50.0.2.ebuild
-rw-r--r-- 1 root root   362 2007-10-06 17:06 binutils-2.18.ebuild
-rw-r--r-- 1 root root   445 2007-10-06 17:06 binutils-2.17-r1.ebuild
-rw-r--r-- 1 root root   453 2007-10-07 04:10 binutils-2.17-r2.ebuild
-rw-r--r-- 1 root root   299 2007-11-04 21:06 binutils-2.18.50.0.3.ebuild
-rw-r--r-- 1 root root 17645 2007-11-20 05:36 Manifest
-rw-r--r-- 1 root root 57526 2007-11-20 05:36 ChangeLog
-rw-r--r-- 1 root root   356 2007-11-20 05:36 binutils-2.18-r1.ebuild
Comment 12 Thomas Kuther 2007-12-11 22:29:42 UTC
As requested... looks pretty similar on my x86 install.
Not shown in the emerge --info output is that i set NPTL_KERN_VER to 2.6.22.

$ emerge --info
Portage 2.1.4_rc9 (default-linux/amd64/2007.0/desktop, gcc-4.2.2, glibc-2.7-r1, 2.6.24-rc4-zen0 x86_64)
=================================================================
System uname: 2.6.24-rc4-zen0 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
Timestamp of tree: Tue, 11 Dec 2007 14:00:03 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.3
dev-lang/python:     2.5.1-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0_rc6
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -msse3 -fno-ident -fweb -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon64 -O2 -msse3 -fno-ident -fweb -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="candy ccache collision-protect distlocks metadata-transfer parallel-fetch prelink sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS=" http://gentoo.intergenia.de ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo"
LANG="de_DE.UTF-8"
LC_ALL="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
LINGUAS="en de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/enlightenment /usr/portage/local/layman/xeffects /usr/portage/local/layman/sunrise /usr/portage/local/layman/java-overlay /usr/portage/local/layman/webapps-experimental /usr/portage/local/layman/gechi /usr/portage/local/layman/gentoo-gis /usr/portage/local/layman/java-gcj-overlay /usr/portage/local/layman/gentoo-china /usr/portage/local/layman/kde /usr/portage/local/layman/mozilla /usr/local/overlays/gimpel /home/tom/cvs/proaudio/trunk/overlays/proaudio /home/tom/cvs/proaudio/trunk/overlays/proaudio-dev"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowex X acl acpi alsa amd64 apache2 berkdb bitmap-fonts branding cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode evo fam fbcon firefox gdbm gif gpm gstreamer gtk hal iconv isdnlog jack jpeg kdeenablefinal kdehiddenvisibility libnotify mad midi mikmod mmx mmxext mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl pic png pppd pthreads python qt3 qt3support qt4 quicktime readline reflection sdl session shadow spell spl sse sse2 ssl ssse3 startup-notification svg tcpd threads tiff truetype truetype-fonts type1-fonts unicode userlocales vorbis xcb xml xorg xv zlib" ALSA_CARDS="ice1712 ice1724" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 13 Leonid Kostrykin 2007-12-12 01:47:43 UTC
Perhaps my "emerge --info" is also of interest (test case not working)


Portage 2.1.3.19 (default-linux/x86/2007.0/desktop, gcc-4.1.1, glibc-2.6.1-r0, 2.6.22-gentoo-r9 i686)
=================================================================
System uname: 2.6.22-gentoo-r9 i686 AMD Athlon(TM) XP 2200+
Timestamp of tree: Fri, 07 Dec 2007 09:47:01 +0000
app-shells/bash:     3.2_p17
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=athlon-xp -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo"
LANG="de_DE"
LINGUAS="de ru"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/xeffects /usr/portage/local/layman/pro-audio /usr/portage/local/personal"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip X a52 aac acl acpi alsa avi bash-completion beagle berkdb bitmap-fonts cairo cdr cli cracklib crypt cups dbus divx dri dvb dvd dvdr dvdread eds emboss encode evo fam ffmpeg firefox fortran gdbm gif glitz gnome gpm gstreamer gtk hal iconv imagemagick isdnlog jack java joystick jpeg ladspa lame ldap mad midi mikmod mjpeg mmx mmxext mp3 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp oss pam pcre pdf perl png pppd python quicktime readline real reflection samba sdl session spell spl sse ssl startup-notification svg tcpd tetex threads tiff transcode truetype truetype-fonts type1-fonts unicode usb v4l v4l2 vcd vidix vim-syntax vorbis win32codecs x86 xine xml xorg xv xvid zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de ru" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 14 Marc-Olivier Barre 2007-12-12 12:58:07 UTC
Ok, I managed to solve it on my system. Here's what I did :
- upgrade to gcc 4.2.2 (any 4.2.x should do)
- gcc-config i686-pc-linux-gnu-4.2.2
- emerge libtool (not sure it was necessary, see bellow)
- emerge binutils (not sure also, see bellow)

At this point I intended to remerge glibc (2.6.1 here). But just to be sure, I tested my a.out test case again _without even recompiling it_.

marco@michel ~ $ ./a.out
2nd thread is running
TEST PASSED! :-)

To those who have the issue, please test this solution. There might still be glitches.

Also try not to remerge you libtool and binutils before running the test. It is normally not needed for this to work, I'd like to make sure.

Finally I would like to thank the guy named SpanKY for having closed this bug as an IDONTCARE. This was really helpful. Could SpanKY mark this bug as TEST-REQUEST ?
Comment 15 Evgeniy Dushistov 2007-12-12 13:30:40 UTC
Actually, if look at sources for example
glibc-2.6.1/nptl/tst-cancel1.c
you find such phrase:
 /* The following code is not standard compliant: the mutex functions
     must not be called with asynchronous cancellation enabled.  */

You can replace pthread_mutex_lock/pthread_mutex_t with sem_wait,
and sem_t respectevly, and should works fine, because of sem_wait is valid cancelation point, or disable cancelation when you call pthread_muex_lock.
Comment 16 Jouni Rinne 2007-12-13 13:23:02 UTC
Wow! I can confirm that Marc-Olivier's gcc-upgrade-trick really works! Steps I have taken this far:

1) Upgraded glibc from 2.6.1 (stable) to 2.7-r1; didn't help at all, linuxsampler-0.5.1 still crashed (That was before I found this thread via Gentoo forums).
2) Compiled & run nptl_test.c; got a segfault
3) Upgraded gcc from 4.1.2 (stable) to 4.2.2
4) set gcc-4.2.2 as native compiler
5) run a.out (without recompiling!)

madmax@bluelight ~ $ ./a.out 
2nd thread is running
TEST PASSED! :-)

...and linuxsampler started to behave itself, too :D

Binutils and linux-headers are still 'stable' (2.18-r1 and 2.6.22-r2 respectively), haven't upgraded/recompiled them yet.
Comment 17 Christian Schoenebeck 2007-12-13 23:26:14 UTC
Confirmed. That trick did it on all Gentoo boxes I tried. Thanks Marc!

I'm just wondering if this was a version specific GCC problem or some stale condition independent of the used GCC version. I guess time will tell ...
Comment 18 SpanKY gentoo-dev 2007-12-14 01:59:49 UTC
you can test by doing:
LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/ ./nptl_test
(tweak the CHOST as need be)

looks like an unwinding bug in libgcc_s.so.1 in gcc-4.1.2
Comment 19 NaiL 2008-01-21 22:46:10 UTC
Thanks Marc-Olivier, but for me is not a solution to put gcc on ~arch.

Taking into account that this has been told to be a gentoo specific issue there must be a solution for our current stable gcc version (4.1.2 at this time).
Comment 20 Marc-Olivier Barre 2008-01-22 00:25:35 UTC
(In reply to comment #19)
> Thanks Marc-Olivier, but for me is not a solution to put gcc on ~arch.
> 
> Taking into account that this has been told to be a gentoo specific issue there
> must be a solution for our current stable gcc version (4.1.2 at this time).
> 

While I fully agree with you, I have been unable to find a patch to fix it. This is rather mysterious, since such a bug should have affect other distros too at a time...

This very serious bug which is affecting what is considered to be a stable version of gcc by Gentoo seems regarded as, somehow, unimportant.

Do we have a gcc ebuild maintainer watching this bug ?
Comment 21 wayne 2008-09-16 05:10:50 UTC
I have the same glibc bug :( This bug is not in the other distros. Must be a broken patch in the ebuild. 

Linux enyawix 2.6.23-gentoo-r3 #6 PREEMPT Fri Sep 5 14:02:44 CDT 2008 x86_64 AMD Athlon(tm) 64 Processor 3500+ AuthenticAMD GNU/Linux


sys-libs/glibc-2.6.1  USE="gd (multilib) nls -debug -glibc-omitfp (-hardened) -profile (-selinux) -vanilla
Comment 22 wayne 2008-09-19 02:42:37 UTC
This got linuxsampler up and running for me :) 


http://bb.linuxsampler.org/viewtopic.php?f=2&t=120


./configure --disable-nptl-bug-check 

Thanks websafe 
Comment 23 wayne 2008-09-19 07:13:04 UTC
Created attachment 165813 [details, diff]
a working ebuild disable-nptl-bug-check

Just a work around works very nice on my box
Comment 24 wayne 2008-09-19 20:34:39 UTC
I have changed glibc and gcc and still have nptl bug. I am using a gentoo kernel so I will build a new kernel when I get off work and retest for the bug. The ebuild I posted will build an app that will crash from time to time. The ebuild in portage will not build at all on my system. 
Comment 25 wayne 2008-09-21 06:54:57 UTC
I found a fix! I forgot to run gcc-config after installing gcc-4.3.1. upgrading gcc fixes issue. 
Comment 26 Luca Lesinigo 2008-11-15 14:20:56 UTC
sys-devel/gcc-3.4.6-r2, sys-libs/glibc-2.6.1, linux-2.6.21 (with Xen patches) on x86_64, hardened 2008.0 profile: Aborted

sys-devel/gcc-4.2.4, sys-libs/glibc-2.7-r2, linux-2.6.22.19 (with vserver and grsec patches) on hppa, 2008.0 profile: test passed

sys-devel/gcc-4.3.2, sys-libs/glibc-2.7-r2, linux-2.6.22.19 (with vserver and grsec patches) on hppa, 2008.0 profile: test passed

hope this helps.
Comment 27 Mark Loeser (RETIRED) gentoo-dev 2009-04-20 23:50:16 UTC
Newer versions of gcc and glibc are stable, which seem to resolve this.
Comment 28 Rafał Mużyło 2009-11-06 08:14:06 UTC
*** Bug 292044 has been marked as a duplicate of this bug. ***
Comment 29 SpanKY gentoo-dev 2009-11-07 02:20:49 UTC
*** Bug 292044 has been marked as a duplicate of this bug. ***
Comment 30 SpanKY gentoo-dev 2009-11-08 14:33:48 UTC
*** Bug 292044 has been marked as a duplicate of this bug. ***