BPF List
 help / color / mirror / Atom feed
* [PATCH] rcu: Mark rcu_read_unlock_special() notrace
@ 2026-11-24 18:56 Sechang Lim
  2026-11-24 18:59 ` Bradley Morgan
  2026-11-24 19:11 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Sechang Lim @ 2026-11-24 18:56 UTC (permalink / raw)
  To: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki
  Cc: Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu,
	bpf

The BPF trampoline calls rcu_read_unlock() on its exit path. If the
task was preempted in the RCU read-side critical section, this ends up
in rcu_read_unlock_special(). When a BPF fentry or fexit program is
attached to rcu_read_unlock_special() itself, the trampoline runs again
before ->rcu_read_unlock_special is cleared, calls rcu_read_unlock()
again, and recurses until the stack overflows:

  BUG: TASK stack guard page was hit at ffffc90001657ff8
  ...
   bpf_trampoline_6442575622+0x5e/0xac
   rcu_read_unlock_special+0x5/0x490
   __rcu_read_unlock+0x9c/0x120
   rcu_read_unlock_migrate+0x93/0x220
   bpf_trampoline_6442575622+0x5e/0xac
   rcu_read_unlock_special+0x5/0x490
   ...

Mark rcu_read_unlock_special() notrace.

Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index ae5d21bae7bc..a887ab69f486 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -746,7 +746,7 @@ static bool rcu_unlock_needs_exp_handling(struct task_struct *t,
  * notify RCU core processing or task having blocked during the RCU
  * read-side critical section.
  */
-static void rcu_read_unlock_special(struct task_struct *t)
+static notrace void rcu_read_unlock_special(struct task_struct *t)
 {
 	unsigned long flags;
 	bool irqs_were_disabled;
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-24 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 18:56 [PATCH] rcu: Mark rcu_read_unlock_special() notrace Sechang Lim
2026-11-24 18:59 ` Bradley Morgan
2026-11-24 19:11 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox