[merged mm-stable] mm-mprotect-use-walk_page_range_vma-in-mprotect_fixup.patch removed from -mm tree

Andrew Morton <[email protected]> Tue, 28 Jul 2026 21:13:46 -0700
Newsgroups org.kernel.vger.mm-commits
Message-ID <[email protected]>
The quilt patch titled
     Subject: mm: mprotect: use walk_page_range_vma() in mprotect_fixup()
has been removed from the -mm tree.  Its filename was
     mm-mprotect-use-walk_page_range_vma-in-mprotect_fixup.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: Kefeng Wang <[email protected]>
Subject: mm: mprotect: use walk_page_range_vma() in mprotect_fixup()
Date: Thu, 18 Jun 2026 17:28:43 +0800

In mprotect_fixup(), the PROT_NONE PFN permission check uses
walk_page_range() to walk the page table.  Fortunately, the caller always
passes start/end that falls within a single VMA, the do_mprotect_pkey()
iterates per-VMA via for_each_vma_range(), and setup_arg_pages() passes
the whole VMA.

Note, walk_page_test() isn't called in walk_page_range_vma(), however,
prot_none_test() in prot_none_walk_ops always return 0, so it's safe to
replace walk_page_range() with walk_page_range_vma() to eliminate an
unnecessary find_vma() lookup, also remove unneeded prot_none_test() too.

Link: https://lore.kernel.org/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Reviewed-by: Pedro Falcato <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: David Hildenbrand (Arm) <[email protected]>
Cc: Gregory Price <[email protected]>
Cc: Joshua Hahn <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Rakie Kim <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Ying Huang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/mprotect.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

--- a/mm/mprotect.c~mm-mprotect-use-walk_page_range_vma-in-mprotect_fixup
+++ a/mm/mprotect.c
@@ -708,16 +708,9 @@ static int prot_none_hugetlb_entry(pte_t
 		0 : -EACCES;
 }
 
-static int prot_none_test(unsigned long addr, unsigned long next,
-			  struct mm_walk *walk)
-{
-	return 0;
-}
-
 static const struct mm_walk_ops prot_none_walk_ops = {
 	.pte_entry		= prot_none_pte_entry,
 	.hugetlb_entry		= prot_none_hugetlb_entry,
-	.test_walk		= prot_none_test,
 	.walk_lock		= PGWALK_WRLOCK,
 };
 
@@ -753,7 +746,7 @@ mprotect_fixup(struct vma_iterator *vmi,
 	    !vma_flags_test_any_mask(&new_vma_flags, VMA_ACCESS_FLAGS)) {
 		pgprot_t new_pgprot = vm_get_page_prot(newflags);
 
-		error = walk_page_range(current->mm, start, end,
+		error = walk_page_range_vma(vma, start, end,
 				&prot_none_walk_ops, &new_pgprot);
 		if (error)
 			return error;
_

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

mm-introduce-pud_is_huge-helper.patch
mm-mincore-remove-special-handling-for-vm_pfnmap.patch
mm-mincore-remove-special-handling-for-vm_pfnmap-fix.patch
mm-mincore-replace-__get_free_page-with-kmalloc.patch
mm-mincore-remove-xa_is_value-in-mincore_swap.patch
mm-mincore-improve-mincore_hugetlb.patch
mm-mincore-improve-mincore_hugetlb-fix.patch
mm-mincore-refactor-mincore_page.patch