]> sourceware.org Git - glibc.git/commit
elf: Include libc.so.6 as main program in dependency sort (bug 20972)
authorFlorian Weimer <fweimer@redhat.com>
Fri, 11 Dec 2020 16:30:03 +0000 (17:30 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 11 Dec 2020 17:31:04 +0000 (18:31 +0100)
commit9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147
tree282edafe2868969dc6e734377d9f88f317c28059
parentcb81264fd9973cd95bbc71495185b98979d28918
elf: Include libc.so.6 as main program in dependency sort (bug 20972)

_dl_map_object_deps always sorts the initially loaded object first
during dependency sorting.  This means it is relocated last in
dl_open_worker.  This results in crashes in IFUNC resolvers without
lazy bindings if libraries are preloaded that refer to IFUNCs in
libc.so.6: the resolvers are called when libc.so.6 has not been
relocated yet, so references to _rtld_global_ro etc. crash.

The fix is to check against the libc.so.6 link map recorded by the
__libc_early_init framework, and let it participate in the dependency
sort.

This fixes bug 20972.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
elf/Makefile
elf/dl-deps.c
elf/tst-preload-pthread-libc.c [new file with mode: 0644]
This page took 0.041711 seconds and 5 git commands to generate.