All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v2 0/7] arm64: return address signing
@ 2019-05-29 19:03 Kristina Martsenko
  2019-05-29 19:03 ` [RFC v2 1/7] arm64: cpufeature: add pointer auth meta-capabilities Kristina Martsenko
                   ` (7 more replies)
  0 siblings, 8 replies; 41+ messages in thread
From: Kristina Martsenko @ 2019-05-29 19:03 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Rutland, Kees Cook, Ard Biesheuvel, Catalin Marinas,
	Suzuki K Poulose, Will Deacon, Ramana Radhakrishnan,
	Amit Kachhap, Dave Martin

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/20181005084754.20950-1-kristina.martsenko@arm.com/
[2] https://lore.kernel.org/linux-arm-kernel/20190527043336.112854-2-hsinyi@chromium.org/


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

-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2019-06-13 16:13 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 19:03 [RFC v2 0/7] arm64: return address signing Kristina Martsenko
2019-05-29 19:03 ` [RFC v2 1/7] arm64: cpufeature: add pointer auth meta-capabilities Kristina Martsenko
2019-05-30  1:58   ` Kees Cook
2019-05-30 10:50   ` Suzuki K Poulose
2019-06-13 16:13     ` Suzuki K Poulose
2019-05-29 19:03 ` [RFC v2 2/7] arm64: install user ptrauth keys at kernel exit time Kristina Martsenko
2019-05-30  2:04   ` Kees Cook
2019-06-06 16:26   ` Catalin Marinas
2019-05-29 19:03 ` [RFC v2 3/7] arm64: cpufeature: handle conflicts based on capability Kristina Martsenko
2019-05-30  2:49   ` Kees Cook
2019-05-30 14:16   ` Suzuki K Poulose
2019-05-31 14:00     ` Kristina Martsenko
2019-05-31 15:08       ` Suzuki K Poulose
2019-05-29 19:03 ` [RFC v2 4/7] arm64: enable ptrauth earlier Kristina Martsenko
2019-05-30  3:11   ` Kees Cook
2019-06-13 15:41   ` Suzuki K Poulose
2019-05-29 19:03 ` [RFC v2 5/7] arm64: initialize and switch ptrauth kernel keys Kristina Martsenko
2019-05-30  3:34   ` Kees Cook
2019-05-30 16:26     ` Kristina Martsenko
2019-06-04 10:03   ` Dave Martin
2019-06-06 16:44   ` Catalin Marinas
2019-06-12 16:21     ` Kristina Martsenko
2019-06-13 10:44       ` Catalin Marinas
2019-05-29 19:03 ` [RFC v2 6/7] arm64: unwind: strip PAC from kernel addresses Kristina Martsenko
2019-05-30  3:36   ` Kees Cook
2019-05-29 19:03 ` [RFC v2 7/7] arm64: compile the kernel with ptrauth return address signing Kristina Martsenko
2019-05-30  3:45   ` Kees Cook
2019-05-30  3:09 ` [RFC v2 0/7] arm64: " Kees Cook
2019-05-30  7:25   ` Will Deacon
2019-05-30  8:39     ` Ard Biesheuvel
2019-05-30  9:11       ` Ramana Radhakrishnan
2019-05-30  9:12   ` Ramana Radhakrishnan
2019-06-06 17:44     ` Kristina Martsenko
2019-06-08  4:09       ` Kees Cook
     [not found]   ` <DB7PR08MB3865C4AA36C9C465B2A687DABF180@DB7PR08MB3865.eurprd08.prod.outlook.com>
2019-05-30 15:57     ` Kees Cook
     [not found]       ` <DB7PR08MB3865A83066179CE419D171EDBF180@DB7PR08MB3865.eurprd08.prod.outlook.com>
2019-05-30 18:05         ` Kees Cook
2019-05-31  9:22           ` Will Deacon
2019-06-02 15:43             ` Kees Cook
2019-06-03 10:40               ` Will Deacon
2019-06-04 13:52                 ` Luke Cheeseman
2019-06-06 17:43                   ` Kristina Martsenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.