From: sashiko-bot@kernel.org
To: "Puranjay Mohan" <puranjay@kernel.org>
Cc: bpf@vger.kernel.org, linux-rt-devel@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/6] srcu: Make call_srcu() safe to call from any context
Date: Mon, 03 Aug 2026 14:49:18 +0000 [thread overview]
Message-ID: <20260803144919.2D8C31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803135329.2327280-3-puranjay@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Tiny SRCU's call_srcu() remains unsafe to call from NMI context, leaving it vulnerable to list corruption.
--
--- Patch [3]: [PATCH v2 3/6] srcu: Make call_srcu() safe to call from any context ---
commit e3be0303432c7c7afdd4ed014dae0987e25bf7d3
Author: Puranjay Mohan <puranjay@kernel.org>
srcu: Make call_srcu() safe to call from any context
This commit updates Tree SRCU to make call_srcu() safe to call from any
context, including NMIs. It defers callbacks via a per-CPU irq_work when
interrupts are already disabled to prevent list corruption and deadlocks.
> srcu: Make call_srcu() safe to call from any context
>
> call_srcu() has the same constraint as call_rcu(): its callback list and
> locks are only touched with interrupts disabled. srcu_gp_start_if_needed()
> enqueues under raw_spin_lock_irqsave() and may walk the srcu_node tree, as
> do callback invocation and grace-period work. A call_srcu() with
> interrupts disabled can race a list operation in flight on this CPU and
> corrupt the list or deadlock. call_rcu_tasks_trace() is call_srcu() under
> the hood, so a sleepable BPF program freeing an object can reach this.
[Severity: High]
This isn't a bug introduced by this patch, but does Tiny SRCU also need a
similar fix to safely handle NMI contexts?
In kernel/rcu/srcutiny.c, call_srcu() relies solely on local_irq_save(),
which does not mask NMIs:
local_irq_save(flags);
*ssp->srcu_cb_tail = rhp;
ssp->srcu_cb_tail = &rhp->next;
local_irq_restore(flags);
If an NMI interrupts call_srcu() exactly between assigning the tail and
updating the tail pointer, and the NMI handler invokes call_srcu()
(e.g., via call_rcu_tasks_trace()) on the same srcu_struct, could this
overwrite the tail pointer and permanently detach the list?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803134839.2103051-1-puranjay@kernel.org?part=3
next prev parent reply other threads:[~2026-08-03 14:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:48 [PATCH v2 0/6] rcu,srcu: Make call_rcu()/call_srcu() safe from any context Puranjay Mohan
2026-08-03 13:53 ` [PATCH v2 1/6] rcu: Make call_rcu() safe to call " Puranjay Mohan
2026-08-03 14:18 ` sashiko-bot
2026-08-03 13:53 ` [PATCH v2 2/6] rcu: Make Tiny " Puranjay Mohan
2026-08-03 14:35 ` sashiko-bot
2026-08-03 14:40 ` Puranjay Mohan
2026-08-03 13:53 ` [PATCH v2 3/6] srcu: Make call_srcu() " Puranjay Mohan
2026-08-03 14:49 ` sashiko-bot [this message]
2026-08-03 14:52 ` Puranjay Mohan
2026-08-03 13:53 ` [PATCH v2 4/6] srcu: Make Tiny " Puranjay Mohan
2026-08-03 13:53 ` [PATCH v2 5/6] rcutorture: Exercise ->call() from NMI context Puranjay Mohan
2026-08-03 13:53 ` [PATCH v2 6/6] selftests/bpf: Add a call_srcu() re-entry reproducer Puranjay Mohan
2026-08-03 15:15 ` sashiko-bot
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=20260803144919.2D8C31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=puranjay@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox