aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-10-25 16:50:10 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-10-25 16:50:10 +0200
commite096b7a1896886eb7dd2732ccbf1184b0eec9a63 (patch)
tree5103d7ac775aa666e88dec259263f223457e6969 /elf/rtld.c
parent9897ced8e78db5d813166a7ccccfd5a42c69ef20 (diff)
downloadglibc-e096b7a1896886eb7dd2732ccbf1184b0eec9a63.tar.xz
glibc-e096b7a1896886eb7dd2732ccbf1184b0eec9a63.zip
elf: Signal LA_ACT_CONSISTENT to auditors after RT_CONSISTENT switch
Auditors can call into the dynamic loader again if LA_ACT_CONSISTENT, and those recursive calls could observe r_state != RT_CONSISTENT. We should consider failing dlopen/dlmopen/dlclose if r_state != RT_CONSISTENT. The dynamic linker is probably not in a state in which it can handle reentrant calls. This needs further investigation. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index cb6b61d570..cb6199aa61 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2369,9 +2369,6 @@ dl_main (const ElfW(Phdr) *phdr,
_dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
_dl_sysdep_start_cleanup ();
- /* Auditing checkpoint: we have added all objects. */
- _dl_audit_activity_nsid (LM_ID_BASE, LA_ACT_CONSISTENT);
-
/* Notify the debugger all new objects are now ready to go. We must re-get
the address since by now the variable might be in another object. */
r = _dl_debug_update (LM_ID_BASE);
@@ -2379,6 +2376,9 @@ dl_main (const ElfW(Phdr) *phdr,
_dl_debug_state ();
LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
+ /* Auditing checkpoint: we have added all objects. */
+ _dl_audit_activity_nsid (LM_ID_BASE, LA_ACT_CONSISTENT);
+
#if defined USE_LDCONFIG && !defined MAP_COPY
/* We must munmap() the cache file. */
_dl_unload_cache ();