Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 2017 10:49:53 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322832 - head/sys/amd64/vmm/intel
Message-ID:  <201708241049.v7OAnrrl028557@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708241049.v7OAnrrl028557>