Skip to contentSkip to conversation

kselftest/arm64: Explicitly build no BTI tests with BTI disabled

PATCH In review Mark Brown 2 participants 2 messages May 16, 2022

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH v2 1/1 kselftest/arm64: Explicitly build no BTI tests with BTI disabled

In case a distribution enables branch protection by default do as we do for the main kernel and explicitly disable branch protection when building the test case for having BTI disabled to ensure it doesn't get turned on by the toolchain defaults.

---

v2:
- Rebase on -next

 tools/testing/selftests/arm64/bti/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/bti/Makefile +1 -1
index 73e013c082a6..25c66e622b86 100644
@@ -10,7 +10,7 @@ PROGS := $(patsubst %,gen/%,$(TEST_GEN_PROGS))
 # cases for statically linked and dynamically lined binaries are
 # slightly different.
 
-CFLAGS_NOBTI = -DBTI=0
+CFLAGS_NOBTI = -mbranch-protection=none -DBTI=0
 CFLAGS_BTI = -mbranch-protection=standard -DBTI=1
 
 CFLAGS_COMMON = -ffreestanding -Wall -Wextra $(CFLAGS)
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 6 lines · Mark Brown

In case a distribution enables branch protection by default do as we do for the main kernel and explicitly disable branch protection when building the test case for having BTI disabled to ensure it doesn't get turned on by the toolchain defaults.

Applied to arm64 (for-next/kselftest), thanks!

[1/1] kselftest/arm64: Explicitly build no BTI tests with BTI disabled

      https://git.kernel.org/arm64/c/9f93c2e0cda4
Signature · 1 line
Catalin