svn commit: r322832 - head/sys/amd64/vmm/intel
Konstantin Belousov
kib at FreeBSD.org
Thu Aug 24 10:49:54 UTC 2017
Author: kib
Date: Thu Aug 24 10:49:53 2017
New Revision: 322832
URL: https://svnweb.freebsd.org/changeset/base/322832
Log:
Save KGSBASE in pcb before overriding it with the guest value.
Reported by: lwhsu, mjoras
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 18 days
Modified:
head/sys/amd64/vmm/intel/vmx_msr.c
Modified: head/sys/amd64/vmm/intel/vmx_msr.c
==============================================================================
--- head/sys/amd64/vmm/intel/vmx_msr.c Thu Aug 24 08:20:23 2017 (r322831)
+++ head/sys/amd64/vmm/intel/vmx_msr.c Thu Aug 24 10:49:53 2017 (r322832)
@@ -31,10 +31,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/proc.h>
#include <machine/clock.h>
#include <machine/cpufunc.h>
#include <machine/md_var.h>
+#include <machine/pcb.h>
#include <machine/specialreg.h>
#include <machine/vmm.h>
@@ -356,7 +358,8 @@ vmx_msr_guest_enter(struct vmx *vmx, int vcpuid)
{
uint64_t *guest_msrs = vmx->guest_msrs[vcpuid];
- /* Save host MSRs (if any) and restore guest MSRs */
+ /* Save host MSRs (in particular, KGSBASE) and restore guest MSRs */
+ update_pcb_bases(curpcb);
wrmsr(MSR_LSTAR, guest_msrs[IDX_MSR_LSTAR]);
wrmsr(MSR_CSTAR, guest_msrs[IDX_MSR_CSTAR]);
wrmsr(MSR_STAR, guest_msrs[IDX_MSR_STAR]);
More information about the svn-src-all
mailing list