linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	 Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	 Pedro Falcato <pfalcato@suse.de>, Linux-MM <linux-mm@kvack.org>,
	 kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] hard-to-hit mm_struct UAF due to insufficiently careful vma_refcount_put() wrt SLAB_TYPESAFE_BY_RCU
Date: Wed, 23 Jul 2025 19:49:29 +0200	[thread overview]
Message-ID: <CAG48ez1qhjQNHC+3572udqVWHTANFpQ0ngxn_4ZDC9F8NCXsFA@mail.gmail.com> (raw)
In-Reply-To: <16c97e30-19c9-41e8-b73b-c0b3c8eceff3@suse.cz>

On Wed, Jul 23, 2025 at 7:32 PM Vlastimil Babka <vbabka@suse.cz> wrote:
> On 7/23/25 18:26, Jann Horn wrote:
> > There's a racy UAF in `vma_refcount_put()` when called on the
> > `lock_vma_under_rcu()` path because `SLAB_TYPESAFE_BY_RCU` is used
> > without sufficient protection against concurrent object reuse:
>
> Oof.
>
> > I'm not sure what the right fix is; I guess one approach would be to
> > have a special version of vma_refcount_put() for cases where the VMA
> > has been recycled by another MM that grabs an extra reference to the
> > MM? But then dropping a reference to the MM afterwards might be a bit
> > annoying and might require something like mmdrop_async()...
>
> Would we need mmdrop_async()? Isn't this the case for mmget_not_zero() and
> mmput_async()?

Now I'm not sure anymore if either of those approaches would work,
because they rely on the task that's removing the VMA to wait until we
do __refcount_dec_and_test() before deleting the MM... but I don't
think we have any such guarantee...


  reply	other threads:[~2025-07-23 17:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 16:26 Jann Horn
2025-07-23 17:32 ` Vlastimil Babka
2025-07-23 17:49   ` Jann Horn [this message]
2025-07-23 17:55     ` Suren Baghdasaryan
2025-07-23 19:01       ` Lorenzo Stoakes
2025-07-24  0:13         ` Suren Baghdasaryan
2025-07-24  4:40           ` Lorenzo Stoakes
2025-07-23 18:10     ` Vlastimil Babka
2025-07-23 18:19       ` Jann Horn
2025-07-23 18:39         ` Lorenzo Stoakes
2025-07-23 19:52           ` Jann Horn
2025-07-23 20:00             ` Jann Horn
2025-07-24  5:24               ` Lorenzo Stoakes
2025-07-24  5:23             ` Lorenzo Stoakes
2025-07-23 20:27         ` Suren Baghdasaryan
2025-07-24  2:30           ` Suren Baghdasaryan
2025-07-24  8:38             ` Vlastimil Babka
2025-07-24 10:53               ` Lorenzo Stoakes
2025-07-24 14:29                 ` Suren Baghdasaryan
2025-07-24 14:45                   ` Vlastimil Babka
2025-07-24 14:52                     ` Suren Baghdasaryan
2025-07-24 14:45               ` Jann Horn
2025-07-24 16:36                 ` Suren Baghdasaryan
2025-07-28 17:14                   ` Suren Baghdasaryan
2025-07-23 18:14 ` Lorenzo Stoakes
2025-07-23 18:30   ` Jann Horn
2025-07-23 18:45     ` Lorenzo Stoakes
2025-07-23 19:43       ` Jann Horn
2025-07-24  5:13         ` Lorenzo Stoakes
2025-07-24 14:50           ` Jann Horn
2025-07-24 14:56             ` Lorenzo Stoakes

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=CAG48ez1qhjQNHC+3572udqVWHTANFpQ0ngxn_4ZDC9F8NCXsFA@mail.gmail.com \
    --to=jannh@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=pfalcato@suse.de \
    --cc=surenb@google.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