linuxthreads broken in glibc 2.2?
Mark Kettenis
kettenis@wins.uva.nl
Sat Jul 1 04:04:00 GMT 2000
From: Andreas Jaeger <aj@suse.de>
Date: 01 Jul 2000 11:47:33 +0200
>>>>> Andreas Jaeger writes:
> I've get now failures running the linuxthreads tests on i686-linux in
> the current CVS version. Can anybody confirm this?
This happens only with static binaries (--disable-shared), the shared
libraries look fine.
Running linuxthreads/ex1 in gdb gives:
Program received signal SIGSEGV, Segmentation fault.
0x8052fd7 in __geteuid () at ../sysdeps/unix/sysv/linux/i386/geteuid.c:47
47 int saved_errno = errno;
(gdb) bt
#0 0x8052fd7 in __geteuid () at ../sysdeps/unix/sysv/linux/i386/geteuid.c:47
#1 0x80546bc in __libc_init_secure () at ../sysdeps/generic/enbl-secure.c:32
#2 0x805474f in init (argc=1, argv=0xbffff7f4, envp=0xbffff7fc)
at ../sysdeps/unix/sysv/linux/init-first.c:150
#3 0x804dffe in __libc_start_main (main=0x8048230 <main>, argc=1,
ubp_av=0xbffff7f4, init=0x80480b4 <_init>, fini=0x80935c0 <_fini>,
rtld_fini=0, stack_end=0xbffff7ec) at ../sysdeps/generic/libc-start.c:81
(gdb) p errno
$1 = 0
(gdb) p saved_errno
No symbol "saved_errno" in current context.
The other test programs segfault at the same place. Any ideas what's
broken?
Yep. __pthread_initialize_minimal() hasn't been called yet. It is
called from the libc constructor functions, but if you look at
sysdeps/generic/libc-start.c, you'll see that __libc_init_secure() is
called before __libc_init_first() which calls the constructors.
I suppose that there is no problem when using the old method of
getting at the per-thread errno (which is still used on everything <
i686), but it fails for the stuff that uses the LDT, since the LDT
hasn't been set up yet.
I'm entirely not sure how to fix this. Calling
__pthread_initialize_minimal from __libc_start_main() #ifndef SHARED
is probably the easiest solution.
Mark
More information about the Libc-hacker
mailing list