arm64: Add initial support for E0PD
authorMark Brown <broonie@kernel.org>
Mon, 9 Dec 2019 18:12:14 +0000 (18:12 +0000)
committerWill Deacon <will@kernel.org>
Wed, 15 Jan 2020 14:11:02 +0000 (14:11 +0000)
commit3e6c69a058deaa50d33c3dac36cde80b4ce590e8
tree48e575bceafa45f0555586629c735419c6e50ba6
parent46cf053efec6a3a5f343fead837777efe8252a46
arm64: Add initial support for E0PD

Kernel Page Table Isolation (KPTI) is used to mitigate some speculation
based security issues by ensuring that the kernel is not mapped when
userspace is running but this approach is expensive and is incompatible
with SPE.  E0PD, introduced in the ARMv8.5 extensions, provides an
alternative to this which ensures that accesses from userspace to the
kernel's half of the memory map to always fault with constant time,
preventing timing attacks without requiring constant unmapping and
remapping or preventing legitimate accesses.

Currently this feature will only be enabled if all CPUs in the system
support E0PD, if some CPUs do not support the feature at boot time then
the feature will not be enabled and in the unlikely event that a late
CPU is the first CPU to lack the feature then we will reject that CPU.

This initial patch does not yet integrate with KPTI, this will be dealt
with in followup patches.  Ideally we could ensure that by default we
don't use KPTI on CPUs where E0PD is present.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[will: Fixed typo in Kconfig text]
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/Kconfig
arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/pgtable-hwdef.h
arch/arm64/include/asm/sysreg.h
arch/arm64/kernel/cpufeature.c