ftrace: Protect ftrace_graph_hash with ftrace_sync
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 5 Feb 2020 14:20:32 +0000 (09:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:34:05 +0000 (04:34 -0800)
commit0948d6294d7bb1957125b01adc2e8df75da52b98
tree048fc1e3b8c4b99e1e530b7ced4d9fb7693ea79f
parentc03d23598062175c450a646763c2c0045a7aa35e
ftrace: Protect ftrace_graph_hash with ftrace_sync

[ Upstream commit 54a16ff6f2e50775145b210bcd94d62c3c2af117 ]

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: b9b0c831bed26 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/ftrace.c
kernel/trace/trace.h