From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
John Mellor-Crummey <johnmc@rice.edu>
Subject: Re: [PATCH 1/5] elf: Fix audit regression
Date: Wed, 07 Jul 2021 22:02:19 +0200 [thread overview]
Message-ID: <87fswp28qc.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <87k0m1j41u.fsf@igel.home> (Andreas Schwab's message of "Wed, 07 Jul 2021 21:51:25 +0200")
* Andreas Schwab:
> On Jul 07 2021, Adhemerval Zanella via Libc-alpha wrote:
>
>> @@ -771,7 +771,7 @@ dl_open_worker (void *a)
>> {
>> struct link_map *libc_map = GL(dl_ns)[args->nsid].libc_map;
>> #ifdef SHARED
>> - bool initial = libc_map->l_ns == LM_ID_BASE;
>> + bool initial = libc_map != NULL ? libc_map->l_ns == LM_ID_BASE : false;
>
> bool initial = libc_map != NULL && libc_map->l_ns == LM_ID_BASE;
True … but:
This is only used by dlopen/dlmopen, right? And even if dlmopen is
called from an auditor (to load another libc), it is *never* the initial
libc in the base namespace.
The actual base namespace libc is handled in elf/rtld.c:dl_main:
/* Relocation is complete. Perform early libc initialization. This
is the initial libc, even if audit modules have been loaded with
other libcs. */
_dl_call_libc_early_init (GL(dl_ns)[LM_ID_BASE].libc_map, true);
And I think the dl_open_worker should mirror that and just do:
if (!args->libc_already_loaded)
/* This is never the initial libc because it has been loaded via
dlmopen. */
_dl_call_libc_early_init (libc_map, false);
Thanks,
Florian
next prev parent reply other threads:[~2021-07-07 20:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 18:26 [PATCH 0/5] Some rtld-audit fixes Adhemerval Zanella
2021-07-07 18:26 ` [PATCH 1/5] elf: Fix audit regression Adhemerval Zanella
2021-07-07 19:02 ` Florian Weimer
2021-07-07 19:07 ` Adhemerval Zanella
2021-07-07 19:51 ` Andreas Schwab
2021-07-07 19:57 ` Adhemerval Zanella
2021-07-07 20:02 ` Florian Weimer [this message]
2021-07-07 20:07 ` Florian Weimer
2021-07-08 12:13 ` Adhemerval Zanella
2021-07-07 18:26 ` [PATCH 2/5] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) Adhemerval Zanella
2021-07-07 19:20 ` Florian Weimer
2021-07-07 20:05 ` Adhemerval Zanella
2021-07-07 20:15 ` Florian Weimer
2021-07-07 20:53 ` John Mellor-Crummey
2021-07-19 13:17 ` Adhemerval Zanella
2021-07-07 18:26 ` [PATCH 3/5] elf: Add audit tests for modules with TLSDESC Adhemerval Zanella
2021-07-07 18:26 ` [PATCH 4/5] elf: Do not fail for failed dlmopen on audit modules (BZ #28061) Adhemerval Zanella
2021-07-07 18:26 ` [PATCH 5/5] elf: Suppress audit calls when a (new) namespace is empty (BZ #28062) Adhemerval Zanella
2021-07-07 19:02 ` [PATCH 0/5] Some rtld-audit fixes John Mellor-Crummey
2021-07-07 19:09 ` Adhemerval Zanella
2021-07-07 19:22 ` John Mellor-Crummey
2021-07-08 6:25 ` Florian Weimer
2021-07-08 8:03 ` John Mellor-Crummey
2021-07-08 8:21 ` Florian Weimer
2021-07-08 0:09 ` John Mellor-Crummey
2021-07-08 0:11 ` John Mellor-Crummey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fswp28qc.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=johnmc@rice.edu \
--cc=libc-alpha@sourceware.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).