From: Kunwu Chan <kunwu.chan@gmail.com>
To: jiangshanlai@gmail.com, paulmck@kernel.org,
josh@joshtriplett.org, work@onurozkan.dev, frederic@kernel.org,
neeraj.upadhyay@kernel.org, joelagnelf@nvidia.com,
boqun@kernel.org, urezki@gmail.com
Cc: rostedt@goodmis.org, mathieu.desnoyers@efficios.com,
qiang.zhang@linux.dev, rcu@vger.kernel.org,
linux-kernel@vger.kernel.org, Kunwu Chan <kunwu.chan@gmail.com>
Subject: [PATCH 0/9] rcu: Improve callback diagnostics and validation
Date: Fri, 23 Oct 2026 18:18:32 +0800 [thread overview]
Message-ID: <20261023101841.2910719-1-kunwu.chan@gmail.com> (raw)
Hi,
This series improves callback diagnostics and validation across RCU,
SRCU, and RCU Tasks.
Patches 1-3 record callback registration stacks for KASAN in Tree
SRCU, Tiny SRCU, and Tiny RCU, matching the existing behavior in
Tree RCU. This preserves the original registration site in KASAN
reports when callbacks are deferred through irq_work.
Patches 4-6 add rcu_head alignment and NULL callback-function
checks to SRCU, Tiny RCU, and RCU Tasks, consistent with the
existing checks in Tree RCU.
Patches 7-9 detect duplicate callback enqueue attempts at
registration time, report the callback address, function symbol,
and object information, and limit diagnostics to the first three
occurrences. In Tree SRCU, moving the check from srcu_do_enqueue()
to __call_srcu() rejects detected duplicate registrations before
they reach the deferred-list enqueue path.
The duplicate-enqueue checks rely on the existing RCU head
debug-object mechanism and are effective only when
CONFIG_DEBUG_OBJECTS_RCU_HEAD is enabled. They provide
diagnostics, not full protection against concurrent registration
of the same rcu_head, which violates the API contract.
Tested by rcutorture with KASAN enabled: SRCU-N, SRCU-P, SRCU-T,
SRCU-U, TINY01, TINY02, and TREE03, each for 3 minutes. All
configurations completed with exitcode 0.
The KASAN aux stack was verified with a custom UAF module: the
"Last potentially related work creation" line in the KASAN report
identified the original __call_srcu() registration site.
A targeted Tree SRCU test module exercised duplicate enqueue
detection on both the direct and irqs-off deferred paths with
CONFIG_DEBUG_OBJECTS_RCU_HEAD=y. Both paths rejected the
duplicate at __call_srcu() entry without list corruption or
hangs.
A targeted Tiny SRCU test module exercised NULL callback
rejection, duplicate enqueue detection, and post-callback
rcu_head reuse with CONFIG_DEBUG_OBJECTS_RCU_HEAD=y. The
first two tests produced the expected diagnostics, and the
callback and reuse tests completed without hangs or stale
debug-object state.
RCU Tasks duplicate enqueue detection was verified by code
inspection; no targeted runtime test has been performed for
that path.
Kunwu Chan (9):
srcu: Record callback registration stack for KASAN
srcutiny: Record callback registration stack for KASAN
rcu: Record callback registration stack for Tiny RCU
srcu: Validate callback arguments
rcu: Validate callback arguments in Tiny RCU
rcu-tasks: Validate callback arguments
srcu: Detect duplicate callback enqueue at registration
srcutiny: Detect duplicate callback enqueue
rcu-tasks: Detect duplicate callback enqueue
kernel/rcu/srcutiny.c | 30 ++++++++++++++++++++++++++++++
kernel/rcu/srcutree.c | 32 ++++++++++++++++++++++++++------
kernel/rcu/tasks.h | 22 ++++++++++++++++++++++
kernel/rcu/tiny.c | 11 +++++++++++
4 files changed, 89 insertions(+), 6 deletions(-)
base-commit: 940793b926aa94bf65ec404043050888e3053188
--
2.43.0
next reply other threads:[~2026-10-23 10:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 10:18 Kunwu Chan [this message]
2026-10-23 10:18 ` [PATCH 1/9] srcu: Record callback registration stack for KASAN Kunwu Chan
2026-10-23 10:18 ` [PATCH 2/9] srcutiny: " Kunwu Chan
2026-10-23 10:18 ` [PATCH 3/9] rcu: Record callback registration stack for Tiny RCU Kunwu Chan
2026-10-23 10:18 ` [PATCH 4/9] srcu: Validate callback arguments Kunwu Chan
2026-10-23 10:18 ` [PATCH 5/9] rcu: Validate callback arguments in Tiny RCU Kunwu Chan
2026-10-23 10:18 ` [PATCH 6/9] rcu-tasks: Validate callback arguments Kunwu Chan
2026-10-23 10:18 ` [PATCH 7/9] srcu: Detect duplicate callback enqueue at registration Kunwu Chan
2026-10-23 10:18 ` [PATCH 8/9] srcutiny: Detect duplicate callback enqueue Kunwu Chan
2026-10-23 10:18 ` [PATCH 9/9] rcu-tasks: " Kunwu Chan
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=20261023101841.2910719-1-kunwu.chan@gmail.com \
--to=kunwu.chan@gmail.com \
--cc=boqun@kernel.org \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.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=rostedt@goodmis.org \
--cc=urezki@gmail.com \
--cc=work@onurozkan.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
all inboxes | Powered by JetHome®