From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Nick Desaulniers" <ndesaulniers@google.com>,
"Ard Biesheuvel" <ardb+git@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Brown" <broonie@kernel.org>,
"Josh Poimboeuf" <jpoimboe@kernel.org>
Subject: Re: [PATCH 2/3] arm64: Re-enable kernel BTI for compatible linkers
Date: Fri, 20 Nov 2026 00:37:55 +0100 [thread overview]
Message-ID: <085f76bc-709c-4ea6-8daf-3ee78de56fac@app.fastmail.com> (raw)
In-Reply-To: <CAKwvOd=21QJOrdVa7OrL9i27f5nJLsMzim=xpFgg2oiX3BK=0Q@mail.gmail.com>
On Fri, 20 Nov 2026, at 00:22, Nick Desaulniers wrote:
> On Thu, Nov 19, 2026 at 8:58 AM Ard Biesheuvel <ardb+git@google.com> wrote:
>>
>> From: Ard Biesheuvel <ardb@kernel.org>
>>
>> The compiler is permitted to omit BTI landing pads from static functions
>> that never have their address taken, but are only called directly, even
>> if those calls originate from other code sections. This causes problems
>> for calls from .init.text into .text if those sections are placed far
>> apart, as veneers involving indirect calls will be used in that case.
>>
>> Now that .text and .init.text are combined, this can no longer happen,
>> and so we can re-enable kernel mode BTI under two conditions:
>>
>> - live patch is disabled - it also needs BTI landings pads on functions
>> with static linkage inside vmlinux that were never exported (and
>> therefore never had their address taken)
>>
>> - landings pads are emitted even in pathological cases where the size of
>> vmlinux's .text segment exceeds the range of a direct branch, and the
>> linker needs to emit landing pads at the callee end so that the
>> veneers can call them without causing a BTI fault.
>>
>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>> ---
>> arch/arm64/Kconfig | 17 +++++++++++------
>> 1 file changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 1075bc661833..f0fb2d7ff130 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -2202,18 +2202,23 @@ config ARM64_BTI
>> BTI, such binaries can still run, but you get no additional
>> enforcement of branch destinations.
>>
>> +config LD_HAS_BTI_STUBS
>> + # A linker may need to insert a veneer when a call to a function with
>> + # static linkage in the same compilation unit but in a different
>> + # section is out of range for a direct branch instruction. Such a
>> + # veneer performs an indirect call, and thus requires a landing pad
>> + # under BTI, which the static function may lack. Only recent linkers
>> + # are guaranteed to emit those landing pads correctly in all cases.
>> + def_bool (LD_IS_BFD && LD_VERSION >= 24200) || \
>> + (LD_IS_LLD && LLD_VERSION >= 200000)
>
> A bit of a rock fetching quest (sorry), but it would make it easier
> for reviewers to verify these version checks if you had git trailers
> linking to commits (or bug reports) for these linkers with the
> relevant fix. I don't think that necessitates a v2, if the
> maintainers you're expecting to pick up this series are kind enough to
> manually re-add them (unless b4 can pick up `Link:` trailers like
> that).
>
Fair point.
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=30076
Link: https://github.com/llvm/llvm-project/pull/108989
next prev parent reply other threads:[~2026-11-19 23:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:58 [PATCH 0/3] arm64: Combine module .init.text with .text Ard Biesheuvel
2026-11-19 16:58 ` [PATCH 1/3] arm64: module: Keep executable init sections in the core text region Ard Biesheuvel
2026-11-19 16:58 ` [PATCH 2/3] arm64: Re-enable kernel BTI for compatible linkers Ard Biesheuvel
2026-11-19 23:22 ` Nick Desaulniers
2026-11-19 23:37 ` Ard Biesheuvel [this message]
2026-11-19 16:58 ` [PATCH 3/3] arm64: module: Revert separate init PLT and init ftrace trampoline Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=085f76bc-709c-4ea6-8daf-3ee78de56fac@app.fastmail.com \
--to=ardb@kernel.org \
--cc=ardb+git@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jpoimboe@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=ndesaulniers@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.