diff options
author | Florian Weimer <fweimer@redhat.com> | 2019-08-15 14:37:50 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2019-08-15 18:53:32 +0200 |
commit | 23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6 (patch) | |
tree | 11fc805f477834891503dcf35ba52d183b71d0d5 /elf/Makefile | |
parent | 42760d764649ad82f5fe45a26cbdf2c2500409f7 (diff) | |
download | glibc-23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6.tar.gz glibc-23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6.tar.xz glibc-23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6.zip |
elf: Self-dlopen failure with explict loader invocation [BZ #24900]
In case of an explicit loader invocation, ld.so essentially performs a dlopen call to load the main executable. Since the pathname of the executable is known at this point, it gets stored in the link map. In regular mode, the pathname is not known and "" is used instead. As a result, if a program calls dlopen on the pathname of the main program, the dlopen call succeeds and returns a handle for the main map. This results in an unnecessary difference between glibc testing (without --enable-hardcoded-path-in-tests) and production usage. This commit discards the names when building the link map in _dl_new_object for the main executable, but it still determines the origin at this point in case of an explict loader invocation. The reason is that the specified pathname has to be used; the kernel has a different notion of the main executable.
Diffstat (limited to 'elf/Makefile')
-rw-r--r-- | elf/Makefile | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile index e8c3458963..d470e41402 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -199,7 +199,7 @@ tests-internal += loadtest unload unload2 circleload1 \ tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ tst-ptrguard1 tst-stackguard1 tst-libc_dlvsym \ tst-create_format1 -tests-container += tst-pldd +tests-container += tst-pldd tst-dlopen-aout-container test-srcs = tst-pathopt selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ifneq ($(selinux-enabled),1) @@ -1268,6 +1268,8 @@ $(objpfx)tst-addr1: $(libdl) $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library) $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library) +$(objpfx)tst-dlopen-aout-container: $(libdl) $(shared-thread-library) +LDFLAGS-tst-dlopen-aout-container += -Wl,-rpath,\$$ORIGIN CFLAGS-ifuncmain1pic.c += $(pic-ccflag) CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag) |