]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: VMX: Fix MSR_KERNEL_GS_BASE leak while switching to long mode
authorAvi Kivity <avi@redhat.com>
Sun, 15 Nov 2009 09:42:05 +0000 (11:42 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 15 Nov 2009 09:42:05 +0000 (11:42 +0200)
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 <avi@redhat.com>
arch/x86/kvm/vmx.c

index b923f2a287bde9aef4467dbd69b1be9603c335c2..3291ea5b0ab8dac9c3ff9ce8434a5ec163afda1b 100644 (file)
@@ -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;