aboutsummaryrefslogtreecommitdiff
path: root/dlfcn/dlmopen.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-04-26 14:23:02 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-04-26 14:52:20 +0200
commit106b7e0e45b258672a9c6f0e1de96baeb17a513f (patch)
tree691ba1dea0c0140193268507f4a490e0228ab541 /dlfcn/dlmopen.c
parente5cf8ccca655c0eb831574785a6087f3950852eb (diff)
downloadglibc-106b7e0e45b258672a9c6f0e1de96baeb17a513f.zip
glibc-106b7e0e45b258672a9c6f0e1de96baeb17a513f.tar.gz
glibc-106b7e0e45b258672a9c6f0e1de96baeb17a513f.tar.bz2
dlfcn: Do not use rtld_active () to determine ld.so state (bug 29078)
When audit modules are loaded, ld.so initialization is not yet complete, and rtld_active () returns false even though ld.so is mostly working. Instead, the static dlopen hook is used, but that does not work at all because this is not a static dlopen situation. Commit 466c1ea15f461edb8e3ffaf5d86d708876343bbf ("dlfcn: Rework static dlopen hooks") moved the hook pointer into _rtld_global_ro, which means that separate protection is not needed anymore and the hook pointer can be checked directly. The guard for disabling libio vtable hardening in _IO_vtable_check should stay for now. Fixes commit 8e1472d2c1e25e6eabc2059170731365f6d5b3d1 ("ld.so: Examine GLRO to detect inactive loader [BZ #20204]"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 8dcb6d0af07fda3607b541857e4f3970a74ed55b)
Diffstat (limited to 'dlfcn/dlmopen.c')
-rw-r--r--dlfcn/dlmopen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c
index 2437f5c..b41778f 100644
--- a/dlfcn/dlmopen.c
+++ b/dlfcn/dlmopen.c
@@ -80,7 +80,7 @@ dlmopen_implementation (Lmid_t nsid, const char *file, int mode,
void *
___dlmopen (Lmid_t nsid, const char *file, int mode)
{
- if (!rtld_active ())
+ if (GLRO (dl_dlfcn_hook) != NULL)
return GLRO (dl_dlfcn_hook)->dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
else
return dlmopen_implementation (nsid, file, mode, RETURN_ADDRESS (0));