Description of problem:
I am observing a crash in pthread_exit() on ES 3.0 when running a
binary compiled on RH 7.2.
#0 0xbf7ebc32 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0xbf6a8a09 in raise () from /lib/tls/libc.so.6
#2 0xbf6aa235 in abort () from /lib/tls/libc.so.6
#3 0xbee78f61 in __frame_state_for () from /lib/libgcc_s.so.1
#4 0xbee79393 in _Unwind_ForcedUnwind () from /lib/libgcc_s.so.1
#5 0xbf7e52a4 in _Unwind_ForcedUnwind ()
#6 0xbf7e3486 in __pthread_unwind () from /lib/tls/libpthread.so.0
#7 0xbf7dfae2 in pthread_exit () from /lib/tls/libpthread.so.0
#8 0x0804a5a0 in Thread(void*) ()
C++ source code for binary:
See sample.cpp attachment.
Red Hat Linux release 7.2 (Enigma)
Kernel 2.4.7-10smp on an i686
gcc-3.2.2 (configured with --enable-languages=c++ --enable-
threads=posix --with-pic --disable-shared)
(Also tried gcc-3.4.3 configured the same way)
g++ sample.cpp -rdynamic -lpthread -o sample
Running the sample on RH 7.2 works fine. Running the sample on RH ES
3.0 causes the above-mentioned crash.
- Note the -rdynamic flag. Without this flag, the crash goes away.
- Note that the sample program contains a call to new. Without a
call to new, the crash goes away. Moving the call to new around
(global scope, Thread() scope, main() scope at begin/end) doesn't
change a thing.
- As expected, without the call to pthread_exit(), the crash also
Red Hat Enterprise Linux ES release 3 (Taroon)
Kernel 2.4.21-4.ELsmp on an i686
Test system pthread library:
/lib/tls/libpthread.so.0 (as can be seen from stack trace)
Note that if /lib/i686/libpthread.so.0 is used instead, there is no
Steps to Reproduce:
1. Compile attached sample.cpp on RH 7.2 using gcc 3.2.2 or 3.4.3
with command: "g++ sample.cpp -rdynamic -lpthread -o sample"
2. Run sample on RH ES 3.0 making sure that it is linking
against /lib/tls/libpthread.so and not /lib/i686/libpthread.so
The sample binary crashed.
The sample binary should have exited normally.
Created attachment 110501 [details]
Sample program that reproduces the issue.
Setting LD_ASSUME_KERNEL=2.4.19 (or 2.2.5) on the RH ES 3.0 machine
also makes the crash go away.
That's a bug in RHL 7.2, not RHEL 3. It was incorrectly marking pthread_exit
(among other functions) as throw (), while they in fact can throw.
Either use LinuxThreads for RHL7.2 compiled C++ programs, or build on RHEL3+,
or fix RHL 7.2 headers so that they don't have throw () on their prototypes.
The fix was
As RHL 7.2 is no longer supported, there is nothing else that can be done about