From 9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 11 Dec 2020 17:30:03 +0100 Subject: 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 --- elf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elf/Makefile') diff --git a/elf/Makefile b/elf/Makefile index 66ffbdd8dc..0b4d78c874 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -229,7 +229,7 @@ tests-internal += loadtest unload unload2 circleload1 \ tst-ptrguard1 tst-stackguard1 tst-libc_dlvsym \ tst-create_format1 tst-tls-surplus tst-dl-hwcaps_split tests-container += tst-pldd tst-dlopen-tlsmodid-container \ - tst-dlopen-self-container + tst-dlopen-self-container tst-preload-pthread-libc test-srcs = tst-pathopt selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ifneq ($(selinux-enabled),1) -- cgit v1.2.1