From: gkoehler Date: Tue, 4 Jun 2024 17:31:59 +0000 (+0000) Subject: Allow sbld allocation to fail when PMAP_CANFAIL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9e6587aee4fdcf19b18481dd57a0bfad1c63c29c;p=openbsd Allow sbld allocation to fail when PMAP_CANFAIL. pool_get in powerpc64's pmap might fail when uvm_km_pages.free == 0. This might cause KASSERT(slbd) to panic 'kernel diagnostic assertion "sbld" failed'. Remove this KASSERT and add a check for PMAP_CANFAIL. pmap_enter calls without PMAP_CANFAIL might still panic. ok mpi@ jca@ --- diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c index 53c2badc438..9034952f5c8 100644 --- a/sys/arch/powerpc64/powerpc64/pmap.c +++ b/sys/arch/powerpc64/powerpc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.61 2024/04/03 19:30:59 gkoehler Exp $ */ +/* $OpenBSD: pmap.c,v 1.62 2024/06/04 17:31:59 gkoehler Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -602,7 +602,11 @@ pmap_vp_enter(pmap_t pm, vaddr_t va, struct pte_desc *pted, int flags) slbd = pmap_slbd_lookup(pm, va); if (slbd == NULL) { slbd = pmap_slbd_alloc(pm, va); - KASSERT(slbd); + if (slbd == NULL) { + if ((flags & PMAP_CANFAIL) == 0) + panic("%s: unable to allocate slbd", __func__); + return ENOMEM; + } } vp1 = slbd->slbd_vp;