[1/2] elf/dl-open: fix audit wrt RTLD_NOLOAD [BZ #30127]

Message ID 20230228165158.685970-2-stsp2@yandex.ru
State Superseded
Headers
Series minimal run-time audit support |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

stsp Feb. 28, 2023, 4:51 p.m. UTC
  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(-)
  

Patch

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()"));