* + userfaultfd-preserve-write-protection-across-uffdio_move.patch added to mm-hotfixes-unstable branch
@ 2026-04-12 18:20 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-04-12 18:20 UTC (permalink / raw)
To: mm-commits, surenb, stable, rppt, peterx, aarcange, gourry, akpm
The patch titled
Subject: userfaultfd: preserve write protection across UFFDIO_MOVE
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
userfaultfd-preserve-write-protection-across-uffdio_move.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/userfaultfd-preserve-write-protection-across-uffdio_move.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Gregory Price <gourry@gourry.net>
Subject: userfaultfd: preserve write protection across UFFDIO_MOVE
Date: Thu, 9 Apr 2026 11:28:22 -0400
move_present_ptes() unconditionally makes the destination PTE writable,
dropping uffd-wp write-protection from the source PTE.
The original intent was to follow mremap() behavior, but mremap()'s
move_ptes() preserves the source write state unconditionally.
Modify uffd to preserve the source write state and check the uffd-wp
condition of the source before setting writable on the destination.
Link: https://lkml.kernel.org/r/20260409152822.1073083-1-gourry@gourry.net
Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
Signed-off-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/userfaultfd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/mm/userfaultfd.c~userfaultfd-preserve-write-protection-across-uffdio_move
+++ a/mm/userfaultfd.c
@@ -1123,7 +1123,10 @@ static long move_present_ptes(struct mm_
orig_dst_pte = pte_mksoft_dirty(orig_dst_pte);
if (pte_dirty(orig_src_pte))
orig_dst_pte = pte_mkdirty(orig_dst_pte);
- orig_dst_pte = pte_mkwrite(orig_dst_pte, dst_vma);
+ if (pte_write(orig_src_pte))
+ orig_dst_pte = pte_mkwrite(orig_dst_pte, dst_vma);
+ if (pte_uffd_wp(orig_src_pte))
+ orig_dst_pte = pte_mkuffd_wp(orig_dst_pte);
set_pte_at(mm, dst_addr, dst_pte, orig_dst_pte);
src_addr += PAGE_SIZE;
_
Patches currently in -mm which might be from gourry@gourry.net are
userfaultfd-preserve-write-protection-across-uffdio_move.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-12 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-12 18:20 + userfaultfd-preserve-write-protection-across-uffdio_move.patch added to mm-hotfixes-unstable branch Andrew Morton
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.