This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: LD_PRELOAD functions are called before _init


On 18 Sep 2014 11:03, Mark Hills wrote:
> (gdb) bt
> #0  0x000000344f632925 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1  0x000000344f634105 in abort () at abort.c:92
> #2  0x000000344f62ba4e in __assert_fail_base (fmt=<value optimized out>, assertion=0x7f9c378ed6e6 "real_fopen64", file=0x7f9c378ed6de "basic.c", line=<value optimized out>, function=<value optimized out>) at assert.c:96
> #3  0x000000344f62bb10 in __assert_fail (assertion=0x7f9c378ed6e6 "real_fopen64", file=0x7f9c378ed6de "basic.c", line=21, function=0x7f9c378ed6f3 "fopen64") at assert.c:105
> #4  0x00007f9c378ed66a in fopen64 (pathname=0x3451e162f6 "/proc/filesystems", mode=0x3451e161eb "r") at basic.c:21
> #5  0x0000003451e0cd2d in init_selinuxmnt () at init.c:49
> #6  init_lib () at init.c:118
> #7  0x0000003451e15cb6 in __do_global_ctors_aux () from /lib64/libselinux.so.1
> #8  0x0000003451e04fa3 in _init () from /lib64/libselinux.so.1
> #9  0x00007f9c378c84c8 in ?? ()
> #10 0x000000344ee0e555 in call_init (main_map=0x344f021188, argc=1375849744, argv=0x7fffc3f70418, env=0x7fffc3f70428) at dl-init.c:70
> #11 _dl_init (main_map=0x344f021188, argc=1375849744, argv=0x7fffc3f70418, env=0x7fffc3f70428) at dl-init.c:134
> #12 0x000000344ee00b3a in _dl_start_user () from /lib64/ld-2.12.so
> #13 0x0000000000000001 in ?? ()
> #14 0x00007fffc3f7230a in ?? ()
> #15 0x0000000000000000 in ?? ()

this is not a glibc bug.  `ls` is linked against libselinux, and libselinux also 
has an initializer that runs.  that init code, as you can see in the backtrace, 
uses the fopen symbols.

you need to fix your interposed library to handle this case.
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]