Skip to contentSkip to conversation

mm-pagemap-fix-wr-protect-even-if-pm_scan_wp_matching-not-set.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Dec 7, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/pagemap: fix wr-protect even if PM_SCAN_WP_MATCHING not set
has been removed from the -mm tree. Its filename was
mm-pagemap-fix-wr-protect-even-if-pm_scan_wp_matching-not-set.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Peter Xu <[email protected]>
Subject: mm/pagemap: fix wr-protect even if PM_SCAN_WP_MATCHING not set
Date: Thu, 16 Nov 2023 15:15:46 -0500

The new pagemap ioctl contains a fast path for wr-protections without looking into category masks. It forgets to check PM_SCAN_WP_MATCHING before applying the wr-protections. It can cause, e.g., pte markers installed on archs that do not even support uffd wr-protect.

WARNING: CPU: 0 PID: 5059 at mm/memory.c:1520 zap_pte_range mm/memory.c:1520 [inline]
Fixes 12f6b01a0bcb ("fs/proc/task_mmu: add fast paths to get/clear PAGE_IS_WRITTEN flag")
Reported-by [email protected]
Cc Muhammad Usama Anjum <[email protected]>

---

 fs/proc/task_mmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~mm-pagemap-fix-wr-protect-even-if-pm_scan_wp_matching-not-set +1 -1
@@ -2156,7 +2156,7 @@ static int pagemap_scan_pmd_entry(pmd_t
 		return 0;
 	}
 
-	if (!p->vec_out) {
+	if ((p->arg.flags & PM_SCAN_WP_MATCHING) && !p->vec_out) {
 		/* Fast path for performing exclusive WP */
 		for (addr = start; addr != end; pte++, addr += PAGE_SIZE) {
 			if (pte_uffd_wp(ptep_get(pte)))

_

Patches currently in -mm which might be from [email protected] are

fs-kconfig-make-hugetlbfs-a-menuconfig.patch mm-gup-fix-follow_devmap_pd-on-page==null-handling.patch