Skip to content

arm64/bti: Fix kernel BTI issues with livepatch, large kernels, toolchains

Josh Poimboeuf linux-arm-kernel linux-toolchains live-patching lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12arm64/bti: Add BTI landing pad to __sdei_asm_handler()arch/arm64/kernel/entry.S+1 -00 replies
2/12arm64/module: Fix BTI exceptions caused by omitted landing pads in Clang 21arch/arm64/include/asm/module.h arch/arm64/kernel/module-plts.c+191 -07 replies
3/12arm64/bti: Fix BTI linker failures with long branches into .idmap.textarch/arm64/kernel/cpu-reset.S arch/arm64/kernel/head.S arch/arm64/kernel/hyp-stub.S +2 more+11 -91 reply
4/12arm64/bti: Work around ld crash caused by linker script aliasesarch/arm64/kernel/head.S arch/arm64/kernel/image-vars.h arch/arm64/lib/memcpy.S +2 more+8 -120 replies
5/12arm64/bti: Add link error for large kernels with BTI and unsupported toolchainsarch/arm64/Kconfig arch/arm64/kernel/vmlinux.lds.S+12 -00 replies
6/12arm64/bti: Add link error for large kernels with BTI and livepatcharch/arm64/kernel/vmlinux.lds.S+7 -00 replies
7/12arm64/bti: Advertise BTI in assembly objectsarch/arm64/Makefile arch/arm64/include/asm/bti-note.h+36 -01 reply
8/12arm64/bti: Enable BTI in the pi/ startup codearch/arm64/kernel/pi/Makefile+7 -40 replies
9/12efi/libstub: Preserve the GNU property notedrivers/firmware/efi/libstub/Makefile+8 -10 replies
10/12efi/libstub: Remove obsolete .note.gnu.property workarounddrivers/firmware/efi/libstub/Makefile+0 -62 replies
11/12arm64/bti: Force-enable BTI linker veneersarch/arm64/Makefile+1 -00 replies
12/12arm64/bti: Enable kernel BTI for GCCarch/arm64/Kconfig+0 -20 replies

Reviews trailers per patch

1 of 12 patches has a Reviewed-by or Acked-by.

PatchNick Desaulniers
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12R-b
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/12] arm64/bti: Fix kernel BTI issues with livepatch, large kernels, toolchains

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
https://lore.kernel.org/[email protected]

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
Signature · 1 line
2.55.0