RFC arm64: return address signing
Get series with b4
b4 am [email protected]Versions newest first
- v2 RFC Latest7 patches 33 repliesIn review
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | arm64: cpufeature: add pointer auth meta-capabilitiesarch/ arch/ arch/ | +29 | 3 replies | |
| 2/7 | arm64: install user ptrauth keys at kernel exit timearch/ arch/ arch/ +3 more | +58 | 2 replies | |
| 3/7 | arm64: cpufeature: handle conflicts based on capabilityarch/ arch/ | +23 | 4 replies | |
| 4/7 | arm64: enable ptrauth earlierarch/ arch/ arch/ +2 more | +41 | 2 replies | |
| 5/7 | arm64: initialize and switch ptrauth kernel keysarch/ arch/ arch/ +5 more | +49 | 6 replies | |
| 6/7 | arm64: unwind: strip PAC from kernel addressesarch/ arch/ | +10 | 1 reply | |
| 7/7 | arm64: compile the kernel with ptrauth return address signingarch/ arch/ arch/ | +23 | 1 reply |
Reviews trailers per patch
All 7 patches have a Reviewed-by or Acked-by.
| Patch | Amit Daniel Kachhap | Kees Cook | Suzuki K Poulose |
|---|---|---|---|
| 1/7 | R-b | R-b | |
| 2/7 | R-b | ||
| 3/7 | R-b | R-b | |
| 4/7 | R-b | ||
| 5/7 | R-b | ||
| 6/7 | R-b | R-b | |
| 7/7 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [RFC v2 0/7] arm64: return address signing
Hi,
This series improves function return address protection for the arm64 kernel, by compiling the kernel with ARMv8.3 Pointer Authentication instructions. This should help protect the kernel against attacks using return-oriented programming.
This series is based on v5.1-rc7.
These patches were previously posted as [RFC] as part of the series to enable pointer authentication for userspace [1].
High-level changes since RFC v1 [1] (detailed changes are listed in patches):
- Rebased onto v5.1-rc7
- Updated the series to handle all 5 keys, as the current kernel exposes all 5 to userspace (previously only APIAKey)
- Fixed support for compilers without ptrauth
- Added support for the new -mbranch-protection option
- Switched to only protecting non-leaf functions
- Dropped the patch that moved keys to thread_info, as that is already done in commit 750319756256 (and superseded by 84931327a807)
Questions / notes:
- The patches make use of the sign-return-address/branch-protection compiler options and function attributes. GCC supports both, but Clang/LLVM appears to only support the compiler option, not the function attribute, so with these patches (and CONFIG_ARM64_PTR_AUTH=y) an LLVM-built kernel will fail to boot on ARMv8.3 CPUs. I don't yet know why LLVM does not support it, or whether support can be added. This series may need to be rewritten to not use the attribute, and instead move the functionality to assembly, or to disable return address signing when building with LLVM.
- Each task has its own pointer authentication key for use in the kernel, initialized during fork. On systems without much entropy during early boot, the earlier keys are not random. Ideally the kernel should get early randomness from firmware. Currently, this should be possible on UEFI systems that support EFI_RNG_PROTOCOL (via LINUX_EFI_RANDOM_SEED_TABLE_GUID). A device tree based scheme is also under discussion [2]. Another option might be to generate some randomness for pointer auth during kernel build time.
This series is still an RFC as there are a number of things to still look at:
- rebase onto v5.2-rcX and the KVM guest ptrauth support
- suspend/resume/hibernate
- comparison of compiler options pac-ret vs pac-ret+leaf
- ftrace, kprobes, other tracing
- __builtin_return_address(n), kdump, other debug
- other smaller things
- more testing
Feedback welcome!
Thanks,
Kristina
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://lore.kernel.org/linux-arm-kernel/[email protected]/
Kristina Martsenko (6):
arm64: cpufeature: add pointer auth meta-capabilities
arm64: install user ptrauth keys at kernel exit time
arm64: cpufeature: handle conflicts based on capability
arm64: enable ptrauth earlier
arm64: initialize and switch ptrauth kernel keys
arm64: compile the kernel with ptrauth return address signing
Mark Rutland (1):
arm64: unwind: strip PAC from kernel addresses
arch/arm64/Kconfig | 16 ++++++- arch/arm64/Makefile | 6 +++ arch/arm64/include/asm/asm_pointer_auth.h | 59 +++++++++++++++++++++++ arch/arm64/include/asm/cpucaps.h | 4 +- arch/arm64/include/asm/cpufeature.h | 30 ++++++++++-- arch/arm64/include/asm/pointer_auth.h | 79 +++++++++++++++++++------------ arch/arm64/include/asm/processor.h | 1 + arch/arm64/kernel/asm-offsets.c | 12 +++++ arch/arm64/kernel/cpufeature.c | 53 +++++++++++++-------- arch/arm64/kernel/entry.S | 4 ++ arch/arm64/kernel/pointer_auth.c | 5 +- arch/arm64/kernel/process.c | 2 + arch/arm64/kernel/smp.c | 10 +++- arch/arm64/kernel/stacktrace.c | 3 ++ 14 files changed, 222 insertions(+), 62 deletions(-) create mode 100644 arch/arm64/include/asm/asm_pointer_auth.h
Signature · 7 lines
2.11.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel