Re: [PATCH] tracing: fprobe: fix the length of unused fgraph_data

From: Steven Rostedt

Date: Mon Mar 23 2026 - 10:57:02 EST


On Mon, 23 Mar 2026 11:19:36 +0100
Martin Kaiser <martin@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
> Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
> ---
> 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.

-- Steve


>
> /* If any exit_handler is set, data must be used. */
> return used != 0;