All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sechang Lim" <rhkrqnwk98@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] rcu: Mark rcu_read_unlock_special() notrace
Date: Tue, 24 Nov 2026 19:11:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-231883@kernel.org> (raw)
In-Reply-To: <20261124185659.1370644-1-rhkrqnwk98@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] rcu: missing notrace on rcu_unlock_needs_exp_handling() allows
  recursion
--

commit 0062b967b0900da7cf7c59da2e3a111544dc9aec
Author: Sechang Lim <rhkrqnwk98@gmail.com>

rcu: Mark rcu_read_unlock_special() notrace

This commit marks rcu_read_unlock_special() notrace to prevent infinite
recursion when a BPF trampoline attached to it calls rcu_read_unlock().

> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index ae5d21bae7bc0..a887ab69f4860 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;

[Severity: High]
Should rcu_unlock_needs_exp_handling() also be marked notrace (or static
inline)?

In the preempt_bh_were_disabled || irqs_were_disabled path,
rcu_read_unlock_special() disables IRQs and calls
rcu_unlock_needs_exp_handling() while t->rcu_read_unlock_special.s is
still non-zero.  Because rcu_unlock_needs_exp_handling() is neither
notrace nor inline, marking rcu_read_unlock_special() notrace prevents the
compiler from inlining it when notrace expands to
__no_instrument_function__.  Attaching a BPF fentry or fexit program to
rcu_unlock_needs_exp_handling() then triggers the same
rcu_read_unlock() -> rcu_read_unlock_special() recursion and stack
overflow.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124185659.1370644-1-rhkrqnwk98@gmail.com?part=1

  parent reply	other threads:[~2026-11-24 19:11 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
2026-11-24 19:11 ` sashiko-bot [this message]
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=sashiko-outbox-231883@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rhkrqnwk98@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.