aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-07-26 11:32:38 -0400
committerAvi Kivity <avi@redhat.com>2010-08-02 01:10:18 -0400
commit3444d7da1839b851eefedd372978d8a982316c36 (patch)
treeb9fef27fbe36b455dc242670fa0f4025a2df1dc2 /arch/x86/kvm/vmx.c
parent9a3aad70572c3f4d55e7f09ac4eb313d41d0a484 (diff)
KVM: VMX: Fix host GDT.LIMIT corruption
vmx does not restore GDT.LIMIT to the host value, instead it sets it to 64KB. This means host userspace can learn a few bits of host memory. Fix by reloading GDTR when we load other host state. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2fdcc9819f36..27a0222c2946 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -185,6 +185,7 @@ static void kvm_cpu_vmxoff(void);
185static DEFINE_PER_CPU(struct vmcs *, vmxarea); 185static DEFINE_PER_CPU(struct vmcs *, vmxarea);
186static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 186static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
187static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu); 187static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu);
188static DEFINE_PER_CPU(struct desc_ptr, host_gdt);
188 189
189static unsigned long *vmx_io_bitmap_a; 190static unsigned long *vmx_io_bitmap_a;
190static unsigned long *vmx_io_bitmap_b; 191static unsigned long *vmx_io_bitmap_b;
@@ -871,6 +872,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
871#endif 872#endif
872 if (current_thread_info()->status & TS_USEDFPU) 873 if (current_thread_info()->status & TS_USEDFPU)
873 clts(); 874 clts();
875 load_gdt(&__get_cpu_var(host_gdt));
874} 876}
875 877
876static void vmx_load_host_state(struct vcpu_vmx *vmx) 878static void vmx_load_host_state(struct vcpu_vmx *vmx)
@@ -1379,6 +1381,8 @@ static int hardware_enable(void *garbage)
1379 ept_sync_global(); 1381 ept_sync_global();
1380 } 1382 }
1381 1383
1384 store_gdt(&__get_cpu_var(host_gdt));
1385
1382 return 0; 1386 return 0;
1383} 1387}
1384 1388