rtld-elf: Pass parsed aux_info to ifunc_init

Currently we pass the raw pointer to the on-stack auxargs. This can
legitimately have fewer than AT_COUNT entries, so the use of
__min_size(AT_COUNT), i.e. static AT_COUNT, is inaccurate, and also
needlessly forces the callee to iterate over the elements to find the
entry for a given type. Instead we can just pass aux_info like we use
for everything else.

Note that the argument has been left unused by every callee since its
introduction in 4352999e0e ("Pass CPUID[1] %edx (cpu_feature), %ecx
(cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx
(cpu_stdext_feature2) to the ifunc resolvers on x86.")

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46276
This commit is contained in:
Jessica Clarke 2024-08-22 20:36:44 +01:00
parent 776cd02b89
commit 33658afd4e
9 changed files with 9 additions and 9 deletions

View file

@ -452,7 +452,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}

View file

@ -499,7 +499,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate)
uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2;
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
u_int p[4], cpu_high;

View file

@ -442,7 +442,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}

View file

@ -464,7 +464,7 @@ rtld_cpuid_count(int idx, int cnt, u_int *p)
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
u_int p[4], cpu_high;
int cpuid_supported;

View file

@ -813,7 +813,7 @@ powerpc_abi_variant_hook(Elf_Auxinfo** aux_info)
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}

View file

@ -710,7 +710,7 @@ powerpc64_abi_variant_hook(Elf_Auxinfo** aux_info)
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}

View file

@ -376,7 +376,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
}
void
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}

View file

@ -904,7 +904,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
exit (0);
}
ifunc_init(aux);
ifunc_init(aux_info);
/*
* Setup TLS for main thread. This must be done after the

View file

@ -438,7 +438,7 @@ int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *);
int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *);
int reloc_iresolve_nonplt(Obj_Entry *, struct Struct_RtldLockState *);
int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *);
void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]);
void ifunc_init(Elf_Auxinfo *[__min_size(AT_COUNT)]);
void init_pltgot(Obj_Entry *);
void allocate_initial_tls(Obj_Entry *);