The linker only emits the BTI veneers if *all* input objects have
GNU_PROPERTY_AARCH64_FEATURE_1_BTI.  All the kernel's objects now
advertise it, but if some object stops doing so, BTI veneers silently
stop getting created on >128MB kernels, resulting in BTI exceptions at
runtime.

Force BTI veneers enabled with "-z force-bti" to prevent a single bad
object from ruining things.  This also emits a warning (or error with
CONFIG_WERROR) if any objects are missing the bit.

Signed-off-by: Josh Poimboeuf <[email protected]>
---
 arch/arm64/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 4eee721c0b278..d0db9a6766a2f 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -25,6 +25,7 @@ endif
 
 ifeq ($(CONFIG_ARM64_BTI_KERNEL),y)
 KBUILD_AFLAGS  += -include $(srctree)/arch/arm64/include/asm/bti-note.h
+LDFLAGS_vmlinux        += $(call ld-option,-z force-bti)
 endif
 
 cc_has_k_constraint := $(call try-run,echo                             \
-- 
2.55.0


Reply via email to