Re: [PATCH] parisc: Fix register corruption in 32-bit dynamic ftrace
From: Helge Deller
Date: Wed Nov 18 2026 - 17:04:53 EST
On 11/14/26 19:02, Karl Mehltretter wrote:
The 32-bit dynamic ftrace trampoline allocates a 64-byte frame.applied.
ftrace_caller() saves %r26 at offset 20, which overlaps the third
argument's spill slot for ftrace_function_trampoline().
In the failing build, GCC spills org_sp_gr3 into that slot, overwriting
saved %r26 with the original stack pointer. Tracing preempt_count_add()
then passes that pointer as val and corrupts the preempt count.
Allocate two frames on 32-bit, as 64-bit already does, and update the
generated trampoline instruction to match.
Fixes: 6ca6366220ed ("parisc: add dynamic ftrace")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
Tested with GCC 16.2.0 on a 32-bit SMP kernel under QEMU 10.0.13:
function tracing of preempt_count_add(), preempt_count_sub() and
update_rq_clock(), followed by a combined function/function-graph
workload. No warnings or faults.
I used an LLM to help isolate the failure, inspect the generated code,
write the test harness and prepare the commit message.
arch/parisc/kernel/entry.S | 4 ----
arch/parisc/kernel/ftrace.c | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
Thanks!
Helge