[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linuxthreads 2.2.2 causes SEGV
From: |
Dan Maas |
Subject: |
Re: linuxthreads 2.2.2 causes SEGV |
Date: |
Tue, 20 Mar 2001 04:59:37 -0500 |
Greetings all, I am homing in on the cause of this problem (segfault inside
__pthread_alt_lock() at startup time with any program linked to
libpthread.so).
The immediate cause is __pthread_alt_lock() trying to get thread_self() by
reading from the descriptor struct pointed to by 'gs'... On my system, 'gs'
is 0x0 (NULL) when this happens, so, kaboom. Here's the backtrace:
#0 0x40030e7a in __pthread_alt_lock () from /lib/libpthread.so.0
#1 0x4002e46f in pthread_mutex_lock () from /lib/libpthread.so.0
#2 0x4016e56b in __register_frame_info (begin=0x401858b8, ob=0x40187760)
at ../../gcc/frame.c:581
#3 0x4007f13e in __libc_global_ctors () from /lib/libc.so.6
#4 0x4007f1ee in init () from /lib/libc.so.6
#5 0x4000e9cf in call_init () from /lib/ld-linux.so.2
#6 0x4000eb2e in _dl_init () from /lib/ld-linux.so.2
I believe the root cause is incorrect startup/initialization order. The 'gs'
register must be set up (by __pthread_initialize_minimal) *BEFORE* any other
pthread functions execute. But on my system, __register_frame_info() tries
to call pthread_mutex_lock() before initialize_minimal() executes.
So to fix this we need to make sure pthread_mutex_lock() does NOT get called
until AFTER __pthread_initialize_minimal()... I'm not sure how to do this,
help would be appreciated.
FYI, I am using gcc 2.95.3 (final), kernel 2.4.2, and glibc 2.2.2 (compiled
for 2.4.x kernels only, and i686 only -- obviously this problem is specific
to LDT-based pthreads).
Regards,
Dan