From 063f9ba220f434c7f30dd65c4cff17c0c458a7cf Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 30 Jun 2021 10:24:09 -0300 Subject: elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) The rtld-audit interfaces introduces a slowdown due to enabling profiling instrumentation (as if LD_AUDIT implied LD_PROFILE). However, instrumenting is only necessary if one of audit libraries provides PLT callbacks (la_pltenter or la_pltexit symbols). Otherwise, the slowdown can be avoided. The following patch adjusts the logic that enables profiling to iterate over all audit modules and check if any of those provides a PLT hook. To keep la_symbind to work even without PLT callbacks, _dl_fixup now calls the audit callback if the modules implements it. Co-authored-by: Alexander Monakov Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Florian Weimer --- include/link.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/link.h') diff --git a/include/link.h b/include/link.h index c1c382c..6a9f788 100644 --- a/include/link.h +++ b/include/link.h @@ -367,8 +367,10 @@ extern struct r_debug_extended _r_debug_extended attribute_hidden; #if __ELF_NATIVE_CLASS == 32 # define symbind symbind32 +# define LA_SYMBIND "la_symbind32" #elif __ELF_NATIVE_CLASS == 64 # define symbind symbind64 +# define LA_SYMBIND "la_symbind64" #else # error "__ELF_NATIVE_CLASS must be defined" #endif -- cgit v1.1