ftrace: Protect ftrace_graph_hash with ftrace_sync
As function_graph tracer can run when RCU is not "watching", it can not be
protected by synchronize_rcu() it requires running a task on each CPU before
it can be freed. Calling schedule_on_each_cpu(ftrace_sync) needs to be used.
Link: https://lore.kernel.org/r/20200205131110.GT2935@paulmck-ThinkPad-P72
Cc: stable@vger.kernel.org
Fixes: b9b0c831be
("ftrace: Convert graph filter to use hash tables")
Reported-by: "Paul E. McKenney" <paulmck@kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
@@ -979,6 +979,7 @@ static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace)
|
||||
* Have to open code "rcu_dereference_sched()" because the
|
||||
* function graph tracer can be called when RCU is not
|
||||
* "watching".
|
||||
* Protected with schedule_on_each_cpu(ftrace_sync)
|
||||
*/
|
||||
hash = rcu_dereference_protected(ftrace_graph_hash, !preemptible());
|
||||
|
||||
@@ -1031,6 +1032,7 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr)
|
||||
* Have to open code "rcu_dereference_sched()" because the
|
||||
* function graph tracer can be called when RCU is not
|
||||
* "watching".
|
||||
* Protected with schedule_on_each_cpu(ftrace_sync)
|
||||
*/
|
||||
notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash,
|
||||
!preemptible());
|
||||
|
Reference in New Issue
Block a user