All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Vlastimil Babka <vbabka@kernel.org>,
	Harry Yoo <harry@kernel.org>,
	 Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	 Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Hao Li <hao.li@linux.dev>,  Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	kasan-dev@googlegroups.com, linux-mm@kvack.org
Subject: Re: [PATCH 1/2] mm/kasan: Detect double-free involving kfree_rcu_sheaf().
Date: Tue, 27 Oct 2026 21:51:28 +0000	[thread overview]
Message-ID: <auEcseqdxGGelMM3@google.com> (raw)
In-Reply-To: <CAG_fn=U=Rf8y49JGYjJ4qT96=MwD5v6SLwVqeiOhR+Z7R2ZKRw@mail.gmail.com>

On Tue, 27 Oct 2026 13:48:03 +0100, Alexander Potapenko wrote:
> On Fri, Oct 9, 2026 at 11:46 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> 
> > The bit is marked along with recording the stack trace when
> > deferring slab frees in kfree_rcu_sheaf() and checked in
> > check_slab_allocation() so that any double-free pattern above
> > can be detected immediately.
> >
> > Link: https://lore.kernel.org/all/6ac959ee.70ed5d86.2ac85.007d.GAE@google.com/ #[0]
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> Tested-by: Alexander Potapenko <glider@google.com>
> 
> Do we need a Fixes: tag?

Will add

Fixes: ec66e0d59952 ("slab: add sheaf support for batching kfree_rcu() operations")

> 
> 
> 
> 
> >   */
> >  static __always_inline bool kasan_slab_pre_free(struct kmem_cache *s,
> > -                                               void *object)
> > +                                               void *object,
> > +                                               bool after_rcu_delay)
> 
> Please update the doc comment as well.

Will do.


> 
> 
> >         poison_slab_object(slab->slab_cache, ptr, false);
> > diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> > index 2b8e73f5f6a7..07636ffe1626 100644
> > --- a/mm/kasan/generic.c
> > +++ b/mm/kasan/generic.c
> > @@ -536,7 +536,7 @@ size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object)
> >   * This function avoids dynamic memory allocations and thus can be called from
> >   * contexts that do not allow allocating memory.
> >   */
> 
> Please update the comment for this function.

Will do.


> 
> 
> > +void kasan_record_aux_stack(void *addr)
> > +{
> > +       __kasan_record_aux_stack(addr, false);
> > +}
> > +
> 
> I think there's an important distinction between
> kasan_record_aux_stack() and kasan_record_aux_stack_rcu(): namely, it
> affects how this object is handled later.
> Let's somehow reflect this in a comment ("records the aux stack and
> arms the check") and perhaps rename it to something like
> kasan_mark_rcu_free_pending()?

Sure, will rename to it and add comments.


> 
> Otherwise the series looks good, I'll be happy to stamp it once you
> fix the comments.
> 

Thank you !


  reply	other threads:[~2026-10-27 21:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 21:46 [PATCH 0/2] mm/kasan: Detect double-free involving kfree_rcu_sheaf() Kuniyuki Iwashima
2026-10-09 21:46 ` [PATCH 1/2] " Kuniyuki Iwashima
2026-10-20 12:29   ` Vlastimil Babka (SUSE)
2026-10-27 12:48   ` Alexander Potapenko
2026-10-27 21:51     ` Kuniyuki Iwashima [this message]
2026-10-09 21:46 ` [PATCH 2/2] mm/kasan/kunit: Add double-free tests " Kuniyuki Iwashima
2026-10-27 12:48   ` Alexander Potapenko
2026-10-27 22:16     ` Kuniyuki Iwashima
2026-10-27  6:15 ` [PATCH 0/2] mm/kasan: Detect double-free " Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auEcseqdxGGelMM3@google.com \
    --to=kuniyu@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=cl@gentwo.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=ryabinin.a.a@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.