git: 2465e78aeca2 - stable/15 - powerpc/radix: synchronize temporary kernel mappings

From: Minsoo Choo <mchoo_at_FreeBSD.org>
Date: Mon, 12 Oct 2026 03:59:49 UTC
The branch stable/15 has been updated by mchoo:

URL: https://cgit.FreeBSD.org/src/commit/?id=2465e78aeca2fea5d02c5fe52247206bed9ee43d

commit 2465e78aeca2fea5d02c5fe52247206bed9ee43d
Author:     Minsoo Choo <mchoo@FreeBSD.org>
AuthorDate: 2026-09-16 15:33:52 +0000
Commit:     Minsoo Choo <mchoo@FreeBSD.org>
CommitDate: 2026-10-12 03:58:14 +0000

    powerpc/radix: synchronize temporary kernel mappings
    
    The radix kremove implementation cleared a kernel PTE without
    invalidating its TLB entry.  Reusing crashdumpmap could therefore keep
    accessing an old physical page, causing minidumps to contain repeated
    stale page contents.
    
    Invalidate the removed kernel mapping and synchronize newly installed
    kernel PTEs before they are accessed.
    
    Reviewed by:    jhibbits
    Approved by:    olce (mentor)
    Fixes:          65bbba25d214 ("powerpc64: Implement Radix MMU for POWER9 CPUs")
    MFC after:      2 weeks
    Sponsored by:   FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59728
    
    (cherry picked from commit 8970a9f2ef781ab4f7d3fa446f7c6ac5eda26cc0)
---
 sys/powerpc/aim/mmu_radix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index df8887ba56e2..4e877f3ecd55 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -922,6 +922,7 @@ mmu_radix_kenter(vm_offset_t va, vm_paddr_t pa)
 	MPASS(pte != NULL);
 	*pte = htobe64(pa | RPTE_VALID | RPTE_LEAF | RPTE_EAA_R | \
 	    RPTE_EAA_W | RPTE_EAA_P | PG_M | PG_A);
+	ptesync();
 }
 
 bool
@@ -6141,6 +6142,7 @@ mmu_radix_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma)
 	pteval = pa | RPTE_EAA_R | RPTE_EAA_W | RPTE_EAA_P | PG_M | PG_A;
 	cache_bits = mmu_radix_calc_wimg(pa, ma);
 	pte_store(pte, pteval | cache_bits);
+	ptesync();
 }
 
 void
@@ -6152,6 +6154,7 @@ mmu_radix_kremove(vm_offset_t va)
 
 	pte = kvtopte(va);
 	pte_clear(pte);
+	pmap_invalidate_page(kernel_pmap, va);
 }
 
 int