Skip to content

Commit 97fed77

Browse files
brooniewilldeacon
authored andcommitted
arm64: bti: Provide Kconfig for kernel mode BTI
Now that all the code is in place provide a Kconfig option allowing users to enable BTI for the kernel if their toolchain supports it, defaulting it on since this has security benefits. This is a separate configuration option since we currently don't support secondary CPUs that lack BTI if the boot CPU supports it. Code generation issues mean that current GCC 9 versions are not able to produce usable BTI binaries so we disable support for building with GCC versions prior to 10, once a fix is backported to GCC 9 the dependencies will be updated. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 67d4a1c commit 97fed77

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

arch/arm64/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,25 @@ config ARM64_BTI
16101610
BTI, such binaries can still run, but you get no additional
16111611
enforcement of branch destinations.
16121612

1613+
config ARM64_BTI_KERNEL
1614+
bool "Use Branch Target Identification for kernel"
1615+
default y
1616+
depends on ARM64_BTI
1617+
depends on ARM64_PTR_AUTH
1618+
depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
1619+
depends on !CC_IS_GCC || GCC_VERSION >= 100000
1620+
depends on !(CC_IS_CLANG && GCOV_KERNEL)
1621+
depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
1622+
help
1623+
Build the kernel with Branch Target Identification annotations
1624+
and enable enforcement of this for kernel code. When this option
1625+
is enabled and the system supports BTI all kernel code including
1626+
modular code must have BTI enabled.
1627+
1628+
config CC_HAS_BRANCH_PROT_PAC_RET_BTI
1629+
# GCC 9 or later, clang 8 or later
1630+
def_bool $(cc-option,-mbranch-protection=pac-ret+leaf+bti)
1631+
16131632
config ARM64_E0PD
16141633
bool "Enable support for E0PD"
16151634
default y

0 commit comments

Comments
 (0)