From: Kunwu Chan <kunwu.chan@gmail.com>
To: dave@stgolabs.net, paulmck@kernel.org, josh@joshtriplett.org,
frederic@kernel.org, neeraj.upadhyay@kernel.org,
joelagnelf@nvidia.com, boqun@kernel.org, urezki@gmail.com
Cc: rostedt@goodmis.org, mathieu.desnoyers@efficios.com,
jiangshanlai@gmail.com, qiang.zhang@linux.dev,
linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
Kunwu Chan <kunwu.chan@gmail.com>
Subject: [PATCH v2 0/7] rcu: Record callback enqueue stacks and add torture tests
Date: Wed, 18 Nov 2026 16:51:40 +0800 [thread overview]
Message-ID: <20261118085147.1668598-1-kunwu.chan@gmail.com> (raw)
This series records the enqueueing stack for RCU Tasks callbacks and
adds rcutorture coverage for duplicate callbacks and KASAN
auxiliary-stack recording.
Changes since v1, in response to feedback from Joel Fernandes,
Paul E. McKenney, and Zqiang:
v1: https://lore.kernel.org/all/20261106143913.3627722-1-kunwu.chan@gmail.com/
- Dropped the RCU_KASAN_AUX_TEST module, its Kconfig flavor choice,
and the five *KASAN01 scenarios. The verification is now an
rcutorture self-test that uses the selected flavor's callback and
barrier operations, enabled by the new
rcutorture.kasan_debug boot parameter, so it can be run from
kvm.sh --kasan with existing scenarios.
- rcu_test_debug_objects() now skips flavors that do not set
->debug_objects. The flag previously guarded only the
->call()/->cb_barrier() sanity check, so torture_type=trivial
with CONFIG_DEBUG_OBJECTS_RCU_HEAD=y and
rcutorture.object_debug=1 invoked a NULL function pointer.
This panic was reproduced before the fix and verified fixed
after it, with identical rcutorture arguments.
- New in v2: kasan-aux.sh automates the auxiliary-stack checks using
kvm.sh --kasan, existing scenarios, and the existing checkers,
ending with a single kvm-recheck.sh pass over the filtered logs.
kasan-aux.sh can run and check the auxiliary-stack test on its
own. The final patch also runs it from torture.sh when both RCU
and KASAN testing are enabled.
Tested on x86_64 with kvm.sh --kasan, kasan_multi_shot, and
rcutorture.kasan_debug=1 (30-second runs, built kernels reused via
kvm-again.sh to select flavors):
Scenario Flavor "Last potentially related work creation"
TASKS01 tasks call_rcu_tasks_generic
TASKS01 rcu __call_rcu_common
TASKS01 srcu __call_srcu
TASKS01 tasks-tracing __call_srcu
TINY01 rcu call_rcu
TINY01 srcu call_srcu
kasan-aux.sh checks for rcu_test_kasan() in the auxiliary stack.
All runs reached "End of test: SUCCESS" with one intentional report,
which the torture summary flags (Bugs: 1) as it flags the
intentional warnings from rcutorture.object_debug=1.
Also verified:
- tasks with object_debug=1 and kasan_debug=1, 3-minute run:
the four intentional debugobjects warnings, then the KASAN
report, then SUCCESS with barrier: 633/633.
- Direct kvm.sh runs of trivial, tasks-rude, and busted with one or
both self-tests enabled: clean skip messages, no splats, exit code 0.
kasan-aux.sh expects these flavors to skip.
- TASKS01 without KASAN and kasan_debug=1: test skipped,
exit code 0.
- tasks with both self-tests disabled: no splats, exit code 0.
- kasan-aux.sh --check negatives: a TINY01 build with
kasan_record_aux_stack() compiled out of call_rcu() fails with a
missing auxiliary stack, and a non-KASAN run is rejected at the
configuration check.
Keep this test out of runs intended to find real KASAN bugs:
KASAN suppresses reports after the first unless kasan_multi_shot
is also supplied, and the report taints the kernel.
The seventh patch runs kasan-aux.sh from torture.sh on the scenarios
selected by --configs-rcutorture, so the added kernel builds scale
with that selection; --no-kasan or dropping that patch avoids them
entirely. Feedback on whether that default is worthwhile would be
welcome.
For example:
tools/testing/selftests/rcutorture/bin/kvm.sh --configs TASKS01 \
--kasan --duration 30s \
--bootargs "rcutorture.kasan_debug=1 kasan_multi_shot"
tools/testing/selftests/rcutorture/bin/kasan-aux.sh
This series was tested on top of [1] with Joel's RCU Tasks barrier
debugobjects fix [2] applied.
[1] https://lore.kernel.org/all/20261027070923.3054462-1-kunwu.chan@gmail.com/
[2] https://lore.kernel.org/all/20261104153046.965890-1-joelagnelf@nvidia.com/
Kunwu Chan (7):
rcu-tasks: Record callback enqueue stack
rcutorture: Require debug_objects flag for debug-objects test
rcutorture: Test duplicate call_rcu_tasks() callback enqueue
rcutorture: Test duplicate call_rcu_tasks_trace() callback enqueue
rcutorture: Add KASAN aux-stack self-test
rcutorture: Add kasan-aux.sh aux-stack checker
rcutorture: Run KASAN aux-stack checks from torture.sh
Documentation/RCU/torture.rst | 46 ++++
.../admin-guide/kernel-parameters.txt | 11 +
kernel/rcu/rcutorture.c | 55 ++++-
kernel/rcu/tasks.h | 4 +
.../rcutorture/bin/kasan-aux-check.sh | 158 ++++++++++++
.../selftests/rcutorture/bin/kasan-aux.sh | 228 ++++++++++++++++++
.../selftests/rcutorture/bin/torture.sh | 9 +
7 files changed, 509 insertions(+), 2 deletions(-)
create mode 100755 tools/testing/selftests/rcutorture/bin/kasan-aux-check.sh
create mode 100755 tools/testing/selftests/rcutorture/bin/kasan-aux.sh
--
2.43.0
next reply other threads:[~2026-11-18 8:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 8:51 Kunwu Chan [this message]
2026-11-18 8:51 ` [PATCH v2 1/7] rcu-tasks: Record callback enqueue stack Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 2/7] rcutorture: Require debug_objects flag for debug-objects test Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 3/7] rcutorture: Test duplicate call_rcu_tasks() callback enqueue Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 4/7] rcutorture: Test duplicate call_rcu_tasks_trace() " Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 5/7] rcutorture: Add KASAN aux-stack self-test Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 6/7] rcutorture: Add kasan-aux.sh aux-stack checker Kunwu Chan
2026-11-18 8:51 ` [PATCH v2 7/7] rcutorture: Run KASAN aux-stack checks from torture.sh 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=20261118085147.1668598-1-kunwu.chan@gmail.com \
--to=kunwu.chan@gmail.com \
--cc=boqun@kernel.org \
--cc=dave@stgolabs.net \
--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 \
/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®