On 5/20/2021 2:26 AM, Borislav Petkov wrote:
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.
ARM64 has ARCH_USE_GNU_PROPERTY and ARCH_BINFMT_ELF_STATE selected
unconditionally. We will do the same for X86_64 and remove the ifdeffery.
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.
The latest pdf's are posted here.
https://gitlab.com/x86-psABIs/x86-64-ABI/-/wikis/x86-64-psABI
Thanks,
Yu-cheng