From: Stas Sergeev <stsp2@yandex.ru>
To: libc-alpha@sourceware.org
Cc: Stas Sergeev <stsp2@yandex.ru>
Subject: [PATCH 2/3] dl-audit: avoid closing fake ld.so [BZ #30127]
Date: Fri, 3 Mar 2023 01:40:14 +0500 [thread overview]
Message-ID: <20230302204015.3691525-3-stsp2@yandex.ru> (raw)
In-Reply-To: <20230302204015.3691525-1-stsp2@yandex.ru>
When new namespace is created, the fake ld.so object is created
that refers to main one via l_real pointer. Such object is not
passed to la_objopen() but is passed to la_objclose(), resulting
in an unrecognized cookie.
This patch avoids passing such objects to la_objclose().
The test-case for this is presented in a next patch.
Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
---
elf/dl-audit.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/elf/dl-audit.c b/elf/dl-audit.c
index 00e794aa26..ebfca887aa 100644
--- a/elf/dl-audit.c
+++ b/elf/dl-audit.c
@@ -96,7 +96,9 @@ void
_dl_audit_objclose (struct link_map *l)
{
if (__glibc_likely (GLRO(dl_naudit) == 0)
- || GL(dl_ns)[l->l_ns]._ns_loaded->l_auditing)
+ || GL(dl_ns)[l->l_ns]._ns_loaded->l_auditing
+ /* In non-base NS skip closing "fake" ld.so as it was not opened. */
+ || l->l_real != l)
return;
struct audit_ifaces *afct = GLRO(dl_audit);
--
2.37.2
next prev parent reply other threads:[~2023-03-02 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 20:40 [PATCH v8 0/3] minimal run-time audit support Stas Sergeev
2023-03-02 20:40 ` [PATCH 1/3] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Stas Sergeev
2023-03-02 20:40 ` Stas Sergeev [this message]
2023-03-02 20:40 ` [PATCH 3/3] dlfcn,elf: impl dlload_audit_module " Stas Sergeev
-- strict thread matches above, loose matches on Subject: below --
2023-03-03 12:06 [PATCH v9 0/3] minimal run-time audit support Stas Sergeev
2023-03-03 12:06 ` [PATCH 2/3] dl-audit: avoid closing fake ld.so [BZ #30127] Stas Sergeev
2023-03-02 19:40 [PATCH v7 0/3] minimal run-time audit support Stas Sergeev
2023-03-02 19:40 ` [PATCH 2/3] dl-audit: avoid closing fake ld.so [BZ #30127] Stas Sergeev
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=20230302204015.3691525-3-stsp2@yandex.ru \
--to=stsp2@yandex.ru \
--cc=libc-alpha@sourceware.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).