[PATCH 00/12] arm64/bti: Fix kernel BTI issues with livepatch, large kernels, toolchains
From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2026-08-15 04:46:10
Also in:
linux-toolchains, live-patching, lkml
These patches are a continuation of the following discussions about some bugs related to kernel BTI: https://lore.kernel.org/ed4fe1f95071897859ec7fbe9176246cbd4962bf.1786138806.git.jpoimboe@kernel.org (local) https://lore.kernel.org/20260812162058.612202-4-ardb@kernel.org (local) This started as a livepatch crash investigation but quickly ballooned into a rabbit hole of latent bugs and toolchain quirks/crashes. The most notable patch is probably the last one, which enables BTI on GCC. I also hit a SIGSEGV in the GNU linker, for which this series has a workaround. The binutils bug is here: https://sourceware.org/bugzilla/show_bug.cgi?id=34525 Several of these patches probably wouldn't be needed if we had a flag like -fno-omit-bti-pads or so for both compilers, but that currently doesn't exist, and this at least fixes things for the existing toolchains out there. There is some toolchain discussion about that here: https://github.com/llvm/llvm-project/issues/215547 Josh Poimboeuf (12): arm64/bti: Add BTI landing pad to __sdei_asm_handler() arm64/module: Fix BTI exceptions caused by omitted landing pads in Clang 21 arm64/bti: Fix BTI linker failures with long branches into .idmap.text arm64/bti: Work around ld crash caused by linker script aliases arm64/bti: Add link error for large kernels with BTI and unsupported toolchains arm64/bti: Add link error for large kernels with BTI and livepatch arm64/bti: Advertise BTI in assembly objects arm64/bti: Enable BTI in the pi/ startup code efi/libstub: Preserve the GNU property note efi/libstub: Remove obsolete .note.gnu.property workaround arm64/bti: Force-enable BTI linker veneers arm64/bti: Enable kernel BTI for GCC arch/arm64/Kconfig | 9 +- arch/arm64/Makefile | 5 + arch/arm64/include/asm/bti-note.h | 32 +++++ arch/arm64/include/asm/module.h | 5 + arch/arm64/kernel/cpu-reset.S | 2 +- arch/arm64/kernel/entry.S | 1 + arch/arm64/kernel/head.S | 8 +- arch/arm64/kernel/hyp-stub.S | 1 + arch/arm64/kernel/image-vars.h | 13 +- arch/arm64/kernel/module-plts.c | 186 ++++++++++++++++++++++++++ arch/arm64/kernel/pi/Makefile | 11 +- arch/arm64/kernel/sleep.S | 2 +- arch/arm64/kernel/vmlinux.lds.S | 12 ++ arch/arm64/lib/memcpy.S | 3 + arch/arm64/lib/memset.S | 2 + arch/arm64/mm/cache.S | 1 + arch/arm64/mm/proc.S | 8 +- drivers/firmware/efi/libstub/Makefile | 15 ++- 18 files changed, 282 insertions(+), 34 deletions(-) create mode 100644 arch/arm64/include/asm/bti-note.h -- 2.55.0