Re: [PATCH v5 2/2] slub: Introduce CONFIG_SLUB_RCU_DEBUG
From: Jann Horn
Date: Fri Aug 02 2024 - 04:16:52 EST
On Fri, Aug 2, 2024 at 10:06 AM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Tue, Jul 30, 2024 at 01:06PM +0200, Jann Horn wrote:
> [...]
> > +#ifdef CONFIG_SLUB_RCU_DEBUG
> > + if ((s->flags & SLAB_TYPESAFE_BY_RCU) && !after_rcu_delay) {
> > + struct rcu_delayed_free *delayed_free;
> > +
> > + delayed_free = kmalloc(sizeof(*delayed_free), GFP_NOWAIT);
>
> This may well be allocated by KFENCE.
>
> [...]
> > +#ifdef CONFIG_SLUB_RCU_DEBUG
> > +static void slab_free_after_rcu_debug(struct rcu_head *rcu_head)
> > +{
> > + struct rcu_delayed_free *delayed_free =
> > + container_of(rcu_head, struct rcu_delayed_free, head);
> > + void *object = delayed_free->object;
> > + struct slab *slab = virt_to_slab(object);
> > + struct kmem_cache *s;
> > +
> > + if (WARN_ON(is_kfence_address(rcu_head)))
> > + return;
>
> syzbot found this warning to trigger (because see above comment):
> https://lore.kernel.org/all/00000000000052aa15061eaeb1fd@xxxxxxxxxx/
>
> Should this have been `is_kfence_address(object)`?
Whoops, indeed... thanks, will fix in v6.