mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Karl Mehltretter <kmehltretter@gmail.com>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Sven Schnelle <svens@stackframe.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-parisc@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] parisc: Fix register corruption in 32-bit dynamic ftrace
Date: Wed, 18 Nov 2026 23:04:02 +0100	[thread overview]
Message-ID: <8778a124-fac9-43e1-9519-e4de75b4ff0b@gmx.de> (raw)
In-Reply-To: <e184f942e0933a1618f161abe672ad8a90bab529.1794672077.git.kmehltretter@gmail.com>

On 11/14/26 19:02, Karl Mehltretter wrote:
> The 32-bit dynamic ftrace trampoline allocates a 64-byte frame.
> 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@vger.kernel.org
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> 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(-)
applied.

Thanks!
Helge

      reply	other threads:[~2026-11-18 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 18:02 Karl Mehltretter
2026-11-18 22:04 ` Helge Deller [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=8778a124-fac9-43e1-9519-e4de75b4ff0b@gmx.de \
    --to=deller@gmx.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=svens@stackframe.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

all inboxes | Powered by JetHome®