[uClibc 0002834]: libc_pthread_init() causes segfault

bugs at busybox.net bugs at busybox.net
Tue Apr 29 15:44:41 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=2834 
====================================================================== 
Reported By:                hank_le
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   2834
Category:                   Posix Threads
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             04-04-2008 12:08 PDT
Last Modified:              04-29-2008 08:44 PDT
====================================================================== 
Summary:                    libc_pthread_init() causes segfault
Description: 
Initializing programs that link to libpthread segfault. Simple "Hello
World" program segfaults when linked against libpthread, yet runs fine
without.  Attached pthread_test.c won't run.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
duplicate of        0002264 pthread issues with 0.9.29
====================================================================== 

---------------------------------------------------------------------- 
 carmelo73 - 04-22-08 08:23  
---------------------------------------------------------------------- 
Please, specify which libpthread implementation you are using
(old or new linuxthreads) ? 

---------------------------------------------------------------------- 
 hank_le - 04-24-08 11:07  
---------------------------------------------------------------------- 
Linking to libpthread causes segfaults using NPTL and linuxthreads (new),
but no problems using linuxthreads (old). 

---------------------------------------------------------------------- 
 carmelo73 - 04-24-08 22:23  
---------------------------------------------------------------------- 
There is not NPTL implementation for x86, so how can you link against it ?
it doesn't make sense.
Trying using a freshen version to see if the fix in linuxthreads suggested
by Will (that I applied) works or not. 

---------------------------------------------------------------------- 
 hank_le - 04-28-08 13:32  
---------------------------------------------------------------------- 
I grabbed a buildroot snapshot from 2008-04-25 and rebuilt everything using
my oritional .config (uClibc-0.9.29, NPTL/linuxthreads,gcc-4.2.1,
binutils-2.18) and my pthread_test.c still segfaults.  I need to re-verify
all the versions to be sure.

BTW, for my x86 target, I "chose" NPTL in the menuconfig, but it seems
that linuxthreads is actually used (a little misleading).  Sorry for the
confusion.

 

---------------------------------------------------------------------- 
 hank_le - 04-29-08 07:01  
---------------------------------------------------------------------- 
Ok, I grabbed the latest buildroot snapshot (20080429), and configured for
uClibc-snapshot, linuxthreads,gcc-4.2.1, andbinutils-2.18.  The build gets
as far as gcc, and I get the following error (apparently it can't find
pthread.h):

make[2]: Entering directory
`/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial/gcc'
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial/./gcc/xgcc
-B/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial/./gcc/
-B/home/leinhos/src/buildroot-20080429/build_i586/staging_dir/usr/i586-linux-uclibc/bin/
-B/home/leinhos/src/buildroot-20080429/build_i586/staging_dir/usr/i586-linux-uclibc/lib/
-isystem
/home/leinhos/src/buildroot-20080429/build_i586/staging_dir/usr/i586-linux-uclibc/include
-isystem
/home/leinhos/src/buildroot-20080429/build_i586/staging_dir/usr/i586-linux-uclibc/sys-include
-O2 -g -Os -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem
./include  -I. -I.
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/.
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/../include
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/../libcpp/include
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gmp/include
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/mpfr/include
-I/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/../libdecnumber
-I../libdecnumber  -g0 -finhibit-size-directive -fno-inline-functions
-fno-exceptions -fno-zero-initialized-in-bss -fno-toplevel-reorder 
-fno-omit-frame-pointer \
  -c
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/crtstuff.c
-DCRT_BEGIN \
  -o crtbegin.o
In file included from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/bits/uClibc_stdio.h:119,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/stdio.h:72,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/tsystem.h:90,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/crtstuff.c:68:
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/bits/uClibc_mutex.h:15:21:
error: pthread.h: No such file or directory
In file included from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/bits/uClibc_mutex.h:16,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/bits/uClibc_stdio.h:119,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/stdio.h:72,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/tsystem.h:90,
                 from
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1/gcc/crtstuff.c:68:
/home/leinhos/src/buildroot-20080429/toolchain_build_i586/uClibc_dev//usr/include/bits/uClibc_pthread.h:27:3:
error: #error "Always include <pthread.h> rather than
<bits/uClibc_pthread.h>"
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory
`/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory
`/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial'
make: ***
[/home/leinhos/src/buildroot-20080429/toolchain_build_i586/gcc-4.2.1-initial/.compiled]
Error 2

 

---------------------------------------------------------------------- 
 hank_le - 04-29-08 08:44  
---------------------------------------------------------------------- 
ok,

I backed off on the gcc version (4.1.2), took the uClibc snapshot from a
couple days ago (20080425), and got past the __libc_pthread_init() call,
but eventually segfaults during thread cleanup
(_pthread_cleanup_pop_restore at plt).  This is from my gdb session on the
target:

# gdb pthread_test
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 "i586-linux-uclibc"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /tmp/pthread_test
[Thread debugging using libthread_db enabled]
[New Thread 1024 (LWP 853)]
creating thread
[New Thread 2049 (LWP 856)]
[New Thread 1026 (LWP 857)]
[Thread 1026 (LWP 857) exited]
[Thread 1024 (LWP 853) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 853)]
0xb7f8dfb0 in _pthread_cleanup_pop_restore at plt () from /lib/libc.so.0
(gdb) bt
http://busybox.net/bugs/view.php?id=0  0xb7f8dfb0 in
_pthread_cleanup_pop_restore at plt () from /lib/libc.so.0
http://busybox.net/bugs/view.php?id=1  0xb7fb096c in exit () from /lib/libc.so.0
http://busybox.net/bugs/view.php?id=2  0xb7fc998f in __pthread_do_exit () from
/lib/libpthread.so.0
http://busybox.net/bugs/view.php?id=3  0xb7fc99b2 in pthread_exit () from
/lib/libpthread.so.0
http://busybox.net/bugs/view.php?id=4  0x08048745 in main () at
pthread_test.c:40
(gdb) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
04-04-08 12:08  hank_le        New Issue                                    
04-04-08 12:08  hank_le        Status                   new => assigned     
04-04-08 12:08  hank_le        Assigned To               => uClibc          
04-04-08 12:08  hank_le        File Added: pthread_test.c                    
04-19-08 23:00  carmelo73      Relationship added       duplicate of 0002264
04-22-08 08:23  carmelo73      Note Added: 0006974                          
04-24-08 11:07  hank_le        Note Added: 0007054                          
04-24-08 22:23  carmelo73      Note Added: 0007104                          
04-24-08 22:29  carmelo73      Status                   assigned => feedback
04-28-08 13:19  hank_le        Note Added: 0007284                          
04-28-08 13:32  hank_le        Note Edited: 0007284                         
04-29-08 06:59  hank_le        Note Added: 0007304                          
04-29-08 07:00  hank_le        Note Edited: 0007304                         
04-29-08 07:01  hank_le        Note Edited: 0007304                         
04-29-08 08:44  hank_le        Note Added: 0007314                          
======================================================================




More information about the uClibc-cvs mailing list