summaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-04-19 14:57:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-04-19 15:02:22 +0200
commita96cb3bf390eebfead5fc7a2092f8452a7997d1b (patch)
treed0e16dc3e903ce705f85c4c334d750b4b304a0f0 /mm/memory.c
parentKVM: SEV: use u64_to_user_ptr throughout (diff)
parentx86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk (diff)
downloadlinux-a96cb3bf390eebfead5fc7a2092f8452a7997d1b.tar.xz
linux-a96cb3bf390eebfead5fc7a2092f8452a7997d1b.zip
Merge x86 bugfixes from Linux 6.9-rc3
Pull fix for SEV-SNP late disable bugs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 9a6f4d8aa379..0201f50d8307 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1536,7 +1536,9 @@ static inline int zap_present_ptes(struct mmu_gather *tlb,
ptep_get_and_clear_full(mm, addr, pte, tlb->fullmm);
arch_check_zapped_pte(vma, ptent);
tlb_remove_tlb_entry(tlb, pte, addr);
- VM_WARN_ON_ONCE(userfaultfd_wp(vma));
+ if (userfaultfd_pte_wp(vma, ptent))
+ zap_install_uffd_wp_if_needed(vma, addr, pte, 1,
+ details, ptent);
ksm_might_unmap_zero_page(mm, ptent);
return 1;
}
@@ -5966,6 +5968,10 @@ int follow_phys(struct vm_area_struct *vma,
goto out;
pte = ptep_get(ptep);
+ /* Never return PFNs of anon folios in COW mappings. */
+ if (vm_normal_folio(vma, address, pte))
+ goto unlock;
+
if ((flags & FOLL_WRITE) && !pte_write(pte))
goto unlock;