From 8dcb6d0af07fda3607b541857e4f3970a74ed55b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 26 Apr 2022 14:23:02 +0200 Subject: 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 --- dlfcn/dlvsym.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dlfcn/dlvsym.c') diff --git a/dlfcn/dlvsym.c b/dlfcn/dlvsym.c index 72219d6da6..caa46ba1e0 100644 --- a/dlfcn/dlvsym.c +++ b/dlfcn/dlvsym.c @@ -65,7 +65,7 @@ dlvsym_implementation (void *handle, const char *name, const char *version, void * ___dlvsym (void *handle, const char *name, const char *version) { - if (!rtld_active ()) + if (GLRO (dl_dlfcn_hook) != NULL) return GLRO (dl_dlfcn_hook)->dlvsym (handle, name, version, RETURN_ADDRESS (0)); else -- cgit 1.4.1