public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* dlmopen in LD_PRELOAD
@ 2019-06-17 18:06 Baojun Wang
  2019-06-17 18:40 ` Florian Weimer
  0 siblings, 1 reply; 13+ messages in thread
From: Baojun Wang @ 2019-06-17 18:06 UTC (permalink / raw)
  To: libc-help

Hi libc,

Can `dlmopen` be called in a DSO being `LD_PRELOAD`-ed? The idea is to
create a minimal DSO used for `LD_PRELOAD`, then inside the DSO
(.init_array), call `dlmopen` to open the DSO that I'm really interested
in. hence the DSO being `LD_PRELOAD` acts like a mini loader only.

I did exactly above, but ran into issue (segfault) with stack overflow:

```
       ... 47539 frames omitted...

    frame #47540: 0x00007ffff73cd1b0
libc.so.6`__GI___libc_malloc(bytes=160) at malloc.c:3042

    frame #47541: 0x00007ffff7de7b90 ld-linux-x86-64.so.2`tls_get_addr_tail
at dl-tls.c:594

    frame #47542: 0x00007ffff7de7b6c ld-linux-x86-64.so.2`tls_get_addr_tail
at dl-tls.c:607

    frame #47543: 0x00007ffff7de7b5e
ld-linux-x86-64.so.2`tls_get_addr_tail(ti=0x00007ffff6f14940,
dtv=0x0000000000608330, the_map=0x0000000000602330) at dl-tls.c:787

    frame #47544: 0x00007ffff7deea28 ld-linux-x86-64.so.2`__tls_get_addr at
tls_get_addr.S:55

    frame #47545: 0x00007ffff6ce800c

    frame #47546: 0x00007ffff73c790a libc.so.6`arena_get2(size=576,
avoid_arena=0x00007ffff609e0d0) at arena.c:888

    frame #47547: 0x00007ffff73cc54d libc.so.6`tcache_init at arena.c:879

    frame #47548: 0x00007ffff73cc530 libc.so.6`tcache_init at malloc.c:2986

    frame #47549: 0x00007ffff73cd1cb libc.so.6`__GI___libc_malloc at
malloc.c:2983

    frame #47550: 0x00007ffff73cd1b0
libc.so.6`__GI___libc_malloc(bytes=160) at malloc.c:3042

    frame #47551: 0x00007ffff7de7b90 ld-linux-x86-64.so.2`tls_get_addr_tail
at dl-tls.c:594

    frame #47552: 0x00007ffff7de7b6c ld-linux-x86-64.so.2`tls_get_addr_tail
at dl-tls.c:607

    frame #47553: 0x00007ffff7de7b5e
ld-linux-x86-64.so.2`tls_get_addr_tail(ti=0x00007ffff6f14940,
dtv=0x0000000000608330, the_map=0x0000000000602330) at dl-tls.c:787

    frame #47554: 0x00007ffff7deea28 ld-linux-x86-64.so.2`__tls_get_addr at
tls_get_addr.S:55
```

Is this an ideal use case for `dlmopen`? What (went wrong) caused the stack
overflow?

Thanks
Baojun

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-07-05 18:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 18:06 dlmopen in LD_PRELOAD Baojun Wang
2019-06-17 18:40 ` Florian Weimer
2019-06-17 18:55   ` Baojun Wang
2019-06-17 18:58     ` Baojun Wang
2019-06-17 19:02     ` Florian Weimer
2019-06-18  4:15       ` Baojun Wang
2019-06-21 11:53         ` Florian Weimer
2019-06-21 14:11           ` Baojun Wang
2019-06-21 16:11             ` Florian Weimer
2019-06-21 20:23               ` Baojun Wang
2019-07-04 13:22                 ` Florian Weimer
2019-07-05 18:21         ` Florian Weimer
2019-07-05 18:26           ` Baojun Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).