about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2021-03-12 16:44:47 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-03-16 10:27:00 +0100
commitea5a537e879bb667e03435a2308d915dc89448a6 (patch)
tree29306738248ed8129991371b15dfdcfcca48d21b /elf/Makefile
parent64f6c287ad3ccd807b7d4c694f4a91e2a662fed5 (diff)
downloadglibc-ea5a537e879bb667e03435a2308d915dc89448a6.tar.gz
glibc-ea5a537e879bb667e03435a2308d915dc89448a6.tar.xz
glibc-ea5a537e879bb667e03435a2308d915dc89448a6.zip
elf: Always set l in _dl_init_paths (bug 23462)
After d1d5471579eb0426671bf94f2d71e61dfb204c30 ("Remove dead
DL_DST_REQ_STATIC code.") we always setup the link map l to make the
static and shared cases the same.  The bug is that in elf/dl-load.c
(_dl_init_paths) we conditionally set l only in the #ifdef SHARED
case, but unconditionally use it later.  The simple solution is to
remove the #ifdef SHARED conditional, because it's no longer needed,
and unconditionally setup l for both the static and shared cases. A
regression test is added to run a static binary with
LD_LIBRARY_PATH='$ORIGIN' which crashes before the fix and runs after
the fix.

Co-Authored-By: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 332421312576bd7095e70589154af99b124dd2d1)
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile5
1 files changed, 4 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 7610fa080f..63da0ed64f 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -164,7 +164,8 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
 	       tst-dl-iter-static \
 	       tst-tlsalign-static tst-tlsalign-extern-static \
 	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables \
-	       tst-single_threaded-static tst-single_threaded-pthread-static
+	       tst-single_threaded-static tst-single_threaded-pthread-static \
+	       tst-dst-static
 
 tests-static-internal := tst-tls1-static tst-tls2-static \
 	       tst-ptrguard1-static tst-stackguard1-static \
@@ -1905,3 +1906,5 @@ $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
 	cmp tst-rtld-list-tunables.exp \
 	    $(objpfx)/tst-rtld-list-tunables.out > $@; \
 	$(evaluate-test)
+
+tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'