Skip to contentSkip to conversation

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

PATCH Superseded Mark Brown 2 participants 3 messages May 11, 2022 – May 16, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 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.

---
 tools/testing/selftests/arm64/bti/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/bti/Makefile +1 -1
index 10a12c5e05e6..a3e59d7910b3 100644
@@ -14,7 +14,7 @@ CFLAGS += -I../../../../../usr/include/
 
 CFLAGS_STATIC = -ffreestanding
 
-CFLAGS_NOBTI = -DBTI=0
+CFLAGS_NOBTI = -mbranch-protection=none -DBTI=0
 CFLAGS_BTI = -mbranch-protection=standard -DBTI=1
 
 CFLAGS_COMMON = -Wall -Wextra $(CFLAGS)
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 15 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.

---
 tools/testing/selftests/arm64/bti/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/bti/Makefile +0 -0
index 10a12c5e05e6..a3e59d7910b3 100644

tools/testing/selftests/arm64/bti/Makefile CFLAGS += -I../../../../../usr/include/ · line 18

Quoted 6 lines
tools/testing/selftests/arm64/bti/Makefile +1 -1
@@ -14,7 +14,7 @@ CFLAGS += -I../../../../../usr/include/
 
 CFLAGS_STATIC = -ffreestanding
 
-CFLAGS_NOBTI = -DBTI=0
+CFLAGS_NOBTI = -mbranch-protection=none -DBTI=0
 CFLAGS_BTI = -mbranch-protection=standard -DBTI=1

Do I miss an patches? I can't see the CFLAGS_STATIC in the arm64 branches, nor in next.

Signature · 1 line
Catalin
author
#2 lore raw
Quoted 8 lines · Catalin Marinas

tools/testing/selftests/arm64/bti/Makefile CFLAGS += -I../../../../../usr/include/ · line 18

Quoted 3 lines · Mark Brown
tools/testing/selftests/arm64/bti/Makefile +1 -1
-CFLAGS_NOBTI = -DBTI=0
+CFLAGS_NOBTI = -mbranch-protection=none -DBTI=0
 CFLAGS_BTI = -mbranch-protection=standard -DBTI=1

Do I miss an patches? I can't see the CFLAGS_STATIC in the arm64 branches, nor in next.

Ah, sorry - I have some WIP stuff to do a dynamic btitest binary.