Re: [PATCH v3 2/7] rcutorture: Require debug_objects flag for debug-objects test

From: KunWu Chan

Date: Wed Dec 02 2026 - 20:41:46 EST


Makes sense. Thanks, Paul and Joel!


On Thu, Dec 3, 2026 at 1:40 AM Joel Fernandes <jfern@xxxxxxxxxx> wrote:
>
> On 12/02, "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> > 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.
>
> Paul's suggestion makes sense to me, I have proactively applied this 7 patch series
> for v7.6 for further review and testing. Thanks!
>
> Don't need to send another iteration if this is the only change for this
> particular patch, here is the final patch:
> https://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git/commit/?h=dev&id=46640c462c609b28547d1f41a40c43640bc4dad7
>
> thanks,
>
> Joel Fernandes
>
> >
> > > + 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
> > >