From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Martin Kaiser <martin@kaiser.cx>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] tracing: fprobe: fix the length of unused fgraph_data
Date: Wed, 25 Mar 2026 00:39:19 +0900 [thread overview]
Message-ID: <20260325003919.3ff18e19709eb0ab3456ce2c@kernel.org> (raw)
In-Reply-To: <acJFuICyULkwR8ka@akranes.kaiser.cx>
On Tue, 24 Mar 2026 09:05:12 +0100
Martin Kaiser <martin@kaiser.cx> wrote:
> Thus wrote Masami Hiramatsu (mhiramat@kernel.org):
>
> > On Mon, 23 Mar 2026 10:48:18 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > > On Mon, 23 Mar 2026 11:19:36 +0100
> > > Martin Kaiser <martin@kaiser.cx> wrote:
>
> > > > If fprobe_entry does not fill the allocated fgraph_data completely, the
> > > > unused part is zeroed with memset.
>
> > > > Fix the length for this memset call. Both reserved_words and used are in
> > > > units of return stack words, but memset needs the number of bytes.
>
> > > > Cc: stable@vger.kernel.org
> > > > Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
> > > > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> > > > ---
> > > > kernel/trace/fprobe.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> > > > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> > > > index dcadf1d23b8a..6a1192515afd 100644
> > > > --- a/kernel/trace/fprobe.c
> > > > +++ b/kernel/trace/fprobe.c
> > > > @@ -451,7 +451,7 @@ static int fprobe_fgraph_entry(struct ftrace_graph_ent *trace, struct fgraph_ops
> > > > }
> > > > }
> > > > if (used < reserved_words)
> > > > - memset(fgraph_data + used, 0, reserved_words - used);
> > > > + memset(fgraph_data + used, 0, (reserved_words - used) * sizeof(long));
>
> > > So fgraph_data is only used internally between the fprobe_fgraph_entry()
> > > and fprobe_return() as it only exists on the fgraph shadow stack. I'm not
> > > even sure if the unused portion needs to be zeroed out.
>
> > > Thus, this may be correct, but it doesn't look like a true bug that needs a
> > > stable tag.
>
> > Hmm, indeed. Maybe we'd better just remove this memset from for-next.
>
> Ok, I see your point. I'll send a v2 that removes the memset.
Yeah, thanks!
>
> Best regards,
> Martin
>
> > Thanks,
>
>
> > > -- Steve
>
>
>
> > > > /* If any exit_handler is set, data must be used. */
> > > > return used != 0;
>
>
>
> > --
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2026-03-24 15:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 10:19 [PATCH] tracing: fprobe: fix the length of unused fgraph_data Martin Kaiser
2026-03-23 12:06 ` Masami Hiramatsu
2026-03-23 14:48 ` Steven Rostedt
2026-03-24 0:34 ` Masami Hiramatsu
2026-03-24 8:05 ` Martin Kaiser
2026-03-24 15:39 ` Masami Hiramatsu [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=20260325003919.3ff18e19709eb0ab3456ce2c@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin@kaiser.cx \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
--cc=stable@vger.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