From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Petr Pavlu" <petr.pavlu@suse.com>,
"Ard Biesheuvel" <ardb+git@google.com>
Cc: "Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Daniel Gomez" <da.gomez@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Aaron Tomlin" <atomlin@atomlin.com>,
"Adrian Barnaś" <abarnas@google.com>,
"Ryan Roberts" <ryan.roberts@arm.com>,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
"Madhavan Srinivasan" <maddy@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 0/9] arm64: Allocate .text and .init.text together
Date: Fri, 28 Aug 2026 15:45:39 +0200 [thread overview]
Message-ID: <cee89666-9de0-4012-b665-69da3846c5ef@app.fastmail.com> (raw)
In-Reply-To: <524b5817-c097-47cb-b301-4a9c0f1d2947@suse.com>
On Fri, 28 Aug 2026, at 15:07, Petr Pavlu wrote:
> On 8/22/26 3:53 PM, Ard Biesheuvel wrote:
>> From: Ard Biesheuvel <ardb@kernel.org>
>>
>> The arm64 module loader has to deal with a couple of corner cases that
>> may occur when .init.text is placed out of direct branch range of .text:
>>
>> - ordinary direct branches from .init.text into .text may require the
>> use of a PLT entry (i.e., a trampoline aka veneer), which means not
>> only that additional PLT entries need to be allocated for
>> cross-section calls, but also that .init.text needs its own PLT
>> reservation, as the one in .text will be out of range as well;
>>
>> - dynamic patching of the ftrace handler into .init.text code needs its
>> own dedicated trampoline as the one in .text may be too far away.
>>
>> - recent compilers may omit BTI veneers for static functions that never
>> have their address taken, and so additional veneers will need to be
>> added to .text in case cross-section direct branches from .init.text
>> require a PLT entry (and therefore a landing pad at the target end).
>>
>> This is unfortunate, because it is actually somewhat unusual for .text
>> and .init.text to be so far away from each other: only when allocating
>> either of them (but not both) exhausts the 'near' (PLT-less) module
>> region, the other will be allocated from the spillover region, which is
>> not in direct branching range, and therefore requires PLT entries for
>> cross-section calls.
>>
>> This series addresses this wart by allocating both of them as a single
>> chunk, and freeing the .init.text part along with the other init
>> sections at the appropriate time. This ensures that the two regions will
>> never require veneers for cross-section calls, allowing the arm64 module
>> loader to be simplified.
>
> It looks like this should also be useful for ppc64, which currently
> merges .init.text and .text because keeping them separate would require
> stubs between the two, and consequently .init.text is never released in
> modules on this architecture.
>
Thanks for the data point - are those stubs needed when there is some
distance between the placements of .text and .init.text?
prev parent reply other threads:[~2026-08-28 13:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 13:53 [RFC PATCH 0/9] arm64: Allocate .text and .init.text together Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 1/9] mm: execmem: Add API to split an existing execmem cache allocation Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 2/9] mm: execmem: Allow huge vmappings to be avoided for execmem caches Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 3/9] module: Place MOD_TEXT before MOD_INIT_TEXT in enumeration Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 4/9] module: Allocate MOD_INIT_TEXT from the MOD_TEXT ROX allocation Ard Biesheuvel
2026-08-28 14:11 ` Bradley Morgan
2026-08-22 13:53 ` [RFC PATCH 5/9] arm64: mm: Permit permissions changes on huge vmappings Ard Biesheuvel
2026-08-23 16:52 ` Adrian Barnaś
2026-08-22 13:53 ` [RFC PATCH 6/9] arm64: Enable the execmem ROX cache for module text Ard Biesheuvel
2026-08-23 16:46 ` Adrian Barnaś
2026-08-22 13:53 ` [RFC PATCH 7/9] arm64: ftrace: Revert "fix unreachable PLT for ftrace_caller ..." Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 8/9] arm64: module: Combine init and core PLT entries again Ard Biesheuvel
2026-08-22 13:53 ` [RFC PATCH 9/9] arm64: ftrace: Simplify PLT handling Ard Biesheuvel
2026-08-28 13:07 ` [RFC PATCH 0/9] arm64: Allocate .text and .init.text together Petr Pavlu
2026-08-28 13:45 ` Ard Biesheuvel [this message]
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=cee89666-9de0-4012-b665-69da3846c5ef@app.fastmail.com \
--to=ardb@kernel.org \
--cc=abarnas@google.com \
--cc=akpm@linux-foundation.org \
--cc=ardb+git@google.com \
--cc=atomlin@atomlin.com \
--cc=catalin.marinas@arm.com \
--cc=da.gomez@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=samitolvanen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox