summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2020-12-28 14:02:07 +0000
committermpi <mpi@openbsd.org>2020-12-28 14:02:07 +0000
commitb7590adb9df2a5f8d2a1537d16466421eb2d8dd2 (patch)
treee77095ae3fcda32ca53f5ab844c0f9a5bd2b526f
parentUse per-CPU counters for fault and stats counters reached in uvm_fault(). (diff)
downloadwireguard-openbsd-b7590adb9df2a5f8d2a1537d16466421eb2d8dd2.tar.xz
wireguard-openbsd-b7590adb9df2a5f8d2a1537d16466421eb2d8dd2.zip
Initialize pmap_kernel()'s mutexes.
Poison the IPL value of `pm_mtx' since it isn't supposed to be used and add an assert to make sure splraise() isn't called with a poisoned value. Fix a missing initialization found by WITNESS and reported by gnezdo@. ok millert@
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/i386/i386/pmap.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 90f71921020..ed6403353fd 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.641 2020/11/08 20:37:23 mpi Exp $ */
+/* $OpenBSD: machdep.c,v 1.642 2020/12/28 14:02:07 mpi Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -3996,6 +3996,8 @@ splraise(int ncpl)
{
int ocpl;
+ KASSERT(ncpl >= IPL_NONE);
+
_SPLRAISE(ocpl, ncpl);
return (ocpl);
}
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index 51096f4e4ad..b2377cb89db 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.209 2020/09/24 11:36:50 deraadt Exp $ */
+/* $OpenBSD: pmap.c,v 1.210 2020/12/28 14:02:08 mpi Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -961,6 +961,8 @@ pmap_bootstrap(vaddr_t kva_start)
*/
kpm = pmap_kernel();
+ mtx_init(&kpm->pm_mtx, -1); /* must not be used */
+ mtx_init(&kpm->pm_apte_mtx, IPL_VM);
uvm_objinit(&kpm->pm_obj, NULL, 1);
bzero(&kpm->pm_list, sizeof(kpm->pm_list)); /* pm_list not used */
kpm->pm_pdir = (vaddr_t)(proc0.p_addr->u_pcb.pcb_cr3 + KERNBASE);