public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp2@yandex.ru>
To: libc-alpha@sourceware.org
Cc: Stas Sergeev <stsp2@yandex.ru>
Subject: [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127]
Date: Tue, 21 Feb 2023 20:33:06 +0500	[thread overview]
Message-ID: <20230221153307.548259-2-stsp2@yandex.ru> (raw)
In-Reply-To: <20230221153307.548259-1-stsp2@yandex.ru>

Currently dlmopen() does not allow to load objects into an audit
namespace. But the RTLD_NOLOAD case was forgotten, so the too
restrictive check prevents even getting a handle for an objects
in an audit namespace.

This patch fixes the problem by relaxing a check in case of
RTLD_NOLOAD.

Test-case on x86_64 revealed no regressions.

Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
---
 elf/dl-open.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/elf/dl-open.c b/elf/dl-open.c
index 91a2d8a538..c7ce0396d3 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -864,7 +864,8 @@ no more namespaces available for dlmopen()"));
 		  DL_NNS is 1 and so any NSID != 0 is invalid.  */
 	       || DL_NNS == 1
 	       || GL(dl_ns)[nsid]._ns_nloaded == 0
-	       || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+	       || (GL(dl_ns)[nsid]._ns_loaded->l_auditing &&
+	                           !(mode & RTLD_NOLOAD))))
     _dl_signal_error (EINVAL, file, NULL,
 		      N_("invalid target namespace in dlmopen()"));
 
-- 
2.37.2


  reply	other threads:[~2023-02-21 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 15:33 [PATCH 0/2] minimal run-time audit support Stas Sergeev
2023-02-21 15:33 ` Stas Sergeev [this message]
2023-02-21 15:33 ` [PATCH 2/2] dlfcn,elf: impl dlload_audit_module [BZ #30127] Stas Sergeev
2023-02-23  8:09 [PATCH v2 0/2] minimal run-time audit support Stas Sergeev
2023-02-23  8:09 ` [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Stas Sergeev
2023-02-24 16:53 [PATCH v3 0/2] minimal run-time audit support Stas Sergeev
2023-02-24 16:53 ` [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Stas Sergeev
2023-02-26 11:16 [PATCH v4 0/2] minimal run-time audit support Stas Sergeev
2023-02-26 11:16 ` [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Stas Sergeev
2023-02-28 16:51 [PATCH v5 0/2] minimal run-time audit support Stas Sergeev
2023-02-28 16:51 ` [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127] Stas Sergeev
2023-03-01 15:08 [PATCH v6 0/2] minimal run-time audit support Stas Sergeev
2023-03-01 15:08 ` [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [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=20230221153307.548259-2-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).