All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: jthoughton@google.com, akpm@linux-foundation.org
Cc: lance.yang@linux.dev, david@kernel.org, ljs@kernel.org,
	ziy@nvidia.com, baolin.wang@linux.alibaba.com,
	liam@infradead.org, nico.pache@linux.dev, ryan.roberts@arm.com,
	dev.jain@arm.com, baohua@kernel.org, usama.arif@linux.dev,
	shy828301@gmail.com, zokeefe@google.com, hughd@google.com,
	kas@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] mm/khugepaged: Don't install PMDs in uffd-minor-registered VMAs
Date: Sat, 29 Aug 2026 12:38:52 +0800	[thread overview]
Message-ID: <20260829043852.45486-1-lance.yang@linux.dev> (raw)
In-Reply-To: <CADrL8HVzfEXgE9OQfULhe6wh1kMMOALsYuCNOUkgBqtzk_LUVg@mail.gmail.com>


On Fri, Aug 28, 2026 at 06:09:39PM -0700, James Houghton wrote:
>On Fri, Aug 28, 2026 at 5:33 PM Andrew Morton <akpm@linux-foundation.org> wrote:
[...]
>> Wondering what Lance tested.  Was he able to reproduce the bug?

Yes!

>I assume he just re-ran my repro, but yeah I'm not sure, heh. Lance,
>what did you test?

In general, I prefer to write my own reproducer from scratch, using
whatever approach works. That's what I did here.

On the parent, MADV_COLLAPSE installed a PMD, and a later
UFFDIO_CONTINUE failed with EEXIST. With v1 applied, MADV_COLLAPSE was
rejected and UFFDIO_CONTINUE succeeded when registration completed
before collapse.

I then extended the reproducer to register the VMA during the mmap lock
drop/reacquire window in collapse. With v1, a PMD was still installed,
and the later UFFDIO_CONTINUE again failed with EEXIST. Adding a
userfaultfd_minor() recheck after reacquiring the lock closed that race.

Before reviewing v2, let's go back to v1 [1] and settle the expected
semantics there first. The check depends on which policy we choose, so
I'd hold off on reviewing v2 until that is resolved :)

[1] https://lore.kernel.org/lkml/20260829041523.43008-1-lance.yang@linux.dev/

>> Sashiko might have found another race in there:
>>
>>         https://sashiko.dev/#/patchset/20260828222640.1638457-1-jthoughton@google.com
>
>Let me get back to you on this. Best case, I'll send another
>(separate) patch. :)

@James please don't send another revision or a separate patch for now.

Cheers, Lance


      parent reply	other threads:[~2026-08-29  4:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 22:26 [PATCH v2] mm/khugepaged: Don't install PMDs in uffd-minor-registered VMAs James Houghton
2026-08-29  0:33 ` Andrew Morton
2026-08-29  1:09   ` James Houghton
2026-08-29  1:18     ` James Houghton
2026-08-29  1:38       ` Andrew Morton
2026-08-29  2:50         ` James Houghton
2026-08-29  1:29     ` Andrew Morton
2026-08-29  4:38     ` Lance Yang [this message]

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=20260829043852.45486-1-lance.yang@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hughd@google.com \
    --cc=jthoughton@google.com \
    --cc=kas@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=nico.pache@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=ziy@nvidia.com \
    --cc=zokeefe@google.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.