diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-09-09 22:46:55 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-09-09 22:46:55 +0000 |
commit | ca213f10c13516a99807fc354f4cdbbb60520647 (patch) | |
tree | d6db03af43a251f2aac2b21be86dafc9f4cd42dd /sys/arch/amd64 | |
parent | a7b10b1dea46f97a111531098619838c640edbdb (diff) |
pmap_activate() should match cpu_switchto, so set up ci_{kern,user}_cr3
if activating for the current thread and meltdown mitigations are in effect.
Not clear if it's actually possible to hit the case where this matters,
but it's the Right Thing.
ok mlarkin@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 85f23f08568..3b13d45d2fa 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.117 2018/09/09 22:41:57 guenther Exp $ */ +/* $OpenBSD: pmap.c,v 1.118 2018/09/09 22:46:54 guenther Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -1188,6 +1188,14 @@ pmap_activate(struct proc *p) if (p == curproc) { lcr3(pcb->pcb_cr3); + /* in case we return to userspace without context switching */ + if (cpu_meltdown) { + struct cpu_info *self = curcpu(); + + self->ci_kern_cr3 = pcb->pcb_cr3; + self->ci_user_cr3 = pmap->pm_pdirpa_intel; + } + /* * mark the pmap in use by this processor. */ |