[PATCH 1/2] arm64: module: Emit BTI veneers for cross-section calls

Josh Poimboeuf jpoimboe at kernel.org
Wed Aug 12 19:25:32 PDT 2026


On Wed, Aug 12, 2026 at 02:52:04PM -0700, Josh Poimboeuf wrote:
> On Wed, Aug 12, 2026 at 06:21:00PM +0200, Ard Biesheuvel wrote:
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -2114,8 +2114,6 @@ config ARM64_BTI_KERNEL
> >  	depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
> >  	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
> >  	depends on !CC_IS_GCC || GCC_VERSION >= 100100
> > -	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106671
> > -	depends on !CC_IS_GCC
> 
> This doesn't work for livepatch though, and removing the "depends on
> !CC_IS_GCC" is a livepatch regression as it broadly increases the
> likelihood of ARM64_BTI_KERNEL (default y) getting enabled.
> 
> So "livepatch broken on arm64 clang 21+" now becomes "livepatch broken on arm64".
> 
> So either ARM64_BTI_KERNEL needs to depend on !LIVEPATCH (which will
> keep BTI disabled for most distros), or we need a different approach
> which uses __vmalloc_node_range() to allocate a veneer within 128MB of
> the target.  I can try to write that up.

Hm, does the omitted BTI also break long intra-vmlinux branches for
vmlinux text size > 128MB?

The linker adds veneers for that case, but doesn't make them
BTI-friendly unless GNU_PROPERTY_AARCH64_FEATURE_1_BTI is set on *all*
.o files, which is not currently happening for .S files.

And when I force that bit with "-z force-bti" on a 700MB text
allyesconfig vmlinux with 22k linker-created veneers, it's crashes the
GNU linker :-/

Seems kernel BTI is borked all around...

-- 
Josh



More information about the linux-arm-kernel mailing list