[PATCH v2 2/7] rcutorture: Require debug_objects flag for debug-objects test
From: Kunwu Chan
Date: Wed Nov 18 2026 - 03:52:35 EST
rcu_test_debug_objects() checks for missing callback and barrier
operations only when ->debug_objects is set. With the flag clear,
execution falls through to the test even if those operations are
missing.
With CONFIG_DEBUG_OBJECTS_RCU_HEAD=y and rcutorture.object_debug=1,
the trivial flavor can therefore call a NULL function pointer.
Skip the test for flavors that do not set ->debug_objects.
Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
---
kernel/rcu/rcutorture.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 968343be4e0d1..caa550095705a 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -4603,8 +4603,13 @@ static void rcu_test_debug_objects(void)
return;
}
- if (WARN_ON_ONCE(cur_ops->debug_objects &&
- (!cur_ops->call || !cur_ops->cb_barrier)))
+ if (!cur_ops->debug_objects) {
+ pr_alert("%s: %s does not support debug-object testing\n",
+ KBUILD_MODNAME, cur_ops->name);
+ return;
+ }
+
+ if (WARN_ON_ONCE(!cur_ops->call || !cur_ops->cb_barrier))
return;
struct rcu_head *rhp = kmalloc_obj(*rhp);
--
2.43.0