Re: [PATCH] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller
From: Bradley Morgan
Date: Wed Nov 11 2026 - 02:28:55 EST
On 11 November 2026 03:48:41 GMT, Ritesh Harjani <ritesh.list@xxxxxxxxx>
wrote:
>Bradley Morgan <brads@xxxxxxxxxxxxxx> writes:
>
>> 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@xxxxxxxxxxxxxx>
>> ---
>> arch/powerpc/kernel/module_32.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>
>Do we also need fixes and stable tag here?
>
>Fixes: 7dfbfb87c243 ("powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32")
>Cc: stable@xxxxxxxxxxxxxxx
Hmm.. could the merger add that? If anyone merges.. :(
>
>
>-ritesh
>
--- Thanks!