All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bradley Morgan <bradley.morgan@linux.dev>
To: rhkrqnwk98@gmail.com
Cc: boqun@kernel.org, bpf@vger.kernel.org, frederic@kernel.org,
	jiangshanlai@gmail.com, joelagnelf@nvidia.com,
	josh@joshtriplett.org, mathieu.desnoyers@efficios.com,
	neeraj.upadhyay@kernel.org, paulmck@kernel.org,
	qiang.zhang@linux.dev, rcu@vger.kernel.org, rostedt@goodmis.org,
	urezki@gmail.com
Subject: Re: [PATCH] rcu: Mark rcu_read_unlock_special() notrace
Date: Tue, 24 Nov 2026 18:59:12 +0000	[thread overview]
Message-ID: <B9936C09-18A8-4C0A-B502-DBDB0B93FDE4@linux.dev> (raw)
In-Reply-To: <20261124185659.1370644-1-rhkrqnwk98@gmail.com>

On 24 November 2026 18:56:51 GMT, Sechang Lim <rhkrqnwk98@gmail.com> wrote:
>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.

Hmm.. this seems to be edge case, but no big deal.

Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>


>
>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;
>

--- Thanks!

  reply	other threads:[~2026-11-24 18:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 18:56 [PATCH] rcu: Mark rcu_read_unlock_special() notrace Sechang Lim
2026-11-24 18:59 ` Bradley Morgan [this message]
2026-11-24 19:11 ` sashiko-bot
2026-11-24 21:08 ` Alexei Starovoitov
2026-11-24 22:11   ` Bradley Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9936C09-18A8-4C0A-B502-DBDB0B93FDE4@linux.dev \
    --to=bradley.morgan@linux.dev \
    --cc=boqun@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joelagnelf@nvidia.com \
    --cc=josh@joshtriplett.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang@linux.dev \
    --cc=rcu@vger.kernel.org \
    --cc=rhkrqnwk98@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.