2021-04-28 20:12:31 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
#
|
|
|
|
# Internal CPU capabilities constants, keep this list sorted
|
|
|
|
|
2022-09-13 00:22:08 +08:00
|
|
|
ALWAYS_BOOT
|
|
|
|
ALWAYS_SYSTEM
|
2021-04-28 20:12:31 +08:00
|
|
|
BTI
|
2021-06-09 02:02:55 +08:00
|
|
|
# Unreliable: use system_supports_32bit_el0() instead.
|
|
|
|
HAS_32BIT_EL0_DO_NOT_USE
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_32BIT_EL1
|
|
|
|
HAS_ADDRESS_AUTH
|
2022-02-24 20:49:52 +08:00
|
|
|
HAS_ADDRESS_AUTH_ARCH_QARMA3
|
2022-02-24 20:49:51 +08:00
|
|
|
HAS_ADDRESS_AUTH_ARCH_QARMA5
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_ADDRESS_AUTH_IMP_DEF
|
|
|
|
HAS_AMU_EXTN
|
|
|
|
HAS_ARMv8_4_TTL
|
|
|
|
HAS_CACHE_DIC
|
|
|
|
HAS_CACHE_IDC
|
|
|
|
HAS_CNP
|
|
|
|
HAS_CRC32
|
|
|
|
HAS_DCPODP
|
|
|
|
HAS_DCPOP
|
arm64: Enable data independent timing (DIT) in the kernel
The ARM architecture revision v8.4 introduces a data independent timing
control (DIT) which can be set at any exception level, and instructs the
CPU to avoid optimizations that may result in a correlation between the
execution time of certain instructions and the value of the data they
operate on.
The DIT bit is part of PSTATE, and is therefore context switched as
usual, given that it becomes part of the saved program state (SPSR) when
taking an exception. We have also defined a hwcap for DIT, and so user
space can discover already whether or nor DIT is available. This means
that, as far as user space is concerned, DIT is wired up and fully
functional.
In the kernel, however, we never bothered with DIT: we disable at it
boot (i.e., INIT_PSTATE_EL1 has DIT cleared) and ignore the fact that we
might run with DIT enabled if user space happened to set it.
Currently, we have no idea whether or not running privileged code with
DIT disabled on a CPU that implements support for it may result in a
side channel that exposes privileged data to unprivileged user space
processes, so let's be cautious and just enable DIT while running in the
kernel if supported by all CPUs.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Adam Langley <agl@google.com>
Link: https://lore.kernel.org/all/YwgCrqutxmX0W72r@gmail.com/
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20221107172400.1851434-1-ardb@kernel.org
[will: Removed cpu_has_dit() as per Mark's suggestion on the list]
Signed-off-by: Will Deacon <will@kernel.org>
2022-11-08 01:24:00 +08:00
|
|
|
HAS_DIT
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_E0PD
|
2021-10-17 20:42:22 +08:00
|
|
|
HAS_ECV
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_EPAN
|
|
|
|
HAS_GENERIC_AUTH
|
2022-02-24 20:49:52 +08:00
|
|
|
HAS_GENERIC_AUTH_ARCH_QARMA3
|
2022-02-24 20:49:51 +08:00
|
|
|
HAS_GENERIC_AUTH_ARCH_QARMA5
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_GENERIC_AUTH_IMP_DEF
|
|
|
|
HAS_IRQ_PRIO_MASKING
|
|
|
|
HAS_LDAPR
|
|
|
|
HAS_LSE_ATOMICS
|
|
|
|
HAS_NO_FPSIMD
|
|
|
|
HAS_NO_HW_PREFETCH
|
|
|
|
HAS_PAN
|
|
|
|
HAS_RAS_EXTN
|
|
|
|
HAS_RNG
|
|
|
|
HAS_SB
|
|
|
|
HAS_STAGE2_FWB
|
|
|
|
HAS_SYSREG_GIC_CPUIF
|
2022-06-22 19:54:24 +08:00
|
|
|
HAS_TIDCP1
|
2021-04-28 20:12:31 +08:00
|
|
|
HAS_TLB_RANGE
|
|
|
|
HAS_VIRT_HOST_EXTN
|
2022-04-20 20:21:12 +08:00
|
|
|
HAS_WFXT
|
2021-04-28 20:12:31 +08:00
|
|
|
HW_DBM
|
|
|
|
KVM_PROTECTED_MODE
|
|
|
|
MISMATCHED_CACHE_TYPE
|
|
|
|
MTE
|
2021-10-06 23:47:49 +08:00
|
|
|
MTE_ASYMM
|
2022-04-19 19:22:16 +08:00
|
|
|
SME
|
|
|
|
SME_FA64
|
2021-04-28 20:12:31 +08:00
|
|
|
SPECTRE_V2
|
|
|
|
SPECTRE_V3A
|
|
|
|
SPECTRE_V4
|
arm64: Mitigate spectre style branch history side channels
Speculation attacks against some high-performance processors can
make use of branch history to influence future speculation.
When taking an exception from user-space, a sequence of branches
or a firmware call overwrites or invalidates the branch history.
The sequence of branches is added to the vectors, and should appear
before the first indirect branch. For systems using KPTI the sequence
is added to the kpti trampoline where it has a free register as the exit
from the trampoline is via a 'ret'. For systems not using KPTI, the same
register tricks are used to free up a register in the vectors.
For the firmware call, arch-workaround-3 clobbers 4 registers, so
there is no choice but to save them to the EL1 stack. This only happens
for entry from EL0, so if we take an exception due to the stack access,
it will not become re-entrant.
For KVM, the existing branch-predictor-hardening vectors are used.
When a spectre version of these vectors is in use, the firmware call
is sufficient to mitigate against Spectre-BHB. For the non-spectre
versions, the sequence of branches is added to the indirect vector.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
2021-11-10 22:48:00 +08:00
|
|
|
SPECTRE_BHB
|
2021-04-28 20:12:31 +08:00
|
|
|
SSBS
|
|
|
|
SVE
|
|
|
|
UNMAP_KERNEL_AT_EL0
|
|
|
|
WORKAROUND_834220
|
|
|
|
WORKAROUND_843419
|
|
|
|
WORKAROUND_845719
|
|
|
|
WORKAROUND_858921
|
|
|
|
WORKAROUND_1418040
|
|
|
|
WORKAROUND_1463225
|
|
|
|
WORKAROUND_1508412
|
|
|
|
WORKAROUND_1542419
|
2022-07-15 00:15:23 +08:00
|
|
|
WORKAROUND_1742098
|
2022-01-25 22:20:34 +08:00
|
|
|
WORKAROUND_1902691
|
2022-01-27 20:20:52 +08:00
|
|
|
WORKAROUND_2038923
|
|
|
|
WORKAROUND_2064142
|
|
|
|
WORKAROUND_2077057
|
2022-08-19 18:30:50 +08:00
|
|
|
WORKAROUND_2457168
|
2022-09-10 00:59:38 +08:00
|
|
|
WORKAROUND_2658417
|
2021-10-20 00:31:40 +08:00
|
|
|
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
|
2021-10-20 00:31:41 +08:00
|
|
|
WORKAROUND_TSB_FLUSH_FAILURE
|
2021-10-20 00:31:42 +08:00
|
|
|
WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
|
2021-04-28 20:12:31 +08:00
|
|
|
WORKAROUND_CAVIUM_23154
|
|
|
|
WORKAROUND_CAVIUM_27456
|
|
|
|
WORKAROUND_CAVIUM_30115
|
|
|
|
WORKAROUND_CAVIUM_TX2_219_PRFM
|
|
|
|
WORKAROUND_CAVIUM_TX2_219_TVM
|
|
|
|
WORKAROUND_CLEAN_CACHE
|
|
|
|
WORKAROUND_DEVICE_LOAD_ACQUIRE
|
|
|
|
WORKAROUND_NVIDIA_CARMEL_CNP
|
|
|
|
WORKAROUND_QCOM_FALKOR_E1003
|
|
|
|
WORKAROUND_REPEAT_TLBI
|
|
|
|
WORKAROUND_SPECULATIVE_AT
|