[PATCH 11/12] arm64/bti: Force-enable BTI linker veneers

Josh Poimboeuf <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.ports.arm.kernel
Message-ID <edae8b52c1cba6eecd0bc75f709f6009816b80b8.1786768375.git.jpoimboe@kernel.org>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.