From: Avi Kivity Date: Sun, 15 Nov 2009 09:42:05 +0000 (+0200) Subject: KVM: VMX: Fix MSR_KERNEL_GS_BASE leak while switching to long mode X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2aa60e1dbfb8d952404af17fa8cb12c231dcfb41;p=users%2Fdwmw2%2Flinux.git KVM: VMX: Fix MSR_KERNEL_GS_BASE leak while switching to long mode Switching is controlled by is_long_mode(), so we must unload guest MSRs while switching to or from long mode. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b923f2a287bde..3291ea5b0ab8d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1538,6 +1538,11 @@ static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) if (!msr) return; + /* + * Force kernel_gs_base reloading before EFER changes, as control + * of this msr depends on is_long_mode(). + */ + vmx_load_host_state(to_vmx(vcpu)); vcpu->arch.shadow_efer = efer; if (!msr) return;