Hi All,
This series are modifications in kselftests required to compile
with alpha version of Morello Gnu toochain recently released [1].
The whole series can also be found here [2].
Changes in v3 as reviewed by Kevin:
* Patch 4 modified to fix the comment message.
* Patch 5 modified to define INT_MAX inside freestanding.h.
* Dropped patch 6 from v2 as the issue is reported to Morello GCC team.
* Patch 8 modified to add macros to create capability and not rely on clearing
selective permissions.
* Patch 9 modified to add memcpy/memmove optimized routine in a new file.
* Patch 10 modified to all allow LLVM definitions from user to swith to clang build.
Thanks,
Amit Daniel
[1]: https://developer.arm.com/downloads/-/arm-gnu-toolchain-for-morello-downloa…
[2]: git@git.morello-project.org:amitdaniel/linux.git gcc_kselftests_support_v3
Amit Daniel Kachhap (10):
kselftests/arm64: morello: Fix inline assembly syntax
kselftests/arm64: morello: Define uintcap_t for GCC
kselftests/arm64: morello: Fix the -Wcast-function-type warnings
kselftests/arm64: morello: Fix the fallthrough warning
kselftests/arm64: morello: Avoid limits.h for Gcc
kselftests/arm64: morello: clone: Initialize the local variable
kselftests/arm64: morello: clone: Guard if clause to avoid warning
kselftests/arm64: morello: Process the dynamic relocations
kselftests/arm64: morello: Add optimized routine for memcpy
kselftests/arm64: morello: Enable Gcc toolchain support
.../testing/selftests/arm64/morello/Makefile | 20 +-
.../selftests/arm64/morello/bootstrap.c | 7 +-
tools/testing/selftests/arm64/morello/clone.c | 6 +-
.../selftests/arm64/morello/freestanding.h | 7 +
.../arm64/morello/freestanding_init_globals.c | 133 ++++-
.../arm64/morello/freestanding_start.S | 5 +-
.../selftests/arm64/morello/morello_memcpy.S | 533 ++++++++++++++++++
.../testing/selftests/arm64/morello/signal.c | 4 +-
8 files changed, 693 insertions(+), 22 deletions(-)
create mode 100644 tools/testing/selftests/arm64/morello/morello_memcpy.S
--
2.25.1
Hi All,
This series are modifications in kselftests required to compile
with alpha version of Morello Gnu toochain recently released [1].
The whole series can also be found here [2].
Changes in v2:
Rebased and tested on Morello 6.1 kernel.
1) "kselftests/arm64: morello: Fix inline assembly syntax"
- Commit log change as suggested by Kevin.
2) "kselftests/arm64: morello: Define uintcap_t for GCC"
- Used "#ifndef __clang__" instead of "#ifndef uintcap_t"
3) "kselftests/arm64: morello: Fix the -Wcast-function-type warnings"
- New patch to fix cast function type warnings.
4) "kselftests/arm64: morello: Fix the fallthrough warning"
- New patch to fix fallthrough warning
5) "kselftests/arm64: morello: Avoid limits.h for Gcc"
- New patch to fix the compilation of non-existing limits.h
6) "kselftests/arm64: morello: Fix the field initializer warnings"
- New patch
7) "kselftests/arm64: morello: clone: Initialize the local variable"
- New patch to fix an uninitialized variable.
8) "kselftests/arm64: morello: clone: Guard if clause to avoid warning"
- New patch
9) "kselftests/arm64: morello: Process the dynamic relocations"
- Code re-structered and macros to create explicit capabilities. Now the logic
to create R/RW/RX is simpilfied and inspired from dyn. relocations in CheriBSD.
- Fixed position of __attribute__((may_alias)) in the pointer.
- Removed compiler barrier instruction.
- Functions renamed from __morello_init_{cap/dynamic}_relocs to __morello_process_{cap/dynamic}_relocs*.
- Implemented several minor suggestions from Kevin.
10) "kselftests/arm64: morello: Add optimized routine for memcpy"
- New patch to add memcpy/memmove assembly routines as suggested by Kevin.
11) "kselftests/arm64: morello: Enable Gcc toolchain support"
- Removed -integrated-as and --target clang flags as they are added
in 6.1 kernel as suggested by Kevin.
Thanks,
Amit Daniel
[1]: https://developer.arm.com/downloads/-/arm-gnu-toolchain-for-morello-downloa…
[2]: git@git.morello-project.org:amitdaniel/linux.git gcc_kselftests_support_v2
Amit Daniel Kachhap (11):
kselftests/arm64: morello: Fix inline assembly syntax
kselftests/arm64: morello: Define uintcap_t for GCC
kselftests/arm64: morello: Fix the -Wcast-function-type warnings
kselftests/arm64: morello: Fix the fallthrough warning
kselftests/arm64: morello: Avoid limits.h for Gcc
kselftests/arm64: morello: Fix the field initializer warnings
kselftests/arm64: morello: clone: Initialize the local variable
kselftests/arm64: morello: clone: Guard if clause to avoid warning
kselftests/arm64: morello: Process the dynamic relocations
kselftests/arm64: morello: Add optimized routine for memcpy
kselftests/arm64: morello: Enable Gcc toolchain support
.../testing/selftests/arm64/morello/Makefile | 12 +-
.../selftests/arm64/morello/bootstrap.c | 7 +-
tools/testing/selftests/arm64/morello/clone.c | 58 +-
.../selftests/arm64/morello/freestanding.h | 3 +
.../arm64/morello/freestanding_init_globals.c | 114 +++-
.../arm64/morello/freestanding_start.S | 525 +++++++++++++++++-
.../testing/selftests/arm64/morello/signal.c | 4 +-
7 files changed, 689 insertions(+), 34 deletions(-)
--
2.25.1
Hi,
This series is a follow-up to the RFC "New CHERI API and rehauled
user_ptr.h", with a slightly different scope to make it more
self-contained.
There are two main focuses for this series:
1. Introducing linux/cheri.h. There is no fundamental change compared to
v1 here.
2. Deriving all capabilities from an appropriate userspace root
capability (cheri_user_root_*) instead of morello_root_cap. v1 started
this by reimplementing uaddr_to_user_ptr*, this series finishes up
the work.
The focus of v1, adding generic functions to linux/user_ptr.h, has been
dropped and will reappear in a separate series.
Some more details on the choice of root capabilities (see the comment in
patch 5 regarding cheri_user_root_*):
* In purecap, the PCuABI spec gives us good guidance on which root
capability we should use where. Namely:
- cheri_user_root_cap for almost all capabilities. The permissions
correspond to the maximum permissions obtainable via mmap(). As we
progress through the second phase, the bounds/permissions of
capabilities derived from this root will be restricted as specified,
and DDC will be set to null.
- cheri_user_root_{seal,cid}_cap for the AT_CHERI_{SEAL,CID}_CAP.
These capabilities exist precisely because their permissions
(Seal/Unseal/CompartmentID) are not provided in regular
capabilities (derived from cheri_user_root_cap).
- cheri_user_root_all_cap for capabilities created via (privileged)
ptrace. See patch 13 for some details on this.
* In hybrid, the de facto ABI is what Documentation/arm64/morello.rst
says. As there is no mechanism to obtain special permissions, all
capabilities are derived from cheri_user_root_all_cap. The
documentation is updated accordingly.
This series introduces functional changes by restricting the
bounds/permissions of all userspace capabilities, but these restrictions
should not affect any valid use-case. More specifically:
* In purecap, the bounds of all capabilities are restricted to the user
address space. See above for details on permissions.
* In hybrid, the bounds of capabilities are also restricted to the user
address space. All relevant permissions remain available. CSP is no
longer initialised to a valid capability, as this is neither required
nor documented.
More detailed changelog below.
v1..v2:
* Addressing review comments:
- Reformatted the function documentation to make kernel-doc -v
(mostly) happy.
- Added some comment clarifying what CHERI_PERM_SW_VMEM is about.
- Renamed ARCH_HAS_CHERI_H to HAVE_ARCH_CHERI_H.
- Renamed cheri_root*_cap_userspace to cheri_user_root_*cap and added
some description of each.
- Renamed cheri_check_cap_data_access() to cheri_check_cap().
* New patches:
- Derive compat_ptr() from cheri_user_root_all_cap (deriving from DDC
proved more complicated than expected, created a ticket for that [1])
- Derive AT_CHERI_{SEAL,CID}_CAP from cheri_user_root_{seal,cid}_cap
- Initialisation of capability registers from cheri_user_root_* (with
a clear separation between purecap and hybrid)
- Capabilities created via (privileged) ptrace now derived from
cheri_user_root_all_cap
- Remove morello_root_cap (no longer used)
- Update documentation to reflect cheri_user_root_all_cap being the
new root capability in hybrid
* Other changes:
- As per a recent update to the PCuABI spec, the BranchSealedPair is
no longer part of the rootcap permission set. It is still needed in
certain user capabilities, so moved it from CHERI_PERMS_ROOTCAP to
explicit addition to cheri_user_root_cap in morello.c.
- Added cheri_user_root_all_cap, the "root of roots" with all
permissions. cheri_user_root_cid_cap is now derived from it too, so
its bounds are not the whole address space any more.
- Patch 8/9 (new functions in user_ptr.h) dropped.
- Rebased on next.
Review branch:
https://git.morello-project.org/kbrodsky-arm/linux/-/commits/cheri_ptr_api_…
Thanks,
Kevin
[1] https://git.morello-project.org/morello/kernel/linux/-/issues/40
Kevin Brodsky (15):
pps: Add missing #include
linux/user_ptr.h: Remove kaddr_to_user_ptr()
linux/user_ptr.h: Improve comment formatting
arm64: uapi: Add asm/cheri.h
linux/cheri.h: Introduce CHERI helpers
arm64: morello: Implement cheri.h
fs/binfmt_elf: Use appropriate caps for AT_CHERI_{SEAL,CID}_CAP
arm64: compat: Use appropriate root cap in compat_ptr() in PCuABI
linux/user_ptr.h: Generic PCuABI impl for uaddr_to_user_ptr*
arm64: Remove asm/user_ptr.h
arm64: morello: Initialise user capabilities from cheri_user_root_*
arm64: morello: Initialise user DDC from cheri_user_root_*
arm64: morello: Build arbitrary user caps using appropriate root
arm64: morello: Remove morello_root_cap
arm64: morello: Update root capability in documentation
Documentation/arm64/morello.rst | 23 +++--
Documentation/core-api/user_ptr.rst | 8 --
arch/Kconfig | 2 +-
arch/arm64/Kconfig | 2 +-
arch/arm64/include/asm/cheri.h | 11 +++
arch/arm64/include/asm/compat.h | 9 +-
arch/arm64/include/asm/morello.h | 12 ++-
arch/arm64/include/asm/user_ptr.h | 43 ---------
arch/arm64/include/uapi/asm/cheri.h | 11 +++
arch/arm64/kernel/morello.c | 143 +++++++++++++++++-----------
arch/arm64/kernel/process.c | 2 +-
arch/arm64/kernel/ptrace.c | 2 +-
arch/arm64/lib/morello.S | 17 ++--
drivers/pps/pps.c | 1 +
fs/binfmt_elf.c | 10 +-
include/linux/cheri.h | 132 +++++++++++++++++++++++++
include/linux/user_ptr.h | 69 ++++++--------
lib/Makefile | 3 +
lib/cheri.c | 72 ++++++++++++++
lib/user_ptr.c | 26 +++++
20 files changed, 413 insertions(+), 185 deletions(-)
create mode 100644 arch/arm64/include/asm/cheri.h
delete mode 100644 arch/arm64/include/asm/user_ptr.h
create mode 100644 arch/arm64/include/uapi/asm/cheri.h
create mode 100644 include/linux/cheri.h
create mode 100644 lib/cheri.c
create mode 100644 lib/user_ptr.c
--
2.38.1