]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Move RCU is watching check after recursion check
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 29 Sep 2020 16:40:31 +0000 (12:40 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 29 Sep 2020 17:05:10 +0000 (13:05 -0400)
commit7f79ebe65570401bf2378dd156cd241ece7c175c
tree36f2c56078e231af0341b9c684a2eda1afd195e6
parent1a42c08f9f811b8c2668780ada56d71942046774
ftrace: Move RCU is watching check after recursion check

The first thing that the ftrace function callback helper functions should do
is to check for recursion. Peter Zijlstra found that when
"rcu_is_watching()" had its notrace removed, it caused perf function tracing
to crash. This is because the call of rcu_is_watching() is tested before
function recursion is checked and and if it is traced, it will cause an
infinite recursion loop.

rcu_is_watching() should still stay notrace, but to prevent this should
never had crashed in the first place. The recursion prevention must be the
first thing done in callback functions.

Link: https://lore.kernel.org/r/20200929112541.GM2628@hirez.programming.kicks-ass.net
Cc: stable@vger.kernel.org
Cc: Paul McKenney <paulmck@kernel.org>
Fixes: 58061a36f2a8b ("ftrace: Have ftrace_ops_get_func() handle RCU and PER_CPU flags too")
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c