This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] elf: Never use the file ID of the main executable [BZ #24900]
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot net dot br>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 23 Sep 2019 11:21:33 -0300
- Subject: Re: [PATCH] elf: Never use the file ID of the main executable [BZ #24900]
- References: <email@example.com>
On Thu, 22 Aug 2019, Florian Weimer wrote:
>If the loader is invoked explicitly and loads the main executable,
>it stores the file ID of the main executable in l_file_id. This
>information is not available if the main excutable is loaded by the
>kernel, so this is another case where the two cases differ.
>This enhances commit 23d2e5faf0bca6d9b31bef4aa162b95ee64cbfc6
>("elf: Self-dlopen failure with explict loader invocation
As we discussed at Cauldron, I had reviewed this patch and noticed that it
changes the place where elf/tst-dlopen-aout fails.
Before this patch, it fails in the test case itself , at:
error: tst-dlopen-aout.c:48: dlopen succeeded unexpectedly: elf/tst-dlopen-aout
After this patch, it fails at:
elf/dl-tls.c: 517: _dl_allocate_tls_init: Assertion `listp != NULL' failed!
which, as you explained to me at Cauldron, is expected and will only be
solved with a sebsequent patch . As you also mentioned to me at
Cauldron, reviewing the second patch is a little tricky, but I'll try to
>- /* Get file information. */
>+ /* Get file information. To match the kernel behavior, do not fill
>+ in this information for the executable in case of an explicit
>+ loader invocation. */
> struct r_file_id id;
>+ if (mode & __RTLD_OPENEXEC)
>+ assert (nsid == LM_ID_BASE);
>+ memset (&id, 0, sizeof (id));
I think that this patch does the right thing and could be committed.
Reviewed-by: Gabriel F. T. Gomes <firstname.lastname@example.org>