Re: [PATCH] userfaultfd: wait on source PMD during UFFDIO_MOVE
From: Lance Yang
Date: Sun Jul 05 2026 - 22:18:21 EST
On 2026/7/5 21:12, Usama Arif 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()
Well spotted!
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().
Reported-by: sashiko-bot <sashiko-bot@xxxxxxxxxx>
Link: https://sashiko.dev/#/patchset/20260703173903.3789516-1-usama.arif%40linux.dev?part=8
Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
---
As Andrew and Baolin pointed out, this should go to stable ;)
With that,
Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>