Re: [PATCH v2] tracing: fprobe: do not zero out unused fgraph_data
From: Google
Date: Tue Mar 24 2026 - 11:47:12 EST
On Tue, 24 Mar 2026 08:39:03 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Tue, 24 Mar 2026 09:47:08 +0100
> Martin Kaiser <martin@xxxxxxxxx> wrote:
>
> Hi Martin,
>
> First, please do not send a v2 as a reply to v1. A new version should
> always start a new mail thread.
>
> > If fprobe_entry does not fill the allocated fgraph_data completely, the
> > unused part does not have to be zeroed.
> >
> > fgraph_data is a short-lived part of the shadow stack. The preceding
> > length field allows locating the end regardless of the content.
> >
> > Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
> > ---
> > v2:
>
> But to maintain a link to the previous version, I recommend adding here:
>
> Changes since v1: https://lore.kernel.org/all/20260324084804.375764-1-martin@xxxxxxxxx
Ah, this is a good idea for the patch which does not have cover mail.
Thanks :)
>
>
> > - remove the memset instead of fixing the length
> >
> > kernel/trace/fprobe.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> > index dcadf1d23b8a..56d145017902 100644
> > --- a/kernel/trace/fprobe.c
> > +++ b/kernel/trace/fprobe.c
> > @@ -450,8 +450,6 @@ static int fprobe_fgraph_entry(struct ftrace_graph_ent *trace, struct fgraph_ops
> > used += FPROBE_HEADER_SIZE_IN_LONG + size_words;
> > }
> > }
> > - if (used < reserved_words)
> > - memset(fgraph_data + used, 0, reserved_words - used);
> >
> > /* If any exit_handler is set, data must be used. */
> > return used != 0;
>
> As for the patch,
>
> Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
>
> -- Steve
>
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>