]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fgraph: Fix thresh_return clear per-task notrace
authorShengming Hu <hu.shengming@zte.com.cn>
Sat, 21 Feb 2026 03:30:07 +0000 (11:30 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 4 Mar 2026 03:10:37 +0000 (22:10 -0500)
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>
kernel/trace/trace_functions_graph.c

index 3d8239fee00417526146768ebd219dabffcbd4c5..817d0f1696b6fb8e28f4a51e1356ebdc2455373d 100644 (file)
@@ -400,14 +400,15 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace,
                                      struct fgraph_ops *gops,
                                      struct ftrace_regs *fregs)
 {
+       unsigned long *task_var = fgraph_get_task_var(gops);
        struct fgraph_times *ftimes;
        struct trace_array *tr;
        int size;
 
        ftrace_graph_addr_finish(gops, trace);
 
-       if (trace_recursion_test(TRACE_GRAPH_NOTRACE_BIT)) {
-               trace_recursion_clear(TRACE_GRAPH_NOTRACE_BIT);
+       if (*task_var & TRACE_GRAPH_NOTRACE) {
+               *task_var &= ~TRACE_GRAPH_NOTRACE;
                return;
        }