On 02/09/2022 11:45, Sherwin da Cruz wrote:
This patchset adds partial support for the new aux entries in the PCuABI, which mainly passes capabilites to the program. The registers c0-c3 are also set to argc/argv/envp/auxv which currently still resides on the stack for backwards compatability. The patches are available at [1]. The constants for the new aux entries can be found at [2]. For reference the transitional PCuABI can be found at [3].
The capabilities placed in the aux vector do not have restricted permissions or bounds but have the address set to the specified value, except for AT_CHERI_STACK_CAP and AT_CHERI_CID_CAP. The upper and lower bounds of the RX and RW regions as defined in the PCuABI spec for both the interpreter and program are also determined, though the upper bounds are left unused since the bounds are currently not set on the new aux entries.
A morello kselftest ensures that the register values of c0-c3 in startup code matches the corresponding values on the stack.
[1] https://git.morello-project.org/sherwin-dc/linux/-/commits/morello/next/ [2] https://git.morello-project.org/morello/kernel/linux/-/wikis/Morello-pure-ca... [3] https://git.morello-project.org/morello/kernel/linux/-/wikis/Transitional-Mo...
Sherwin da Cruz (5): arm64: elf.h: Remove register init macro fs/binfmt_elf: Add additional Aux vector entries fs/binfmt_elf: Return result from START_THREAD macro fs/binfmt_elf: Set c0-c3 to argc/argv/envp/auxv
Those two patches don't have the right tag (the first should probably be "elf" and the second "arm64").
Apart from a logic error in patch 2 (probably a bad copy/paste), everything I commented on is cosmetic and/or wording so this is almost good to go :)
Kevin
kselftests/arm64/morello: Test for new aux entries and init registers
arch/arm64/include/asm/elf.h | 8 +- arch/arm64/include/asm/processor.h | 30 +++++- fs/binfmt_elf.c | 102 ++++++++++++++++-- fs/compat_binfmt_elf.c | 6 +- fs/exec.c | 4 +- include/linux/auxvec.h | 2 +- include/linux/elf.h | 7 +- include/uapi/linux/auxvec.h | 13 +++ .../selftests/arm64/morello/bootstrap.c | 58 +++++++--- .../arm64/morello/freestanding_start.S | 12 ++- 10 files changed, 208 insertions(+), 34 deletions(-)