From: Andrew Morton <akpm@linux-foundation.org>
To: Usama Arif <usama.arif@linux.dev>
Cc: baohua@kernel.org, baolin.wang@linux.alibaba.com,
david@kernel.org, dev.jain@arm.com, lance.yang@linux.dev,
liam@infradead.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, ljs@kernel.org, npache@redhat.com,
ryan.roberts@arm.com, ziy@nvidia.com, aarcange@redhat.com,
shakeel.butt@linux.dev, hannes@cmpxchg.org, riel@surriel.com,
kernel-team@meta.com, sashiko-bot <sashiko-bot@kernel.org>
Subject: Re: [PATCH] userfaultfd: wait on source PMD during UFFDIO_MOVE
Date: Sun, 5 Jul 2026 12:24:10 -0700 [thread overview]
Message-ID: <20260705122410.d44328f443b63b96bc6280fc@linux-foundation.org> (raw)
In-Reply-To: <20260705131231.1499198-1-usama.arif@linux.dev>
On Sun, 5 Jul 2026 06:12:31 -0700 Usama Arif <usama.arif@linux.dev> wrote:
> move_pages_huge_pmd() snapshots src_pmdval under src_ptl, drops the lock,
> and, for migration entries, waits with pmd_migration_entry_wait().
>
> Passing &src_pmdval is wrong. pmd_migration_entry_wait() must lock and
> re-read the real page-table PMD; on split-PMD-lock kernels, a stack
> address also resolves to the wrong lock. softleaf_entry_wait_on_locked()
> then waits without a folio reference, which is safe only while serialized
> against migration-entry removal by the real PT lock.
>
> Pass src_pmd, matching __handle_mm_fault() and hmm_vma_walk_pmd().
Thanks.
> Reported-by: sashiko-bot <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/patchset/20260703173903.3789516-1-usama.arif%40linux.dev?part=8
Sashiko says "wild spinlock acquisition and memory corruption", so I'll
add a cc:stable to this.
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2775,7 +2775,7 @@ int move_pages_huge_pmd(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd, pm
> if (!pmd_trans_huge(src_pmdval)) {
> spin_unlock(src_ptl);
> if (pmd_is_migration_entry(src_pmdval)) {
> - pmd_migration_entry_wait(mm, &src_pmdval);
> + pmd_migration_entry_wait(mm, src_pmd);
> return -EAGAIN;
> }
> return -ENOENT;
next prev parent reply other threads:[~2026-07-05 19:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 13:12 [PATCH] userfaultfd: wait on source PMD during UFFDIO_MOVE Usama Arif
2026-07-05 19:08 ` Rik van Riel
2026-07-05 19:24 ` Andrew Morton [this message]
2026-07-06 1:05 ` Baolin Wang
2026-07-06 2:18 ` Lance Yang
2026-07-06 9:00 ` David Hildenbrand (Arm)
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=20260705122410.d44328f443b63b96bc6280fc@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=npache@redhat.com \
--cc=riel@surriel.com \
--cc=ryan.roberts@arm.com \
--cc=sashiko-bot@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=usama.arif@linux.dev \
--cc=ziy@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox