Re: [PATCH RFC 1/2] binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4

From: Catalin Marinas
Date: Thu Sep 12 2024 - 12:28:23 EST


On Fri, Sep 06, 2024 at 12:05:24AM +0100, Mark Brown wrote:
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 19fa49cd9907..32e45e65de8f 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -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);
> #ifdef 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_HWCAP3, ELF_HWCAP4);

s/HWCAP3/HWCAP4/ for the last line.

> #endif
> NEW_AUX_ENT(AT_EXECFN, bprm->exec);
> if (k_platform) {
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 28a3439f163a..9365f48598a1 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -620,6 +620,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP);
> #ifdef ELF_HWCAP2
> NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
> +#endif
> +#ifdef ELF_HWCAP3
> + NEW_AUX_ENT(AT_HWCAP3, ELF_HWCAP3);
> +#endif
> +#ifdef ELF_HWCAP3
> + NEW_AUX_ENT(AT_HWCAP4, ELF_HWCAP4);

Same here with the ifdef.

> #endif
> NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE);
> NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);
> diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c
> index 8f0af4f62631..0a219e26692a 100644
> --- a/fs/compat_binfmt_elf.c
> +++ b/fs/compat_binfmt_elf.c
> @@ -80,6 +80,21 @@
> #define ELF_HWCAP2 COMPAT_ELF_HWCAP2
> #endif
>
> +#ifdef COMPAT_ELF_HWCAP3
> +#undef ELF_HWCAP3
> +#define ELF_HWCAP3 COMPAT_ELF_HWCAP3
> +#endif
> +
> +#ifdef COMPAT_ELF_HWCAP3
> +#undef ELF_HWCAP3
> +#define ELF_HWCAP3 COMPAT_ELF_HWCAP3
> +#endif

Duplicate hunk.

--
Catalin