Skip to content

Commit 6ca8379

Browse files
HSM6236rostedt
authored andcommitted
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: [email protected] Link: https://patch.msgid.link/[email protected] Fixes: b842148 ("function_graph: Move graph notrace bit to shadow stack global var") Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Shengming Hu <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 11439c4 commit 6ca8379

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

kernel/trace/trace_functions_graph.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,15 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace,
400400
struct fgraph_ops *gops,
401401
struct ftrace_regs *fregs)
402402
{
403+
unsigned long *task_var = fgraph_get_task_var(gops);
403404
struct fgraph_times *ftimes;
404405
struct trace_array *tr;
405406
int size;
406407

407408
ftrace_graph_addr_finish(gops, trace);
408409

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;
411412
return;
412413
}
413414

0 commit comments

Comments
 (0)