[2/3] dl-audit: avoid closing fake ld.so [BZ #30127]
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
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(-)
@@ -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);