Re: [PATCH v26 26/30] ELF: Introduce arch_setup_elf_property()

Borislav Petkov
2021-05-20T09:27:40Z

On Wed, May 19, 2021 at 03:14:58PM -0700, Yu, Yu-cheng wrote:
> However, those parsing functions take (struct arch_elf_state *) as an input.

Exactly.

> It probably makes sense to have ARCH_USE_GNU_PROPERTY dependent on
> ARCH_BINFMT_ELF_STATE. It would be ok as-is too. ARM people might have
> other plans in mind.

Well, let's look at ARM, ARM64 in particular. They have defined struct
arch_elf_state without the ifdeffery in

arch/arm64/include/asm/elf.h

and are using that struct in arch_parse_elf_property().

And they have selected ARCH_BINFMT_ELF_STATE just so that they disable
those dummy accessors in fs/binfmt_elf.c

And you're practically glueing together ARCH_BINFMT_ELF_STATE and
ARCH_USE_GNU_PROPERTY. However, all the functionality is for adding
the gnu property note so I think you should select both but only use
ARCH_USE_GNU_PROPERTY in all the ifdeffery in your patch to at least
have this as simple as possible.

> I just looked at the ABI document.

Which document is that? Link?

> ARM has GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
>
> X86 has:
> GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
> GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
> GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002

Our defines should at least have a comment pointing to that document.

Thx.

--
Regards/Gruss,
Boris.