* [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page
2026-11-18 4:28 [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) Tal Zussman
@ 2026-11-18 4:28 ` Tal Zussman
2026-11-18 9:40 ` David Hildenbrand (Arm)
2026-11-18 14:52 ` Mike Rapoport
2026-11-18 9:41 ` [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) David Hildenbrand (Arm)
` (3 subsequent siblings)
4 siblings, 2 replies; 10+ messages in thread
From: Tal Zussman @ 2026-11-18 4:28 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, James Houghton,
Andrea Arcangeli, Suren Baghdasaryan, Balbir Singh,
Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka, Jann Horn,
Pedro Falcato, David Hildenbrand, Michal Hocko,
Michał Mirosław, Andrei Vagin, Muhammad Usama Anjum,
Stephen Rothwell, Arnd Bergmann, Zi Yan, Matthew Brost,
Joshua Hahn, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain,
Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau, Muchun Song,
Oscar Salvador, Mikołaj Lenczewski
Cc: linux-mm, linux-kernel, linux-fsdevel, Thomas Hellström,
Lyude Paul, Danilo Krummrich, Felix Kuehling, Jason Gunthorpe,
Leon Romanovsky, dri-devel, intel-xe, nouveau, amd-gfx,
Tal Zussman
Device migration replaces a PTE that maps the zero page with a new PTE
that is built only from the VMA flags, so its userfaultfd WP or RWP
protection is lost. The same applies to the huge zero PMD. Writes and
accesses to the page are then no longer reported to userfaultfd.
To fix it, do not migrate a uffd-protected zero page. Skip it during
collection, and check again under the page table lock before inserting,
as another thread can protect the page after it was collected.
The alternative would be to carry the uffd state over to the new entry,
but a uffd-protected zero page in a range that a driver migrates should
be rare.
While at it, read the PMD once with pmdp_get() in
migrate_vma_collect_huge_pmd().
Fixes: 292924b26024 ("userfaultfd: wp: apply _PAGE_UFFD_WP bit")
Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
include/linux/userfaultfd_k.h | 24 ++++++++++++++++++++++++
mm/migrate_device.c | 34 ++++++++++++++++++++++++++--------
2 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index 5768a3902c7c..54850cdabf5e 100644
--- a/include/linux/userfaultfd_k.h
+++ b/include/linux/userfaultfd_k.h
@@ -246,6 +246,18 @@ static inline bool userfaultfd_huge_pmd_rwp(struct vm_area_struct *vma,
return userfaultfd_rwp(vma) && pmd_uffd(pmd);
}
+static inline bool userfaultfd_pte_protected(struct vm_area_struct *vma,
+ pte_t pte)
+{
+ return userfaultfd_protected(vma) && pte_uffd(pte);
+}
+
+static inline bool userfaultfd_huge_pmd_protected(struct vm_area_struct *vma,
+ pmd_t pmd)
+{
+ return userfaultfd_protected(vma) && pmd_uffd(pmd);
+}
+
static inline bool userfaultfd_armed(struct vm_area_struct *vma)
{
return vma_test_any_mask(vma, __VMA_UFFD_FLAGS);
@@ -390,6 +402,18 @@ static inline bool userfaultfd_huge_pmd_rwp(struct vm_area_struct *vma,
return false;
}
+static inline bool userfaultfd_pte_protected(struct vm_area_struct *vma,
+ pte_t pte)
+{
+ return false;
+}
+
+static inline bool userfaultfd_huge_pmd_protected(struct vm_area_struct *vma,
+ pmd_t pmd)
+{
+ return false;
+}
+
static inline bool userfaultfd_armed(struct vm_area_struct *vma)
{
return false;
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 9e19fadfa65c..60985e9bec8b 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -142,30 +142,38 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
struct folio *folio;
struct migrate_vma *migrate = walk->private;
spinlock_t *ptl;
+ pmd_t pmd;
int ret;
unsigned long write = 0;
ptl = pmd_lock(mm, pmdp);
- if (pmd_none(*pmdp)) {
+ pmd = pmdp_get(pmdp);
+ if (pmd_none(pmd)) {
spin_unlock(ptl);
return migrate_vma_collect_hole(start, end, -1, walk);
}
- if (pmd_trans_huge(*pmdp)) {
+ if (pmd_trans_huge(pmd)) {
if (!(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) {
spin_unlock(ptl);
return migrate_vma_collect_skip(start, end, walk);
}
- folio = pmd_folio(*pmdp);
+ folio = pmd_folio(pmd);
if (is_huge_zero_folio(folio)) {
spin_unlock(ptl);
+ /*
+ * Nothing carries the uffd state of the zero page
+ * over, so skip it if its uffd bit is set.
+ */
+ if (userfaultfd_huge_pmd_protected(walk->vma, pmd))
+ return migrate_vma_collect_skip(start, end, walk);
return migrate_vma_collect_hole(start, end, -1, walk);
}
- if (pmd_write(*pmdp))
+ if (pmd_write(pmd))
write = MIGRATE_PFN_WRITE;
- } else if (!pmd_present(*pmdp)) {
- const softleaf_t entry = softleaf_from_pmd(*pmdp);
+ } else if (!pmd_present(pmd)) {
+ const softleaf_t entry = softleaf_from_pmd(pmd);
if (!softleaf_is_device_private(entry) ||
!(migrate->flags & MIGRATE_VMA_SELECT_DEVICE_PRIVATE)) {
@@ -337,6 +345,9 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
pfn = pte_pfn(pte);
if (is_zero_pfn(pfn) &&
(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) {
+ /* See migrate_vma_collect_huge_pmd(). */
+ if (userfaultfd_pte_protected(vma, pte))
+ goto next;
mpfn = MIGRATE_PFN_MIGRATE;
migrate->cpages++;
goto next;
@@ -871,10 +882,14 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,
if (userfaultfd_missing(vma))
goto unlock_abort;
- if (is_huge_zero_pmd(*pmdp))
+ if (is_huge_zero_pmd(*pmdp)) {
+ /* The uffd bit can have been set since the collection. */
+ if (userfaultfd_huge_pmd_protected(vma, *pmdp))
+ goto unlock_abort;
flush = true;
- else if (!pmd_none(*pmdp))
+ } else if (!pmd_none(*pmdp)) {
goto unlock_abort;
+ }
add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR);
folio_add_new_anon_rmap(folio, vma, addr, RMAP_EXCLUSIVE);
@@ -1074,6 +1089,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
if (!is_zero_pfn(pfn))
goto unlock_abort;
+ /* The uffd bit can have been set since the collection. */
+ if (userfaultfd_pte_protected(vma, orig_pte))
+ goto unlock_abort;
flush = true;
} else if (!pte_none(orig_pte))
goto unlock_abort;
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page
2026-11-18 4:28 ` [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page Tal Zussman
@ 2026-11-18 9:40 ` David Hildenbrand (Arm)
2026-11-18 14:52 ` Mike Rapoport
1 sibling, 0 replies; 10+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-18 9:40 UTC (permalink / raw)
To: Tal Zussman, Andrew Morton, Mike Rapoport, Peter Xu,
James Houghton, Andrea Arcangeli, Suren Baghdasaryan,
Balbir Singh, Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka,
Jann Horn, Pedro Falcato, Michal Hocko, Michał Mirosław,
Andrei Vagin, Muhammad Usama Anjum, Stephen Rothwell,
Arnd Bergmann, Zi Yan, Matthew Brost, Joshua Hahn, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, Baolin Wang,
Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
Usama Arif, Kiryl Shutsemau, Muchun Song, Oscar Salvador,
Mikołaj Lenczewski
Cc: linux-mm, linux-kernel, linux-fsdevel, Thomas Hellström,
Lyude Paul, Danilo Krummrich, Felix Kuehling, Jason Gunthorpe,
Leon Romanovsky, dri-devel, intel-xe, nouveau, amd-gfx
On 11/18/26 05:28, Tal Zussman wrote:
> Device migration replaces a PTE that maps the zero page with a new PTE
> that is built only from the VMA flags, so its userfaultfd WP or RWP
> protection is lost. The same applies to the huge zero PMD. Writes and
> accesses to the page are then no longer reported to userfaultfd.
>
> To fix it, do not migrate a uffd-protected zero page. Skip it during
> collection, and check again under the page table lock before inserting,
> as another thread can protect the page after it was collected.
>
> The alternative would be to carry the uffd state over to the new entry,
> but a uffd-protected zero page in a range that a driver migrates should
> be rare.
>
> While at it, read the PMD once with pmdp_get() in
> migrate_vma_collect_huge_pmd().
>
> Fixes: 292924b26024 ("userfaultfd: wp: apply _PAGE_UFFD_WP bit")
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: dri-devel@lists.freedesktop.org
> Cc: intel-xe@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
> Reviewed-by: Alistair Popple <apopple@nvidia.com>
> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page
2026-11-18 4:28 ` [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page Tal Zussman
2026-11-18 9:40 ` David Hildenbrand (Arm)
@ 2026-11-18 14:52 ` Mike Rapoport
1 sibling, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2026-11-18 14:52 UTC (permalink / raw)
To: Tal Zussman
Cc: Andrew Morton, Peter Xu, James Houghton, Andrea Arcangeli,
Suren Baghdasaryan, Balbir Singh, Liam R. Howlett,
Lorenzo Stoakes, Vlastimil Babka, Jann Horn, Pedro Falcato,
David Hildenbrand, Michal Hocko, Michał Mirosław,
Andrei Vagin, Muhammad Usama Anjum, Stephen Rothwell,
Arnd Bergmann, Zi Yan, Matthew Brost, Joshua Hahn, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, Baolin Wang,
Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
Usama Arif, Kiryl Shutsemau, Muchun Song, Oscar Salvador,
Mikołaj Lenczewski, linux-mm, linux-kernel, linux-fsdevel,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On Tue, Nov 17, 2026 at 11:28:48PM -0500, Tal Zussman wrote:
> Device migration replaces a PTE that maps the zero page with a new PTE
> that is built only from the VMA flags, so its userfaultfd WP or RWP
> protection is lost. The same applies to the huge zero PMD. Writes and
> accesses to the page are then no longer reported to userfaultfd.
>
> To fix it, do not migrate a uffd-protected zero page. Skip it during
> collection, and check again under the page table lock before inserting,
> as another thread can protect the page after it was collected.
>
> The alternative would be to carry the uffd state over to the new entry,
> but a uffd-protected zero page in a range that a driver migrates should
> be rare.
>
> While at it, read the PMD once with pmdp_get() in
> migrate_vma_collect_huge_pmd().
>
> Fixes: 292924b26024 ("userfaultfd: wp: apply _PAGE_UFFD_WP bit")
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: dri-devel@lists.freedesktop.org
> Cc: intel-xe@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
> Reviewed-by: Alistair Popple <apopple@nvidia.com>
> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> include/linux/userfaultfd_k.h | 24 ++++++++++++++++++++++++
> mm/migrate_device.c | 34 ++++++++++++++++++++++++++--------
> 2 files changed, 50 insertions(+), 8 deletions(-)
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/9] userfaultfd: assorted fixes (part 1)
2026-11-18 4:28 [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) Tal Zussman
2026-11-18 4:28 ` [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page Tal Zussman
@ 2026-11-18 9:41 ` David Hildenbrand (Arm)
[not found] ` <7d31ba34-8b5f-4eb2-9864-145ea80c3412@columbia.edu>
2026-11-18 15:19 ` (subset) " David Hildenbrand
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-18 9:41 UTC (permalink / raw)
To: Tal Zussman, Andrew Morton, Mike Rapoport, Peter Xu,
James Houghton, Andrea Arcangeli, Suren Baghdasaryan,
Balbir Singh, Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka,
Jann Horn, Pedro Falcato, Michal Hocko, Michał Mirosław,
Andrei Vagin, Muhammad Usama Anjum, Stephen Rothwell,
Arnd Bergmann, Zi Yan, Matthew Brost, Joshua Hahn, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, Baolin Wang,
Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
Usama Arif, Kiryl Shutsemau, Muchun Song, Oscar Salvador,
Mikołaj Lenczewski
Cc: linux-mm, linux-kernel, linux-fsdevel, stable, Breno Leitao,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On 11/18/26 05:28, Tal Zussman wrote:
> This is a first batch of userfaultfd fixes, with more to come.
>
> These were found by a mix of regular old LLM review and by having an LLM
> write a TLA+ model of uffd interactions with PTE bits and other state
> and seeing what issues fell out.
>
> Most of these fix places where mm code loses uffd-wp or RWP protection
> while moving or migrating an entry. Userspace then either misses writes
> and accesses, or gets pages reported that nobody touched.
> There is also a hang in UFFDIO_MOVE, and UFFDIO_ZEROPAGE modifying a
> file through a private mapping.
>
> Patches 1-2: UFFDIO_ZEROPAGE and UFFDIO_MOVE fixes, cc stable
> Patch 3: PAGEMAP_SCAN write-protect vs. writable migration
> entries, cc stable
> Patch 4: warn on a writable migration entry with the uffd bit set
> Patch 5: PAGEMAP_SCAN write-protect vs. device-private THPs
> Patch 6: UFFDIO_MOVE of the huge zero page from an RWP source
> Patch 7: mremap() losing uffd state when a move fails halfway
> Patch 8: migrate_vma losing uffd state of a zero page
> Patch 9: hugetlb alignment checks in UFFDIO_REGISTER and
> UFFDIO_UNREGISTER
>
> A few of the fixes change what userspace sees:
>
> - UFFDIO_ZEROPAGE on a private file mapping no longer fails with
> -EEXIST where the file already has a page, on an mm that cannot use
> the zero page (patch 1)
> - UFFDIO_MOVE returns -EEXIST for any huge destination PMD, not only
> for a present THP (patch 2)
> - UFFDIO_UNREGISTER with a misaligned hugetlb end fails before
> unregistering anything, also if that hugetlb VMA is not registered
> (patch 9)
> - UFFDIO_REGISTER and UFFDIO_UNREGISTER accept a misaligned start that
> lies in a gap before the first hugetlb VMA of the range (patch 9)
> - UFFDIO_REGISTER returns -EINVAL rather than -EPERM for a misaligned
> end in a hugetlb VMA without VM_MAYWRITE (patch 9)
>
> Patch 6 has little user impact on its own. It is included because,
> together with patch 7, it allows removing clear_uffd_wp_pmd().
>
> Patch 7 adds spurious write faults on shmem and hugetlb after mremap():
> when dropping uffd protection there, change_protection() makes writable
> pages that were never protected read-only. UFFDIO_UNREGISTER and
> UFFDIO_WRITEPROTECT already behave this way and lead to the same
> spurious faults. This will be fixed in change_protection() in a separate
> series.
>
> Based on mm-new.
>
> ---
> Changes in v3:
> - Collect tags (Thanks David!)
> - Patch 1: use vma_is_cow_mapping(), per David
> - Patch 4: warn on a writable migration entry with the uffd bit set, and
> make the PMD path match the PTE path, per David.
> - Patch 4: Drop the Fixes: tag and the review tags due to changes
> - Patch 8: add helpers and read the PMD once with pmdp_get(), per
> David
> - Patch 9: move the hugetlb alignment checks into a helper and use it in
> both ioctls, per David
> - Link to v2: https://patch.msgid.link/20261116-uffd-state-fixes-v2-0-4397a0196479@columbia.edu
>
> Changes in v2:
> - Collect tags (Thanks Kiryl, Lorenzo, Gregory, Alistair!)
> - Patch 2: say "softleaf entry" in the commit message, per Lorenzo
> - Patch 3: add softleaf_is_writable() and softleaf_mkreadable() to
> leafops.h and rename the helpers to say softleaf, per Lorenzo
> - Patch 3: add Reported-by and Closes for Breno's report, and cc stable
> - Patch 4: explain in the commit message how PAGEMAP_SCAN set the uffd
> bit on writable migration entries, per Lorenzo
> - Patch 5: use pmd_is_valid_softleaf() rather than open-coding it, per
> Lorenzo
> - Patch 7: say "write faults" rather than "minor faults" in the commit
> message, per Kiryl
> - Patch 7: trim the commit message, per Lorenzo and Gregory
> - Patch 8: trim the commit message, per Gregory
> - Patch 8: Cc the GPU driver maintainers and lists, per Gregory and
> Alistair
> - Patch 9: use IS_ALIGNED() and a local variable for the VMA's ctx, and
> shorten the comment, per Lorenzo
> - Drop the three guard region patches, per Lorenzo
> - Link to v1: https://patch.msgid.link/20261111-uffd-state-fixes-v1-0-00713d368976@columbia.edu
>
> ---
So, I would be picking up ...
> Tal Zussman (9):
> userfaultfd: use anonymous memory for UFFDIO_ZEROPAGE on private file mappings
> userfaultfd: refuse UFFDIO_MOVE into a non-present huge destination PMD
> fs/proc/task_mmu: downgrade writable migration entries in PAGEMAP_SCAN write-protect
> mm/migrate: warn on a writable migration entry with the uffd bit set
This
> fs/proc/task_mmu: write-protect device-private THPs in PAGEMAP_SCAN
> mm/huge_memory: build the moved huge zero PMD from the destination VMA
This
> mm/mremap: resolve uffd state when the context is dropped, not during the move
> mm/migrate_device: do not migrate a uffd-protected zero page
This
> mm/userfaultfd: check the hugetlb alignment of every VMA in the pre-scan
After waiting a bit longer for more review. Andrew can take the rest.
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: (subset) [PATCH v3 0/9] userfaultfd: assorted fixes (part 1)
2026-11-18 4:28 [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) Tal Zussman
2026-11-18 4:28 ` [PATCH v3 8/9] mm/migrate_device: do not migrate a uffd-protected zero page Tal Zussman
2026-11-18 9:41 ` [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) David Hildenbrand (Arm)
@ 2026-11-18 15:19 ` David Hildenbrand
2026-11-18 15:20 ` David Hildenbrand
2026-11-18 15:21 ` David Hildenbrand
4 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2026-11-18 15:19 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, James Houghton,
Andrea Arcangeli, Suren Baghdasaryan, Balbir Singh,
Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka, Jann Horn,
Pedro Falcato, David Hildenbrand, Michal Hocko,
Michał Mirosław, Andrei Vagin, Muhammad Usama Anjum,
Stephen Rothwell, Arnd Bergmann, Zi Yan, Matthew Brost,
Joshua Hahn, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain,
Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau, Muchun Song,
Oscar Salvador, Mikołaj Lenczewski, Tal Zussman
Cc: linux-mm, linux-kernel, linux-fsdevel, stable, Breno Leitao,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On Tue, 17 Nov 2026 23:28:40 -0500, Tal Zussman wrote:
> This is a first batch of userfaultfd fixes, with more to come.
>
> These were found by a mix of regular old LLM review and by having an LLM
> write a TLA+ model of uffd interactions with PTE bits and other state
> and seeing what issues fell out.
>
> Most of these fix places where mm code loses uffd-wp or RWP protection
> while moving or migrating an entry. Userspace then either misses writes
> and accesses, or gets pages reported that nobody touched.
> There is also a hang in UFFDIO_MOVE, and UFFDIO_ZEROPAGE modifying a
> file through a private mapping.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: migrate-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[4/9] mm/migrate: warn on a writable migration entry with the uffd bit set
https://git.kernel.org/mm/core/c/ec53fccd
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: (subset) [PATCH v3 0/9] userfaultfd: assorted fixes (part 1)
2026-11-18 4:28 [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) Tal Zussman
` (2 preceding siblings ...)
2026-11-18 15:19 ` (subset) " David Hildenbrand
@ 2026-11-18 15:20 ` David Hildenbrand
2026-11-18 15:37 ` David Hildenbrand (Arm)
2026-11-18 15:21 ` David Hildenbrand
4 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand @ 2026-11-18 15:20 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, James Houghton,
Andrea Arcangeli, Suren Baghdasaryan, Balbir Singh,
Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka, Jann Horn,
Pedro Falcato, David Hildenbrand, Michal Hocko,
Michał Mirosław, Andrei Vagin, Muhammad Usama Anjum,
Stephen Rothwell, Arnd Bergmann, Zi Yan, Matthew Brost,
Joshua Hahn, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain,
Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau, Muchun Song,
Oscar Salvador, Mikołaj Lenczewski, Tal Zussman
Cc: linux-mm, linux-kernel, linux-fsdevel, stable, Breno Leitao,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On Tue, 17 Nov 2026 23:28:40 -0500, Tal Zussman wrote:
> This is a first batch of userfaultfd fixes, with more to come.
>
> These were found by a mix of regular old LLM review and by having an LLM
> write a TLA+ model of uffd interactions with PTE bits and other state
> and seeing what issues fell out.
>
> Most of these fix places where mm code loses uffd-wp or RWP protection
> while moving or migrating an entry. Userspace then either misses writes
> and accesses, or gets pages reported that nobody touched.
> There is also a hang in UFFDIO_MOVE, and UFFDIO_ZEROPAGE modifying a
> file through a private mapping.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: thp-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[6/9] mm/huge_memory: build the moved huge zero PMD from the destination VMA
https://git.kernel.org/mm/core/c/ec36bf72
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: (subset) [PATCH v3 0/9] userfaultfd: assorted fixes (part 1)
2026-11-18 15:20 ` David Hildenbrand
@ 2026-11-18 15:37 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-18 15:37 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, James Houghton,
Andrea Arcangeli, Suren Baghdasaryan, Balbir Singh,
Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka, Jann Horn,
Pedro Falcato, Michal Hocko, Michał Mirosław,
Andrei Vagin, Muhammad Usama Anjum, Stephen Rothwell,
Arnd Bergmann, Zi Yan, Matthew Brost, Joshua Hahn, Byungchul Park,
Gregory Price, Ying Huang, Alistair Popple, Baolin Wang,
Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
Usama Arif, Kiryl Shutsemau, Muchun Song, Oscar Salvador,
Mikołaj Lenczewski, Tal Zussman
Cc: linux-mm, linux-kernel, linux-fsdevel, stable, Breno Leitao,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On 11/18/26 16:20, David Hildenbrand wrote:
> On Tue, 17 Nov 2026 23:28:40 -0500, Tal Zussman wrote:
>> This is a first batch of userfaultfd fixes, with more to come.
>>
>> These were found by a mix of regular old LLM review and by having an LLM
>> write a TLA+ model of uffd interactions with PTE bits and other state
>> and seeing what issues fell out.
>>
>> Most of these fix places where mm code loses uffd-wp or RWP protection
>> while moving or migrating an entry. Userspace then either misses writes
>> and accesses, or gets pages reported that nobody touched.
>> There is also a hang in UFFDIO_MOVE, and UFFDIO_ZEROPAGE modifying a
>> file through a private mapping.
>>
>> [...]
>
> Applied, thanks!
>
> tree: mm/core.git
> branch: thp-7.5.misc
>
> Applied patches will appear soon in mm-next, followed by linux-next.
>
> Please report any outstanding bugs that were missed during review, so we
> can either drop the patch series or decide how to fix it up.
>
> It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
> though the patches have already been applied. If possible, patch trailers
> will be updated.
>
> Note that commit hashes shown below are subject to change due to rebase,
> trailer updates or similar. Further, this is not a guarantee that the
> patches will go upstream. If in doubt, please check the listed branch.
>
> [6/9] mm/huge_memory: build the moved huge zero PMD from the destination VMA
> https://git.kernel.org/mm/core/c/ec36bf72
Aaaaaand undone. :)
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH v3 0/9] userfaultfd: assorted fixes (part 1)
2026-11-18 4:28 [PATCH v3 0/9] userfaultfd: assorted fixes (part 1) Tal Zussman
` (3 preceding siblings ...)
2026-11-18 15:20 ` David Hildenbrand
@ 2026-11-18 15:21 ` David Hildenbrand
4 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2026-11-18 15:21 UTC (permalink / raw)
To: Andrew Morton, Mike Rapoport, Peter Xu, James Houghton,
Andrea Arcangeli, Suren Baghdasaryan, Balbir Singh,
Liam R. Howlett, Lorenzo Stoakes, Vlastimil Babka, Jann Horn,
Pedro Falcato, David Hildenbrand, Michal Hocko,
Michał Mirosław, Andrei Vagin, Muhammad Usama Anjum,
Stephen Rothwell, Arnd Bergmann, Zi Yan, Matthew Brost,
Joshua Hahn, Byungchul Park, Gregory Price, Ying Huang,
Alistair Popple, Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain,
Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau, Muchun Song,
Oscar Salvador, Mikołaj Lenczewski, Tal Zussman
Cc: linux-mm, linux-kernel, linux-fsdevel, stable, Breno Leitao,
Thomas Hellström, Lyude Paul, Danilo Krummrich,
Felix Kuehling, Jason Gunthorpe, Leon Romanovsky, dri-devel,
intel-xe, nouveau, amd-gfx
On Tue, 17 Nov 2026 23:28:40 -0500, Tal Zussman wrote:
> This is a first batch of userfaultfd fixes, with more to come.
>
> These were found by a mix of regular old LLM review and by having an LLM
> write a TLA+ model of uffd interactions with PTE bits and other state
> and seeing what issues fell out.
>
> Most of these fix places where mm code loses uffd-wp or RWP protection
> while moving or migrating an entry. Userspace then either misses writes
> and accesses, or gets pages reported that nobody touched.
> There is also a hang in UFFDIO_MOVE, and UFFDIO_ZEROPAGE modifying a
> file through a private mapping.
>
> [...]
Applied, thanks!
tree: mm/core.git
branch: migrate-7.5.misc
Applied patches will appear soon in mm-next, followed by linux-next.
Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.
It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.
[8/9] mm/migrate_device: do not migrate a uffd-protected zero page
https://git.kernel.org/mm/core/c/a37a6cf0
--
Cheers,
David
^ permalink raw reply [flat|nested] 10+ messages in thread