summaryrefslogtreecommitdiff
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2014-05-06 06:19:17 (GMT)
committerPaolo Bonzini <pbonzini@redhat.com>2014-05-06 17:00:37 (GMT)
commit96ec146330d18a938b4773be8d6dd1f93399507c (patch)
treeaca783b3457514523a7500fa794003dc1fcfbb3e /arch/x86/kvm
parent3573e22cfecaac83f82ef4f6847d90e466fc8e10 (diff)
downloadlinux-96ec146330d18a938b4773be8d6dd1f93399507c.tar.xz
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 0f79347..1d7e727 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)
return 1;
}
+ if (vmptr == vmx->nested.vmxon_ptr) {
+ nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER);
+ skip_emulated_instruction(vcpu);
+ return 1;
+ }
+
if (vmptr == vmx->nested.current_vmptr) {
nested_release_vmcs12(vmx);
vmx->nested.current_vmptr = -1ull;
@@ -6443,6 +6449,12 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
return 1;
}
+ if (vmptr == vmx->nested.vmxon_ptr) {
+ nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER);
+ skip_emulated_instruction(vcpu);
+ return 1;
+ }
+
if (vmx->nested.current_vmptr != vmptr) {
struct vmcs12 *new_vmcs12;
struct page *page;