[PATCH 2/3] dl-audit: avoid closing fake ld.so [BZ #30127]
Stas Sergeev
stsp2@yandex.ru
Thu Mar 2 20:40:14 GMT 2023
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
More information about the Libc-alpha
mailing list