File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -5867,8 +5867,15 @@ ftrace_graph_release(struct inode *inode, struct file *file)
5867
5867
5868
5868
mutex_unlock (& graph_lock );
5869
5869
5870
- /* Wait till all users are no longer using the old hash */
5871
- synchronize_rcu ();
5870
+ /*
5871
+ * We need to do a hard force of sched synchronization.
5872
+ * This is because we use preempt_disable() to do RCU, but
5873
+ * the function tracers can be called where RCU is not watching
5874
+ * (like before user_exit()). We can not rely on the RCU
5875
+ * infrastructure to do the synchronization, thus we must do it
5876
+ * ourselves.
5877
+ */
5878
+ schedule_on_each_cpu (ftrace_sync );
5872
5879
5873
5880
free_ftrace_hash (old_hash );
5874
5881
}
Original file line number Diff line number Diff line change @@ -979,6 +979,7 @@ static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace)
979
979
* Have to open code "rcu_dereference_sched()" because the
980
980
* function graph tracer can be called when RCU is not
981
981
* "watching".
982
+ * Protected with schedule_on_each_cpu(ftrace_sync)
982
983
*/
983
984
hash = rcu_dereference_protected (ftrace_graph_hash , !preemptible ());
984
985
@@ -1031,6 +1032,7 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr)
1031
1032
* Have to open code "rcu_dereference_sched()" because the
1032
1033
* function graph tracer can be called when RCU is not
1033
1034
* "watching".
1035
+ * Protected with schedule_on_each_cpu(ftrace_sync)
1034
1036
*/
1035
1037
notrace_hash = rcu_dereference_protected (ftrace_graph_notrace_hash ,
1036
1038
!preemptible ());
You can’t perform that action at this time.
0 commit comments