[prev in list] [next in list] [prev in thread] [next in thread] 

List:       glibc-alpha
Subject:    [PATCH 1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127]
From:       Stas Sergeev via Libc-alpha <libc-alpha () sourceware ! org>
Date:       2023-02-28 16:51:57
Message-ID: 20230228165158.685970-2-stsp2 () yandex ! ru
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic