]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Self-dlopen failure with explict loader invocation [BZ #24900]
authorFlorian Weimer <fweimer@redhat.com>
Thu, 15 Aug 2019 12:37:50 +0000 (14:37 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 15 Aug 2019 16:53:32 +0000 (18:53 +0200)
commit23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6
tree11fc805f477834891503dcf35ba52d183b71d0d5
parent42760d764649ad82f5fe45a26cbdf2c2500409f7
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.
ChangeLog
elf/Makefile
elf/dl-object.c
elf/tst-dlopen-aout-container.c [new file with mode: 0644]
elf/tst-dlopen-aout.c