[PATCH v2 7/7] rcutorture: Run KASAN aux-stack checks from torture.sh

From: Kunwu Chan

Date: Wed Nov 18 2026 - 03:53:23 EST


Invoke kasan-aux.sh when torture.sh has both RCU-torture and KASAN
testing enabled, reusing the existing --do-kasan switch, the
torture_one bookkeeping, and the --configs-rcutorture scenario
selection, so the added kernel builds scale with that selection.
--no-kasan disables both ordinary KASAN and aux-stack testing.

Suggested-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Suggested-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
Cc: Kunwu Chan <kunwu.chan@xxxxxxxxx>
Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
---
Documentation/RCU/torture.rst | 14 ++++++++++++++
tools/testing/selftests/rcutorture/bin/torture.sh | 9 +++++++++
2 files changed, 23 insertions(+)

diff --git a/Documentation/RCU/torture.rst b/Documentation/RCU/torture.rst
index 15a430f5111f4..8c8dcf6449bf0 100644
--- a/Documentation/RCU/torture.rst
+++ b/Documentation/RCU/torture.rst
@@ -244,6 +244,20 @@ As with the intentional warnings tested by ``srcu_lockdep.sh``, ordinary
diagnostic; use the dedicated check to distinguish the expected report
from failures.

+``torture.sh`` includes these dedicated runs when both RCU torture and
+KASAN testing are enabled, as they are by default, using the scenarios
+selected by ``--configs-rcutorture`` and 30-second run durations.
+``--no-kasan`` disables both ordinary KASAN and auxiliary-stack testing.
+For example::
+
+ tools/testing/selftests/rcutorture/bin/torture.sh \
+ --do-none --do-rcutorture --do-kasan \
+ --configs-rcutorture TREE03 --duration 2
+
+This runs ordinary KASAN torture with TREE03, followed by the dedicated
+auxiliary-stack verification of TREE03. To run only the auxiliary
+checks, invoke ``kasan-aux.sh`` directly.
+
Kernel boot arguments can also be supplied, for example, to control
rcutorture's module parameters. For example, to test a change to RCU's
CPU stall-warning code, use "--bootargs 'rcutorture.stall_cpu=30'".
diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 90b5e113a0b03..e04ed2c27f533 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -515,6 +515,15 @@ if test "$do_rcutorture" = "yes"
then
torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
torture_set "rcutorture" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration "$duration_rcutorture" --configs "$configs_rcutorture" --trust-make
+
+ # Check intentional reports separately from the ordinary KASAN bug hunts.
+ # kasan-aux.sh supplies its own boot arguments and rejects --bootargs.
+ if test "$do_kasan" = "yes"
+ then
+ torture_bootargs=""
+ curflavor=rcu-aux-kasan
+ torture_one tools/testing/selftests/rcutorture/bin/kasan-aux.sh --configs "$configs_rcutorture"
+ fi
fi

# Test atomic SRCU across Tree SRCU (SRCU-N and SRCU-P) and Tiny SRCU
--
2.43.0