From: Bradley Morgan <bradley.morgan@linux.dev>
To: chleroy@kernel.org
Cc: brads@mainlining.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
mpe@ellerman.id.au, npiggin@gmail.com, ritesh.list@gmail.com,
sshegde@linux.ibm.com
Subject: Re: [PATCH] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller
Date: Tue, 10 Nov 2026 21:22:32 +0000 [thread overview]
Message-ID: <70954FB8-713D-4ACA-B176-03E335F00C33@linux.dev> (raw)
In-Reply-To: <e89ab6eb-2fd3-4638-a3a9-fef406478435@kernel.org>
On 10 November 2026 08:57:28 GMT, "Christophe Leroy (CS GROUP)"
<chleroy@kernel.org> wrote:
>
>
>Le 23/09/2026 à 19:56, Bradley Morgan a écrit :
>> Commit 7dfbfb87c243 ("powerpc/ftrace: Activate
>> HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32") made count_relocs()
>> undercount the PLT entries the loader
>> consumes: module_finalize_ftrace() now creates two trampolines
>> (mod->arch.tramp for ftrace_caller() and mod->arch.tramp_regs for
>> ftrace_regs_caller()), while count_relocs() reserves only one entry
>> for ftrace.
>>
>> So the core .plt ends up one ppc_plt_entry (16 bytes) short. The
>> walk in do_plt_call() scans for a free slot with
>> "while (entry->jump[0])" and has no bound check, so once the last
>> reserved slot is used up, the walk steps past the end of the section
>> and patch_instruction() writes the 4-instruction trampoline into
>> whatever module memory follows the .plt.
>>
>> Count the second entry, mirroring what module_64.c does for the same
>> pair of stubs.
>>
>> Signed-off-by: Bradley Morgan <brads@mainlining.org>
>
>I would have had a preference for something similar to commit c12cfe9dee07
>("powerpc/module_64: Convert #ifdef to IS_ENABLED()")
>
>Nevertheless,
>
>Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Thx, now the good question will be, who merges?
>
>
>
>> ---
>> arch/powerpc/kernel/module_32.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/powerpc/kernel/module_32.c
>b/arch/powerpc/kernel/module_32.c
>> index f930e3395a7f..61152deffc55 100644
>> --- a/arch/powerpc/kernel/module_32.c
>> +++ b/arch/powerpc/kernel/module_32.c
>> @@ -41,6 +41,9 @@ static unsigned int count_relocs(const Elf32_Rela
>*rela, unsigned int num)
>> #ifdef CONFIG_DYNAMIC_FTRACE
>> _count_relocs++; /* add one for ftrace_caller */
>> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>> + _count_relocs++; /* add one for ftrace_regs_caller */
>> +#endif
>> #endif
>> return _count_relocs;
>> }
>
--- Thanks!
next prev parent reply other threads:[~2026-11-10 22:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 17:56 [PATCH] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Bradley Morgan
2026-11-10 8:57 ` Christophe Leroy (CS GROUP)
2026-11-10 21:22 ` Bradley Morgan [this message]
2026-11-11 3:48 ` Ritesh Harjani
2026-11-11 7:28 ` Bradley Morgan
2026-11-11 11:58 ` Madhavan Srinivasan
2026-11-11 15:40 ` Bradley Morgan
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=70954FB8-713D-4ACA-B176-03E335F00C33@linux.dev \
--to=bradley.morgan@linux.dev \
--cc=brads@mainlining.org \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=sshegde@linux.ibm.com \
/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.