Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fgraph: Fix thresh_return clear per-task notrace

When tracing_thresh is enabled, function graph tracing uses
trace_graph_thresh_return() as the return handler. Unlike
trace_graph_return(), it did not clear the per-task TRACE_GRAPH_NOTRACE
flag set by the entry handler for set_graph_notrace addresses. This could
leave the task permanently in "notrace" state and effectively disable
function graph tracing for that task.

Mirror trace_graph_return()'s per-task notrace handling by clearing
TRACE_GRAPH_NOTRACE and returning early when set.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260221113007819YgrZsMGABff4Rc-O_fZxL@zte.com.cn
Fixes: b84214890a9bc ("function_graph: Move graph notrace bit to shadow stack global var")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Shengming Hu and committed by
Steven Rostedt (Google)
6ca8379b 11439c46

+3 -2
+3 -2
kernel/trace/trace_functions_graph.c
··· 400 400 struct fgraph_ops *gops, 401 401 struct ftrace_regs *fregs) 402 402 { 403 + unsigned long *task_var = fgraph_get_task_var(gops); 403 404 struct fgraph_times *ftimes; 404 405 struct trace_array *tr; 405 406 int size; 406 407 407 408 ftrace_graph_addr_finish(gops, trace); 408 409 409 - if (trace_recursion_test(TRACE_GRAPH_NOTRACE_BIT)) { 410 - trace_recursion_clear(TRACE_GRAPH_NOTRACE_BIT); 410 + if (*task_var & TRACE_GRAPH_NOTRACE) { 411 + *task_var &= ~TRACE_GRAPH_NOTRACE; 411 412 return; 412 413 } 413 414