mirror_ubuntu-kernels/arch/arm64/kernel
Peter Collingbourne 201698626f arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)
This change introduces a prctl that allows the user program to control
which PAC keys are enabled in a particular task. The main reason
why this is useful is to enable a userspace ABI that uses PAC to
sign and authenticate function pointers and other pointers exposed
outside of the function, while still allowing binaries conforming
to the ABI to interoperate with legacy binaries that do not sign or
authenticate pointers.

The idea is that a dynamic loader or early startup code would issue
this prctl very early after establishing that a process may load legacy
binaries, but before executing any PAC instructions.

This change adds a small amount of overhead to kernel entry and exit
due to additional required instruction sequences.

On a DragonBoard 845c (Cortex-A75) with the powersave governor, the
overhead of similar instruction sequences was measured as 4.9ns when
simulating the common case where IA is left enabled, or 43.7ns when
simulating the uncommon case where IA is disabled. These numbers can
be seen as the worst case scenario, since in more realistic scenarios
a better performing governor would be used and a newer chip would be
used that would support PAC unlike Cortex-A75 and would be expected
to be faster than Cortex-A75.

On an Apple M1 under a hypervisor, the overhead of the entry/exit
instruction sequences introduced by this patch was measured as 0.3ns
in the case where IA is left enabled, and 33.0ns in the case where
IA is disabled.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Link: https://linux-review.googlesource.com/id/Ibc41a5e6a76b275efbaa126b31119dc197b927a5
Link: https://lore.kernel.org/r/d6609065f8f40397a4124654eb68c9f490b4d477.1616123271.git.pcc@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2021-04-13 17:31:44 +01:00
..
probes arm64 fixes for -rc1 2021-02-26 10:19:03 -08:00
vdso clang-lto series for v5.12-rc1 2021-02-23 09:28:51 -08:00
vdso32 arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
acpi_numa.c arm64, numa: Change the numa init functions name to be generic 2021-01-14 15:08:54 -08:00
acpi_parking_protocol.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
acpi.c arm64: permit ACPI core to map kernel memory used for table overrides 2020-09-30 22:27:51 +01:00
alternative.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
armv8_deprecated.c arm64: uaccess: rename privileged uaccess routines 2020-12-02 19:49:10 +00:00
asm-offsets.c arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
cacheinfo.c arm64 updates for 5.3: 2019-07-08 09:54:55 -07:00
cpu_errata.c arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround 2021-02-08 17:39:02 +00:00
cpu_ops.c arm64: Introduce get_cpu_ops() helper function 2020-03-24 17:24:19 +00:00
cpu-reset.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpu-reset.S arm64/relocate_kernel: remove redundant code 2020-09-11 19:06:25 +01:00
cpufeature.c arm64 updates for 5.12 2021-02-21 13:08:42 -08:00
cpuidle.c arm64: Introduce get_cpu_ops() helper function 2020-03-24 17:24:19 +00:00
cpuinfo.c arm64: avoid -Woverride-init warning 2020-10-28 13:38:36 +00:00
crash_core.c arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo 2020-07-02 17:56:49 +01:00
crash_dump.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
debug-monitors.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
efi-entry.S arm64 updates for 5.8 2020-06-01 15:18:27 -07:00
efi-header.S arm64: head: tidy up the Image header definition 2020-11-17 16:14:20 +00:00
efi-rt-wrapper.S Merge branch 'for-next/scs' into for-next/core 2020-05-28 18:03:40 +01:00
efi.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
entry-common.c arm64: mte: Enable async tag check fault 2021-04-11 10:56:40 +01:00
entry-fpsimd.S arm64/sve: Implement a helper to load SVE registers from FPSIMD state 2020-09-21 18:06:33 +01:00
entry-ftrace.S arm64: rename S_FRAME_SIZE to PT_REGS_SIZE 2021-01-13 15:09:06 +00:00
entry.S arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
fpsimd.c arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
ftrace.c arm64: ftrace: Change CONFIG_FTRACE_WITH_REGS to CONFIG_DYNAMIC_FTRACE_WITH_REGS 2020-06-08 15:44:59 +01:00
head.S arm64: mm: use a 48-bit ID map when possible on 52-bit VA builds 2021-03-11 13:04:28 +00:00
hibernate-asm.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
hibernate.c arm64: hibernate: add __force attribute to gfp_t casting 2021-02-01 15:57:30 +00:00
hw_breakpoint.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hyp-stub.S arm64: Add missing ISB after invalidating TLB in enter_vhe 2021-02-24 11:35:36 +00:00
idreg-override.c arm64: Drop support for CMDLINE_EXTEND 2021-03-08 12:56:34 +00:00
image-vars.h KVM: arm64: Don't access PMSELR_EL0/PMUSERENR_EL0 when no PMU is available 2021-03-06 04:18:40 -05:00
image.h arm64: get rid of TEXT_OFFSET 2020-09-07 15:00:52 +01:00
insn.c arm64: kprobe: disable probe of fault prone ptrauth instruction 2020-09-14 12:07:02 +01:00
io.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
irq.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
jump_label.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
kaslr.c arm64: Move "nokaslr" over to the early cpufeature infrastructure 2021-02-09 13:50:57 +00:00
kexec_image.c arm64: kexec_file: Fix sparse warning 2020-11-10 13:11:44 +00:00
kgdb.c arm64: kgdb: Fix single-step exception handling oops 2020-07-08 22:18:54 +01:00
kuser32.S docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
machine_kexec_file.c arm64: kexec_file: fix memory leakage in create_dtb() when fdt_open_into() fails 2021-02-19 17:57:40 +00:00
machine_kexec.c arm64: kexec: call kexec_image_info only once 2021-01-27 15:41:12 +00:00
Makefile Merge branch 'for-next/vdso' into for-next/core 2021-02-12 15:17:42 +00:00
module-plts.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
module.c kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
mte.c arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
paravirt.c arm64: paravirt: Initialize steal time when cpu is online 2020-09-17 18:12:18 +01:00
pci.c PCI: Constify struct pci_ecam_ops 2020-05-01 16:28:59 +01:00
perf_callchain.c arm64: stacktrace: Make stack walk callback consistent with generic code 2020-09-18 14:24:16 +01:00
perf_event.c arm64: perf: Fix 64-bit event counter read truncation 2021-03-10 11:08:23 +00:00
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
pointer_auth.c arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
process.c arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
proton-pack.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
psci.c arm64: psci: Avoid printing in cpu_psci_cpu_die() 2020-11-10 13:11:44 +00:00
ptrace.c arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) 2021-04-13 17:31:44 +01:00
reloc_test_core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
reloc_test_syms.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
relocate_kernel.S arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp 2021-01-27 15:41:12 +00:00
return_address.c arm64: stacktrace: Make stack walk callback consistent with generic code 2020-09-18 14:24:16 +01:00
sdei.c Merge branch 'kvm-master' into kvm-next 2021-01-07 18:06:52 -05:00
setup.c arm64: Extract early FDT mapping from kaslr_early_init() 2021-02-09 13:47:50 +00:00
signal32.c arm64: compat: Always use sigpage for sigreturn trampoline 2020-06-23 14:56:24 +01:00
signal.c arm64: entry: remove redundant IRQ flag tracing 2021-01-13 12:51:30 +00:00
sigreturn32.S arm64: compat: Split kuser32 2019-04-23 18:01:57 +01:00
sleep.S arm64: Initialise as nVHE before switching to VHE 2021-02-09 13:47:07 +00:00
smccc-call.S arm64/kernel: Remove needless Call Frame Information annotations 2020-09-01 09:50:36 +02:00
smp_spin_table.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
smp.c KVM: arm64: Apply hyp relocations at runtime 2021-01-23 14:01:00 +00:00
stacktrace.c arm64: stacktrace: Report when we reach the end of the stack 2021-02-25 10:34:51 +00:00
suspend.c arm64: mte: Report async tag faults before suspend 2021-04-11 10:56:40 +01:00
sys32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 452 2019-06-19 17:09:08 +02:00
sys_compat.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
sys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
syscall.c arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround 2021-02-08 17:39:02 +00:00
time.c arm64: time: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-02-12 17:26:38 +00:00
topology.c arm64: topology: Make AMUs work with modular cpufreq drivers 2021-01-20 12:49:40 +00:00
trace-events-emulation.h
traps.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
vdso32-wrap.S arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
vdso-wrap.S arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
vdso.c mm: forbid splitting special mappings 2020-12-15 12:13:41 -08:00
vmlinux.lds.S x86: 2021-02-21 13:31:43 -08:00