[FIXUP 2/2] squash! arm64: Basic Branch Target Identification support
From: Dave Martin
Date: Fri Oct 11 2019 - 11:07:25 EST
[Add Kconfig dependency on CONFIG_ARM64_PTR_AUTH]
Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
---
This one could use some discussion.
Two conforming hardware implementations containing BTI could nonetheless
have incompatible Pointer auth implementations, meaning that we expose
BTI to userspace but not Pointer auth.
That's stupid hardware design, but the architecture doesn't forbid it
today. We _could_ detect this and hide BTI from userspace too, but
if a big.LITTLE system contains Pointer auth implementations with
mismatched IMP DEF algorithms, we lose -- we have no direct way to
detect that.
Since BTI still provides some limited value without Pointer auth,
disabling it unnecessarily might be regarded as too heavy-handed.
Changes since v2:
* Depend on CONFIG_ARM64_PTR_AUTH=y.
During test hacking, I observed that there are situations where
userspace should be entitled to assume that Pointer auth is present
if BTI is present.
Although the kernel BTI support doesn't require any aspect of
Pointer authentication, there are architectural dependencies:
* ARMv8.5 requires BTI to be implemented. [1]
* BTI requires ARMv8.4-A to be implemented. [1], [2]
* ARMv8.4 requires ARMv8.3 to be implemented. [3]
* ARMv8.3 requires Pointer authentication to be implemented. [4]
i.e., an implementation that supports BTI but not Pointer auth is
broken.
BTI is also designed to be complementary to Pointer authentication:
without Pointer auth, BTI would offer no protection for function
returns, seriously undermining the value of the feature.
See ARM ARM for ARMv8-A (ARM DDI 0487E.a) Sections:
[1] A2.8.1, "Architectural features added by ARMv8.5"
[2] A2.2.1, "Permitted implementation of subsets of ARMv8.x and
ARMv8.(x+1) architectural features"
[3] A2.6.1, "Architectural features added by Armv8.3"
[4] A2.6, "The Armv8.3 architecture extension"
---
arch/arm64/Kconfig | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6e26b72..a64d91d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1418,16 +1418,21 @@ menu "ARMv8.5 architectural features"
config ARM64_BTI
bool "Branch Target Identification support"
default y
+ depends on ARM64_PTR_AUTH
help
Branch Target Identification (part of the ARMv8.5 Extensions)
provides a mechanism to limit the set of locations to which computed
branch instructions such as BR or BLR can jump.
- This is intended to provide complementary protection to other control
+ To make use of BTI on CPUs that support it, say Y.
+
+ BTI is intended to provide complementary protection to other control
flow integrity protection mechanisms, such as the Pointer
authentication mechanism provided as part of the ARMv8.3 Extensions.
+ For this reason, it does not make sense to enable this option without
+ also enabling support for Pointer authentication.
- To make use of BTI on CPUs that support it, say Y.
+ Thus, to enable this option you also need to select ARM64_PTR_AUTH=y.
Userspace binaries must also be specifically compiled to make use of
this mechanism. If you say N here or the hardware does not support
--
2.1.4