]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tracing: Add recursion protection in kernel stack trace recording
authorSteven Rostedt <rostedt@goodmis.org>
Tue, 6 Jan 2026 01:31:41 +0000 (20:31 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 7 Jan 2026 19:52:22 +0000 (14:52 -0500)
commit5f1ef0dfcb5b7f4a91a9b0e0ba533efd9f7e2cdb
tree7ca2e2fbc9bca44bd243dc8eac56c02e43c78579
parent5232196ff49be08350b27f1ba8e1fad87afc9cdf
tracing: Add recursion protection in kernel stack trace recording

A bug was reported about an infinite recursion caused by tracing the rcu
events with the kernel stack trace trigger enabled. The stack trace code
called back into RCU which then called the stack trace again.

Expand the ftrace recursion protection to add a set of bits to protect
events from recursion. Each bit represents the context that the event is
in (normal, softirq, interrupt and NMI).

Have the stack trace code use the interrupt context to protect against
recursion.

Note, the bug showed an issue in both the RCU code as well as the tracing
stacktrace code. This only handles the tracing stack trace side of the
bug. The RCU fix will be handled separately.

Link: https://lore.kernel.org/all/20260102122807.7025fc87@gandalf.local.home/
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20260105203141.515cd49f@gandalf.local.home
Reported-by: Yao Kai <yaokai34@huawei.com>
Tested-by: Yao Kai <yaokai34@huawei.com>
Fixes: 5f5fa7ea89dc ("rcu: Don't use negative nesting depth in __rcu_read_unlock()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/linux/trace_recursion.h
kernel/trace/trace.c