Red Hat Bugzilla – Bug 73452
%gs segment register reset when calling pthread signal handler on SMP
Last modified: 2007-04-18 12:46:20 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826
Description of problem:
I've been working on a program to get process stat from the /proc. The program
uses pthreads (linuxthreads) and on 2.4 SMP kernels it always SIGSEGV. It works
fine on 2.4 UP kernels and 2.2 UP and SMP kernels.
Investigating the problem I've found that the SIGSEGV always happens on the
signal handler of the linuxthreads (pthread_handle_sigrestart). And it happens
because the %gs segment register is 0.
I've made this little program to test. It will SIGSEGV after 30 min-1 hour on a
SMP box. I've tested with this Red Hat box:
Linux 2.4.9-21enterprise #1 SMP Thu Jan 17 13:37:56 EST 2002 i686 unknown
Sometimes you'll see that only the main thread will stay alive and the other
ones will die.
The work around is to use the /lib/libpthread.so.0 (this one doesn't uses the
%gs register) instead of the default /lib/i686/libpthread.so.0. At least on a
Red Hat box it works fine.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Run the program
Actual Results: SIGSEGV
Created attachment 74913 [details]
please try the current 7.2 kernel (2.4.9-34) since some threading bits got
fixed; also the 2.4.18-10 7.3 kernel is a useful point since that'll be used for
future 7.2 errata.
Unfortunately I can't upgrade this machine because it's a prodution one and I
don't have a SMP machine to test it.
Besides I'm already using the workaround. I just filed the bug so others can
know this. I've expended a lot of time (2 months) trying to find what was going
I also suffered this problem, and was using a stock 2.4.19 kernel compiled from
this is solved by NPTL for sure in RHL9.
Sure, but not everyone can upgrade to such a new release just yet.
But I understand that you would need some payment to fix this type of problem
on an older release.