Ulrich Drepper wrote:
>Richard Gooch <rgooch@xxxxxxxxxxxxxxx> writes:
>
>> So why do old binaries (compiled with glibc 2.1.3) segfault when they
>> call dlsym() with RTLD_NEXT? Even newly compiled binaries (with glibc
>> 2.2) still segfault.
>
>What do you ask me? You wrote the code.
Richard is correct -- RTLD_NEXT seems to have been mutilated
beyond recognition in glibc-2.2.
Observe:
> Script started on Mon Feb 5 13:19:19 2001
> stout_1_cat bug.c
> #define _GNU_SOURCE /* wtf?! RTLD_NEXT is undefined otherwise */
> #include <dlfcn.h>
> int main(void) { dlsym(RTLD_NEXT, "sigaction"); return 0; }
Nothing fancy here.
> stout_2_gcc bug.c -ldl
> stout_3_./a.out
> Segmentation fault (core dumped)
Oh dear.
> stout_4_echo where | gdb a.out core
> GNU gdb 5.0
> Copyright 2000 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 "i386-redhat-linux"...
> Core was generated by `./a.out'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libdl.so.2...done.
> Loaded symbols for /lib/libdl.so.2
> Reading symbols from /lib/libc.so.6...done.
> Loaded symbols for /lib/libc.so.6
> Reading symbols from /lib/ld-linux.so.2...done.
> Loaded symbols for /lib/ld-linux.so.2
> #0 0x4000dc38 in _dl_signal_error (errcode=0, objname=0x0,
> errstring=0x4013ef00 "RTLD_NEXT used in code not dynamically loaded")
> at dl-error.c:79
> 79 dl-error.c: No such file or directory.
> (gdb) Hangup detected on fd 0
> error detected on stdin
Note the errstring. "RTLD_NEXT used in code not dynamically loaded".
WTF is this? I have successfully used RTLD_NEXT from the main app
for several years, as I know many others have too. Solaris & Linux.
If RTLD_NEXT is now limited to be called only from within .so objects,
then that's a major step in the wrong direction.
> stout_5_rpm -q glibc
> glibc-2.2-12
>From the RH7.0 updates directory.
/Mikael
(. not cc:d to lkml .)
|