Skip to contentSkip to conversation

mm-disallow-raw-pfn-mappings-of-huge-shared-zeropage.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 13

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: disallow raw PFN mappings of huge/shared zeropage
has been removed from the -mm tree. Its filename was
mm-disallow-raw-pfn-mappings-of-huge-shared-zeropage.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: Lance Yang <[email protected]>
Subject: mm: disallow raw PFN mappings of huge/shared zeropage
Date: Mon, 21 Sep 2026 13:42:25 +0800

Handling the huge/shared zeropage correctly in vmf_insert_pfn_pmd() and vmf_insert_pfn_prot() is more involved. We would need to check whether the VMA allows it and keep the mapping read-only, similar to the checks in vm_mixed_ok().

No in-tree user needs that support, so reject these mappings with VM_FAULT_SIGBUS rather than complicate the code for now.

---

 mm/huge_memory.c |    3 +++
 mm/memory.c      |    3 +++
 2 files changed, 6 insertions(+)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-disallow-raw-pfn-mappings-of-huge-shared-zeropage +3 -0
@@ -1727,6 +1727,9 @@ vm_fault_t vmf_insert_pfn_pmd(struct vm_
 						(VM_PFNMAP|VM_MIXEDMAP));
 	BUG_ON((vma->vm_flags & VM_PFNMAP) && vma_is_cow_mapping(vma));
 
+	if (unlikely(is_huge_zero_pfn(pfn)))
+		return VM_FAULT_SIGBUS;
+
 	pfnmap_setup_cachemode_pfn(pfn, &pgprot);
 
 	return insert_pmd(vma, addr, vmf->pmd, fop, pgprot, write);
mm/memory.c renamed from mm/memory.c~mm-disallow-raw-pfn-mappings-of-huge-shared-zeropage +3 -0
@@ -2860,6 +2860,9 @@ vm_fault_t vmf_insert_pfn_prot(struct vm
 	BUG_ON((vma->vm_flags & VM_PFNMAP) && vma_is_cow_mapping(vma));
 	BUG_ON((vma->vm_flags & VM_MIXEDMAP) && pfn_valid(pfn));
 
+	if (unlikely(is_zero_pfn(pfn)))
+		return VM_FAULT_SIGBUS;
+
 	if (addr < vma->vm_start || addr >= vma->vm_end)
 		return VM_FAULT_SIGBUS;
 

_

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