mm-userfaultfd-dont-consider-uffd-wp-bit-of-writable-migration-entries.patch removed from -mm tree
The quilt patch titled
Subject: mm/userfaultfd: don't consider uffd-wp bit of writable migration entries
has been removed from the -mm tree. Its filename was
mm-userfaultfd-dont-consider-uffd-wp-bit-of-writable-migration-entries.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: David Hildenbrand <[email protected]>
Subject: mm/userfaultfd: don't consider uffd-wp bit of writable migration entries
Date: Wed, 5 Apr 2023 18:02:36 +0200
If we end up with a writable migration entry that has the uffd-wp bit set, we already messed up: the source PTE/PMD was writable, which means we could have modified the page without notifying uffd first. Setting the uffd-wp bit always implies converting migration entries to !writable migration entries.
Commit 8f34f1eac382 ("mm/userfaultfd: fix uffd-wp special cases for fork()") documents that "3. Forget to carry over uffd-wp bit for a write migration huge pmd entry", but it doesn't really say why that should be relevant.
So let's remove that code to avoid hiding an eventual underlying issue (in the future, we might want to warn when creating writable migration entries that have the uffd-wp bit set -- or even better when turning a PTE writable that still has the uffd-wp bit set).
This now matches the handling for hugetlb migration entries in hugetlb_change_protection().
In copy_huge_pmd()/copy_nonpresent_pte()/copy_hugetlb_page_range(), we still transfer the uffd-bit also for writable migration entries, but simply because we have unified handling for "writable" and "readable-exclusive" migration entries, and we care about transferring the uffd-wp bit for the latter.
---
mm/huge_memory.c | 2 -- mm/mprotect.c | 2 -- 2 files changed, 4 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-userfaultfd-dont-consider-uffd-wp-bit-of-writable-migration-entries +0 -2
@@ -1845,8 +1845,6 @@ int change_huge_pmd(struct mmu_gather *t newpmd =swp_entry_to_pmd (entry);if (pmd_swp_soft_dirty (*pmd)) newpmd =pmd_swp_mksoft_dirty (newpmd); -if (pmd_swp_uffd_wp (*pmd)) - newpmd =pmd_swp_mkuffd_wp (newpmd); }else { newpmd = *pmd; }
mm/mprotect.c renamed from mm/mprotect.c~mm-userfaultfd-dont-consider-uffd-wp-bit-of-writable-migration-entries +0 -2
@@ -223,8 +223,6 @@ static long change_pte_range(struct mmu_ newpte =swp_entry_to_pte (entry);if (pte_swp_soft_dirty (oldpte)) newpte =pte_swp_mksoft_dirty (newpte); -if (pte_swp_uffd_wp (oldpte)) - newpte =pte_swp_mkuffd_wp (newpte); }else if (is_writable_device_private_entry (entry)) {/* * We do not preserve soft-dirtiness. See
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-reuse-read_pmd_pagesize-in-cow-selftest.patch selftests-mm-mkdirty-test-behavior-of-ptepmd_mkdirty-on-vmas-without-write-permissions.patch sparc-mm-dont-unconditionally-set-hw-writable-bit-when-setting-pte-dirty-on-64bit.patch mm-migrate-revert-mm-migrate-fix-wrongly-apply-write-bit-after-mkdirty-on-sparc64.patch mm-huge_memory-revert-partly-revert-mm-thp-carry-over-dirty-bit-when-thp-splits-on-pmd.patch mm-huge_memory-conditionally-call-maybe_mkwrite-and-drop-pte_wrprotect-in-__split_huge_pmd_locked.patch mm-dont-check-vma-write-permissions-if-the-pte-pmd-indicates-write-permissions.patch