diff options
author | George Koehler <gkoehler@cvs.openbsd.org> | 2023-02-21 04:49:44 +0000 |
---|---|---|
committer | George Koehler <gkoehler@cvs.openbsd.org> | 2023-02-21 04:49:44 +0000 |
commit | 00470be147f0e0d452e586ef6113828711b463e8 (patch) | |
tree | e458c541e242241c7c714faae4b47b6b465e39fb /sys | |
parent | c1d427b63af270f13bebe961d6f22d7deaa3329c (diff) |
Set the current pmap in macppc's pmap_activate
This fixes a possible freeze in execve(2). It sometimes froze when a
dual-cpu macppc started daemons during boot. There is a chance that
uvm_map.c uvmspace_exec sees ovm->vm_refcnt != 1 and switches curproc
to a new pmap. If this happened, then execve froze by trying to
copyout to the wrong pmap; curpcb->pcb_pm was old. Fix by setting
pointers when uvmspace_exec calls pmap_activate.
ok miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/powerpc/powerpc/pmap.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index e47eafa9829..f160e2e7ed8 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.181 2023/02/06 06:41:38 gkoehler Exp $ */ +/* $OpenBSD: pmap.c,v 1.182 2023/02/21 04:49:43 gkoehler Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -81,6 +81,7 @@ #include <sys/queue.h> #include <sys/pool.h> #include <sys/atomic.h> +#include <sys/user.h> #include <uvm/uvm_extern.h> @@ -1646,12 +1647,19 @@ pmap_enable_mmu(void) /* * activate a pmap entry - * NOOP on powerpc, all PTE entries exist in the same hash table. + * All PTE entries exist in the same hash table. * Segment registers are filled on exit to user mode. */ void pmap_activate(struct proc *p) { + struct pcb *pcb = &p->p_addr->u_pcb; + + /* Set the current pmap. */ + pcb->pcb_pm = p->p_vmspace->vm_map.pmap; + pmap_extract(pmap_kernel(), + (vaddr_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal); + curcpu()->ci_curpm = pcb->pcb_pmreal; } /* |