]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 30 Jun 2021 13:24:09 +0000 (10:24 -0300)
committerCarlos O'Donell <carlos@redhat.com>
Tue, 29 Mar 2022 21:02:03 +0000 (17:02 -0400)
commit09c5dcf73b40e69a3dae97b6f98007797ad263eb
tree22e0eb8ecc38c10e595ee17636cd053388b89745
parent696f66660ba05a4e15db25c14d664f4fd5eb6a3b
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 <amonakov@ispras.ru>
Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 063f9ba220f434c7f30dd65c4cff17c0c458a7cf)

Resolved conflicts:
NEWS
elf/Makefile
NEWS
elf/Makefile
elf/dl-reloc.c
elf/dl-runtime.c
elf/rtld.c
elf/tst-audit19a.c [new file with mode: 0644]
elf/tst-audit19b.c [new file with mode: 0644]
elf/tst-audit19bmod.c [new file with mode: 0644]
elf/tst-auditmod19a.c [new file with mode: 0644]
elf/tst-auditmod19b.c [new file with mode: 0644]
include/link.h