This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: dlmopen in LD_PRELOAD
* Baojun Wang:
> Hi Florian,
>
> (re-send because previous email failed to send due to attachment)
>
> I made a tiny project this issue, it didn't show the same failure, however it did segfaults inside the library being `dlmopen`-ed.
>
> link: `git clone https://github.com/wangbj/dlns-test.git`
> (sorry attachment seems to cause failure to send message)
>
> run.c: an launcher to inject DSOs.
> preload.c: a mini loader using LD_PRELOAD -> dlmopen
> dlns.c: DSO being `dlmopen`-ed
> app.c: app being injected with DSOs.
>
> running `make test` should reproduce the issue. (need to run `ulimit
> -c unlimited` to get core dump).
Sorry, for me, it does not.
This is the output I get:
./run libpreload.so libdlns.so ./app
open /tmp/dlns-test/libdlns.so
dlns_init
[link_map] dso: /tmp/dlns-test/libdlns.so, loaded at: 0x7f0ca0d53000, _DYNAMIC: 0x7f0ca0d56de8
[link_map] dso: /lib64/libdl.so.2, loaded at: 0x7f0ca0d4d000, _DYNAMIC: 0x7f0ca0d51d70
[link_map] dso: /lib64/libpthread.so.0, loaded at: 0x7f0ca0b12000, _DYNAMIC: 0x7f0ca0b2dd60
[link_map] dso: /lib64/libc.so.6, loaded at: 0x7f0ca094c000, _DYNAMIC: 0x7f0ca0b0bb60
[link_map] dso: /lib64/ld-linux-x86-64.so.2, loaded at: (nil), _DYNAMIC: (nil)
#1 local_getpid addr = 0x401610
#0 local_getpid addr = 0x401610
#2 local_getpid addr = 0x401610
#3 local_getpid addr = 0x401610
#1 local_getpid: 0
#1 local_getpid: 0
#1 my own tls: 1234
#2 local_getpid: 0
#2 local_getpid: 0
#3 local_getpid: 0
#3 local_getpid: 0
#3 my own tls: 1234
#2 my own tls: 1234
#0 local_getpid: 0
#0 local_getpid: 0
#0 my own tls: 1234
Has your glibc been built with --enable-bind-now?
Thanks,
Florian