[PATCH 2/5] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533)
Florian Weimer
fweimer@redhat.com
Wed Jul 7 19:20:16 GMT 2021
* Adhemerval Zanella via Libc-alpha:
> diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
> index e13a672ade..998cfef099 100644
> --- a/elf/dl-reloc.c
> +++ b/elf/dl-reloc.c
> @@ -181,7 +181,18 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
> #ifdef SHARED
> /* If we are auditing, install the same handlers we need for profiling. */
> if ((reloc_mode & __RTLD_AUDIT) == 0)
> - consider_profiling |= GLRO(dl_audit) != NULL;
> + {
> + struct audit_ifaces *afct = GLRO(dl_audit);
> + for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
> + {
> + /* Profiling is needed only if PLT hooks are provided. */
> + if (afct->symbind != NULL
> + || afct->ARCH_LA_PLTENTER != NULL
> + || afct->ARCH_LA_PLTEXIT != NULL)
> + consider_profiling = 1;
> + afct = afct->next;
> + }
> + }
Is the afct->symbind check really necessary? Looking at _dl_fixup, it
should be safe to call symbind with just the standard trampoline.
I think this needs a NEWS entry, describing how to activate this
optimization.
Thanks,
Florian
More information about the Libc-alpha
mailing list