linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	 Rik van Riel <riel@surriel.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	 Vlastimil Babka <vbabka@suse.cz>,
	Harry Yoo <harry.yoo@oracle.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/rmap: Add anon_vma lifetime debug check
Date: Fri, 25 Jul 2025 17:27:09 +0200	[thread overview]
Message-ID: <CAG48ez2U5SSpRANKmUHmZkj62tDa3tYA06jem-i0G3pDGMJToA@mail.gmail.com> (raw)
In-Reply-To: <f3e77eed-10b9-4197-b381-91c4ea3fc576@lucifer.local>

On Fri, Jul 25, 2025 at 5:22 PM Lorenzo Stoakes
<lorenzo.stoakes@oracle.com> wrote:
> On Fri, Jul 25, 2025 at 05:15:45PM +0200, Jann Horn wrote:
> > On Fri, Jul 25, 2025 at 5:07 PM Lorenzo Stoakes
> > <lorenzo.stoakes@oracle.com> wrote:
> > Basically CONFIG_SLUB_RCU_DEBUG turns kmem_cache_free() on
> > SLAB_TYPESAFE_BY_RCU slabs into something like kfree_rcu(), and this
> > allows KASAN to catch UAF access.
> >
> > > It's surely only UAF?
> >
> > I mean, "UAF" is kind of vague when talking about SLAB_TYPESAFE_BY_RCU
> > slabs. I am only using the term "UAF" when talking about a situation
> > where accessing the anon_vma object is entirely forbidden because an
> > RCU grace period has passed after it was "freed" with
> > kmem_cache_free().
>
> Could it not be either case? Or are we sure it's been accessed within that grace
> period?

If there is a bug here, it could be either case. The check covers both
cases in CONFIG_SLUB_RCU_DEBUG builds (as long as the object hasn't
already moved all the way through the KASAN quarantine, the usual
KASAN caveat). Note that atomic_read() implicitly causes KASAN to
check that the object is still accessible.


  reply	other threads:[~2025-07-25 15:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 19:13 Jann Horn
2025-07-24 21:52 ` Andrew Morton
2025-07-25 10:59   ` Jann Horn
2025-07-24 21:56 ` David Hildenbrand
2025-07-25 11:08   ` Jann Horn
2025-07-25 11:12     ` David Hildenbrand
2025-07-25 11:24       ` Jann Horn
2025-07-25 11:31         ` David Hildenbrand
2025-07-25 11:32 ` Lorenzo Stoakes
2025-07-25 12:00   ` Jann Horn
2025-07-25 13:48     ` Lorenzo Stoakes
2025-07-25 14:10       ` Lorenzo Stoakes
2025-07-25 14:50         ` Jann Horn
2025-07-25 14:48       ` Jann Horn
2025-07-25 15:07         ` Lorenzo Stoakes
2025-07-25 15:15           ` Jann Horn
2025-07-25 15:22             ` Lorenzo Stoakes
2025-07-25 15:27               ` Jann Horn [this message]
2025-07-25 15:58           ` Lorenzo Stoakes
2025-07-25 15:05   ` Jann Horn

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=CAG48ez2U5SSpRANKmUHmZkj62tDa3tYA06jem-i0G3pDGMJToA@mail.gmail.com \
    --to=jannh@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=harry.yoo@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=riel@surriel.com \
    --cc=vbabka@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox