[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glibc 2.3.2: dlopen(libpthread.so) segfaults
From: |
Patrick Smith |
Subject: |
glibc 2.3.2: dlopen(libpthread.so) segfaults |
Date: |
Thu, 03 Apr 2003 13:54:54 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.3) Gecko/20030324 |
This occurred during 'make check' while I was trying to install glibc
2.3.2 in the following environment:
PowerPC (G4)
Linux kernel 2.4.20
gcc 3.2.2
binutils 2.13.90.0.18
configure options: --prefix=... --libexecdir=... --enable-add-ons
--with-headers=... --without-gd
--enable-kernel=2.4.8 --enable-static-nss
In 'make check', bug-iconv3 died with a segmentation violation while in
the call 'dlopen (LIBPTHREAD_SO, RTLD_NOW)'. A small test program that
did just that one function call also died with a segmentation violation.
The crash was happening near the end of pthread_initialize() in
pthread.c, at the line
*__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
Apparently, __libc_dl_error_tsd was returning a bad pointer, so the
store to that address caused a segfault.
I noticed that __pthread_initialize_minimal wasn't ever called, and
tried modifying pthread_initialize to call it (plus added a check in
__pthread_initialize_minimal to return without doing anything if this
isn't the first call). This seems to fix the problem, though I don't
know if it could cause other problems.
A patch showing this change is attached.
--- linuxthreads/pthread.c.orig 2003-01-16 13:14:41.000000000 -0500
+++ linuxthreads/pthread.c 2003-04-02 22:42:15.000000000 -0500
@@ -294,7 +294,15 @@
{
#ifdef USE_TLS
pthread_descr self;
+#endif
+
+ static int first_time = 1;
+ if (first_time)
+ first_time = 0;
+ else
+ return;
+#ifdef USE_TLS
/* First of all init __pthread_handles[0] and [1] if needed. */
# if __LT_SPINLOCK_INIT != 0
__pthread_handles[0].h_lock = __LOCK_INITIALIZER;
@@ -467,6 +475,8 @@
struct sigaction sa;
sigset_t mask;
+ __pthread_initialize_minimal();
+
/* If already done (e.g. by a constructor called earlier!), bail out */
if (__pthread_initial_thread_bos != NULL) return;
#ifdef TEST_FOR_COMPARE_AND_SWAP
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- glibc 2.3.2: dlopen(libpthread.so) segfaults,
Patrick Smith <=