malloc: Use __libc_initial to detect an inner libc
commit29a4db291b1282f4088e549391d86b6b470f22be
authorFlorian Weimer <fweimer@redhat.com>
Wed, 16 Dec 2020 14:09:52 +0000 (16 15:09 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 16 Dec 2020 14:13:40 +0000 (16 15:13 +0100)
tree7aeec66b84cf95b0402816617a8f9b9c0418d2d3
parente7570f4131a6af9405af7b4fd1c31de807e7cf68
malloc: Use __libc_initial to detect an inner libc

The secondary/non-primary/inner libc (loaded via dlmopen, LD_AUDIT,
static dlopen) must not use sbrk to allocate member because that would
interfere with allocations in the outer libc.  On Linux, this does not
matter because sbrk itself was changed to fail in secondary libcs.

 _dl_addr occasionally shows up in profiles, but had to be used before
because __libc_multiple_libs was unreliable.  So this change achieves
a slight reduction in startup time.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
malloc/arena.c
malloc/malloc.c