binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4

AT_HWCAP3 and AT_HWCAP4 were recently defined for use on PowerPC in commit
3281366a8e ("uapi/auxvec: Define AT_HWCAP3 and AT_HWCAP4 aux vector,
entries"). Since we want to start using AT_HWCAP3 on arm64 add support for
exposing both these new hwcaps via binfmt_elf.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Kees Cook <kees@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20241004-arm64-elf-hwcap3-v2-1-799d1daad8b0@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
Mark Brown 2024-10-04 21:26:29 +01:00 committed by Catalin Marinas
parent 9852d85ec9
commit 4e6e8c2b75
3 changed files with 22 additions and 0 deletions

View File

@ -257,6 +257,12 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes); NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
#ifdef ELF_HWCAP2 #ifdef ELF_HWCAP2
NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
#endif
#ifdef ELF_HWCAP3
NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3);
#endif
#ifdef ELF_HWCAP4
NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4);
#endif #endif
NEW_AUX_ENT(AT_EXECFN, bprm->exec); NEW_AUX_ENT(AT_EXECFN, bprm->exec);
if (k_platform) { if (k_platform) {

View File

@ -623,6 +623,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP); NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP);
#ifdef ELF_HWCAP2 #ifdef ELF_HWCAP2
NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
#endif
#ifdef ELF_HWCAP3
NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3);
#endif
#ifdef ELF_HWCAP4
NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4);
#endif #endif
NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE); NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE);
NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);

View File

@ -80,6 +80,16 @@
#define ELF_HWCAP2 COMPAT_ELF_HWCAP2 #define ELF_HWCAP2 COMPAT_ELF_HWCAP2
#endif #endif
#ifdef COMPAT_ELF_HWCAP3
#undef ELF_HWCAP3
#define ELF_HWCAP3 COMPAT_ELF_HWCAP3
#endif
#ifdef COMPAT_ELF_HWCAP4
#undef ELF_HWCAP4
#define ELF_HWCAP4 COMPAT_ELF_HWCAP4
#endif
#ifdef COMPAT_ARCH_DLINFO #ifdef COMPAT_ARCH_DLINFO
#undef ARCH_DLINFO #undef ARCH_DLINFO
#define ARCH_DLINFO COMPAT_ARCH_DLINFO #define ARCH_DLINFO COMPAT_ARCH_DLINFO