elf: Partially initialize ld.so after static dlopen (bug 20802)

System Internals / glibc - Florian Weimer [redhat.com] - 17 May 2021 08:06 UTC

After static dlopen, a copy of ld.so is loaded into the inner namespace, but that copy is not initialized at all. Some architectures run into serious problems as result, which is why the _dl_var_init mechanism was invented. With libpthread moving into libc and parts into ld.so, more architectures impacted, so it makes sense to switch to a generic mechanism which performs the partial initialization.

As a result, getauxval now works after static dlopen (bug 20802).

78b31cc834 elf: Partially initialize ld.so after static dlopen (bug 20802)
dlfcn/tststatic5.c | 11 ++-----
elf/Makefile | 11 +++++--
elf/dl-open.c | 17 ++++++++--
elf/rtld_static_init.c | 56 ++++++++++++++++++++++++++++++++
elf/tst-auxvalmod.c | 29 +++++++++++++++++
elf/tst-getauxval-static.c | 66 ++++++++++++++++++++++++++++++++++++++
sysdeps/generic/ldsodefs.h | 7 ++++
sysdeps/generic/rtld_static_init.h | 24 ++++++++++++++
8 files changed, 208 insertions(+), 13 deletions(-)

Upstream: sourceware.org


  • Share