aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2014-05-06 02:19:17 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-05-06 13:00:37 -0400
commit96ec146330d18a938b4773be8d6dd1f93399507c (patch)
treeaca783b3457514523a7500fa794003dc1fcfbb3e /arch/x86/kvm
parent3573e22cfecaac83f82ef4f6847d90e466fc8e10 (diff)
KVM: nVMX: fail on invalid vmclear/vmptrld pointer
The spec mandates that if the vmptrld or vmclear address is equal to the vmxon region pointer, the instruction should fail with error "VMPTRLD with VMXON pointer" or "VMCLEAR with VMXON pointer" Signed-off-by: Bandan Das <bsd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/vmx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0f7934767a2f..1d7e7279f1b4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6100,6 +6100,12 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
6100 return 1; 6100 return 1;
6101 } 6101 }
6102 6102
6103 if (vmptr == vmx->nested.vmxon_ptr) {
6104 nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER);
6105 skip_emulated_instruction(vcpu);
6106 return 1;
6107 }
6108
6103 if (vmptr == vmx->nested.current_vmptr) { 6109 if (vmptr == vmx->nested.current_vmptr) {
6104 nested_release_vmcs12(vmx); 6110 nested_release_vmcs12(vmx);
6105 vmx->nested.current_vmptr = -1ull; 6111 vmx->nested.current_vmptr = -1ull;
@@ -6443,6 +6449,12 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
6443 return 1; 6449 return 1;
6444 } 6450 }
6445 6451
6452 if (vmptr == vmx->nested.vmxon_ptr) {
6453 nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER);
6454 skip_emulated_instruction(vcpu);
6455 return 1;
6456 }
6457
6446 if (vmx->nested.current_vmptr != vmptr) { 6458 if (vmx->nested.current_vmptr != vmptr) {
6447 struct vmcs12 *new_vmcs12; 6459 struct vmcs12 *new_vmcs12;
6448 struct page *page; 6460 struct page *page;