Skip to contentSkip to conversation

function_graph: Fix args pointer mismatch in print_graph_retval()

PATCH In review Donglin Peng 2 participants 3 messages Jan 12 – Jan 30 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 function_graph: Fix args pointer mismatch in print_graph_retval()

From: Donglin Peng <[email protected]>

When funcgraph-args and funcgraph-retaddr are both enabled, many kernel functions display invalid parameters in trace logs[1].

The issue occurs because print_graph_retval() passes a mismatched args pointer to print_function_args(). Fix this by retrieving the correct args pointer using the FGRAPH_ENTRY_ARGS() macro.

[1] https://gitee.com/pengdonglin137/funcgraph_visualization/raw/master/samples/error_args.png

Fixes f83ac7544fbf ("function_graph: Enable funcgraph-args and funcgraph-retaddr to work simultaneously")
---
 kernel/trace/trace_functions_graph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_functions_graph.c +1 -1
index b1e9c9913309..1de6f1573621 100644
@@ -901,7 +901,7 @@ static void print_graph_retval(struct trace_seq *s, struct ftrace_graph_ent_entr
 		trace_seq_printf(s, "%ps", func);
 
 		if (args_size >= FTRACE_REGS_MAX_ARGS * sizeof(long)) {
-			print_function_args(s, entry->args, (unsigned long)func);
+			print_function_args(s, FGRAPH_ENTRY_ARGS(entry), (unsigned long)func);
 			trace_seq_putc(s, ';');
 		} else
 			trace_seq_puts(s, "();");
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 10 lines · On Mon, 12 Jan 2026 10:16:01 +0800 Donglin Peng <[email protected]> wrote:

From: Donglin Peng <[email protected]>

When funcgraph-args and funcgraph-retaddr are both enabled, many kernel functions display invalid parameters in trace logs[1].

The issue occurs because print_graph_retval() passes a mismatched args pointer to print_function_args(). Fix this by retrieving the correct args pointer using the FGRAPH_ENTRY_ARGS() macro.

[1] https://gitee.com/pengdonglin137/funcgraph_visualization/raw/master/samples/error_args.png

Please do not provide links to images. This stays in the git logs for the lifetime of the Linux kernel. Images like this will likely not live as long and the link becomes wasted space in the git history.

Either do a cut and paste of the bad output, or don't include it at all.

-- Steve

Quoted 2 lines
Fixes f83ac7544fbf ("function_graph: Enable funcgraph-args and funcgraph-retaddr to work simultaneously")
#2 lore raw
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 12 Jan 2026 10:16:01 +0800 Donglin Peng <[email protected]> wrote:

From: Donglin Peng <[email protected]>

When funcgraph-args and funcgraph-retaddr are both enabled, many kernel functions display invalid parameters in trace logs[1].

The issue occurs because print_graph_retval() passes a mismatched args pointer to print_function_args(). Fix this by retrieving the correct args pointer using the FGRAPH_ENTRY_ARGS() macro.

Quoted 5 lines
Quoted 1 line

[1] https://gitee.com/pengdonglin137/funcgraph_visualization/raw/master/samples/error_args.png

Please do not provide links to images. This stays in the git logs for the lifetime of the Linux kernel. Images like this will likely not live as long and the link becomes wasted space in the git history.

Thanks for pointing this out.

Quoted 2 lines

Either do a cut and paste of the bad output, or don't include it at all.

Thanks.

Quoted 6 lines

-- Steve

Quoted 2 lines
Fixes f83ac7544fbf ("function_graph: Enable funcgraph-args and funcgraph-retaddr to work simultaneously")