Re: [PATCH v3 2/7] rcutorture: Require debug_objects flag for debug-objects test
From: Paul E. McKenney
Date: Wed Dec 02 2026 - 11:53:01 EST
On Sat, Nov 28, 2026 at 10:27:24PM +0800, Kunwu Chan wrote:
> 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>
Nice, but one issue below.
Thanx, Paul
> ---
> 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 67fc770abc102..1648e6369d809 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -4774,8 +4774,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) {
Could you please do something here like a:
WARN_ON_ONCE(IS_BUILTIN(CONFIG_RCU_TORTURE_TEST));
This allows us to spot this sort of misconfiguration in things like
torture.sh, so that we can fix them.
> + 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
>