aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAbel Gordon <abelg@il.ibm.com>2013-04-18 07:36:55 -0400
committerGleb Natapov <gleb@redhat.com>2013-04-22 03:52:01 -0400
commit145c28dd19a2a05aa798e77bd7e679847fe8bee3 (patch)
tree8a0f2f1c497c72f80800e3336d6c9d86b1ff0be9 /arch/x86
parent20b97feaf615da2c43361e1dda7efd068a4446ef (diff)
KVM: nVMX: Fix VMXON emulation
handle_vmon doesn't check if L1 is already in root mode (VMXON was previously called). This patch adds this missing check and calls nested_vmx_failValid if VMX is already ON. We need this check because L0 will allocate the shadow vmcs when L1 executes VMXON and we want to avoid host leaks (due to shadow vmcs allocation) if L1 executes VMXON repeatedly. Signed-off-by: Abel Gordon <abelg@il.ibm.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 1ee63cae82cd..1cdfb5d7580a 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5512,6 +5512,9 @@ static void nested_free_all_saved_vmcss(struct vcpu_vmx *vmx)
5512 free_loaded_vmcs(&vmx->vmcs01); 5512 free_loaded_vmcs(&vmx->vmcs01);
5513} 5513}
5514 5514
5515static void nested_vmx_failValid(struct kvm_vcpu *vcpu,
5516 u32 vm_instruction_error);
5517
5515/* 5518/*
5516 * Emulate the VMXON instruction. 5519 * Emulate the VMXON instruction.
5517 * Currently, we just remember that VMX is active, and do not save or even 5520 * Currently, we just remember that VMX is active, and do not save or even
@@ -5547,6 +5550,11 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
5547 kvm_inject_gp(vcpu, 0); 5550 kvm_inject_gp(vcpu, 0);
5548 return 1; 5551 return 1;
5549 } 5552 }
5553 if (vmx->nested.vmxon) {
5554 nested_vmx_failValid(vcpu, VMXERR_VMXON_IN_VMX_ROOT_OPERATION);
5555 skip_emulated_instruction(vcpu);
5556 return 1;
5557 }
5550 5558
5551 INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool)); 5559 INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool));
5552 vmx->nested.vmcs02_num = 0; 5560 vmx->nested.vmcs02_num = 0;