[PATCH v2 1/3] fgraph: Initialize ftrace_ops->private for function graph ops

wang.yaxin@zte.com.cn posted 3 patches 5 days, 14 hours ago
[PATCH v2 1/3] fgraph: Initialize ftrace_ops->private for function graph ops
Posted by wang.yaxin@zte.com.cn 5 days, 14 hours ago
From: Shengming Hu <hu.shengming@zte.com.cn>

The ftrace_pids_enabled(op) check relies on op->private being properly
initialized, but fgraph_ops's underlying ftrace_ops->private was left
uninitialized. This caused ftrace_pids_enabled() to always return false,
effectively disabling PID filtering for function graph tracing.

Fix this by copying src_ops->private to dst_ops->private in
fgraph_init_ops(), ensuring PID filter state is correctly propagated.

Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
---
 kernel/trace/fgraph.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 7fb9b169d..f6f25d81a 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1016,6 +1016,7 @@ void fgraph_init_ops(struct ftrace_ops *dst_ops,
 		mutex_init(&dst_ops->local_hash.regex_lock);
 		INIT_LIST_HEAD(&dst_ops->subop_list);
 		dst_ops->flags |= FTRACE_OPS_FL_INITIALIZED;
+		dst_ops->private = src_ops->private;
 	}
 #endif
 }
-- 
2.25.1