Skip to content

Commit 4e6e8c2

Browse files
brooniectmarinas
authored andcommitted
binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4
AT_HWCAP3 and AT_HWCAP4 were recently defined for use on PowerPC in commit 3281366 ("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>
1 parent 9852d85 commit 4e6e8c2

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

fs/binfmt_elf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,
257257
NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
258258
#ifdef ELF_HWCAP2
259259
NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
260+
#endif
261+
#ifdef ELF_HWCAP3
262+
NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3);
263+
#endif
264+
#ifdef ELF_HWCAP4
265+
NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4);
260266
#endif
261267
NEW_AUX_ENT(AT_EXECFN, bprm->exec);
262268
if (k_platform) {

fs/binfmt_elf_fdpic.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
623623
NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP);
624624
#ifdef ELF_HWCAP2
625625
NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
626+
#endif
627+
#ifdef ELF_HWCAP3
628+
NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3);
629+
#endif
630+
#ifdef ELF_HWCAP4
631+
NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4);
626632
#endif
627633
NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE);
628634
NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);

fs/compat_binfmt_elf.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@
8080
#define ELF_HWCAP2 COMPAT_ELF_HWCAP2
8181
#endif
8282

83+
#ifdef COMPAT_ELF_HWCAP3
84+
#undef ELF_HWCAP3
85+
#define ELF_HWCAP3 COMPAT_ELF_HWCAP3
86+
#endif
87+
88+
#ifdef COMPAT_ELF_HWCAP4
89+
#undef ELF_HWCAP4
90+
#define ELF_HWCAP4 COMPAT_ELF_HWCAP4
91+
#endif
92+
8393
#ifdef COMPAT_ARCH_DLINFO
8494
#undef ARCH_DLINFO
8595
#define ARCH_DLINFO COMPAT_ARCH_DLINFO

0 commit comments

Comments
 (0)