Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2023 14:00:44 GMT
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 379e14ba6c61 - main - powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache
Message-ID:  <202303211400.32LE0iJP087110@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=379e14ba6c61634cc1f50272b6f8f147758ec92f

commit 379e14ba6c61634cc1f50272b6f8f147758ec92f
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2023-03-21 13:18:18 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-03-21 13:56:26 +0000

    powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache
    
    It's apparently possible for pcpu->pc_curpmap to be NULL at some point,
    leading to a panic.  Account for this as is done with the other 64-bit
    AIM pmap.
    
    Reported by:    pkubaj
    Tested by:      pkubaj
    Fixes:          6f0b2a235a1 ("Add pmap_sync_icache() for radix pmap")
    MFC after:      3 days
---
 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 1e7661ba8068..c95de527f554 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -5929,6 +5929,9 @@ mmu_radix_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz)
 	vm_paddr_t pa = 0;
 	int sync_sz;
 
+	if (__predict_false(pm == NULL))
+		pm = &curthread->td_proc->p_vmspace->vm_pmap;
+
 	while (sz > 0) {
 		pa = pmap_extract(pm, va);
 		sync_sz = PAGE_SIZE - (va & PAGE_MASK);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303211400.32LE0iJP087110>