Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277127

[PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation

From Haozhong Zhang <haozhong.zhang@intel.com>
Newsgroups linux.kernel
Subject [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation
Date 2015-11-25 10:30 +0100
Message-ID <qyEyJ-4fF-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


This patch removes the vpid check when emulating nested invvpid
instruction of type all-contexts invalidation. The existing code is
incorrect because:
 (1) According to Intel SDM Vol 3, Section "INVVPID - Invalidate
     Translations Based on VPID", invvpid instruction does not check
     vpid in the invvpid descriptor when its type is all-contexts
     invalidation.
 (2) According to the same document, invvpid of type all-contexts
     invalidation does not require there is an active VMCS, so/and
     get_vmcs12() in the existing code may result in a NULL-pointer
     dereference. In practice, it can crash both KVM itself and L1
     hypervisors that use invvpid (e.g. Xen).

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 arch/x86/kvm/vmx.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 87acc52..af823a3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7394,11 +7394,6 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
 
 	switch (type) {
 	case VMX_VPID_EXTENT_ALL_CONTEXT:
-		if (get_vmcs12(vcpu)->virtual_processor_id == 0) {
-			nested_vmx_failValid(vcpu,
-				VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
-			return 1;
-		}
 		__vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
 		nested_vmx_succeed(vcpu);
 		break;
-- 
2.4.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation Haozhong Zhang <haozhong.zhang@intel.com> - 2015-11-25 10:30 +0100
  Re: [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation Bandan Das <bsd@redhat.com> - 2015-11-25 16:50 +0100
    Re: [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid  emulation Haozhong Zhang <haozhong.zhang@intel.com> - 2015-11-25 17:30 +0100
      Re: [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid emulation Bandan Das <bsd@redhat.com> - 2015-11-25 17:40 +0100
    Re: [PATCH] KVM: nVMX: remove incorrect vpid check in nested invvpid  emulation Paolo Bonzini <pbonzini@redhat.com> - 2015-11-25 17:30 +0100

csiph-web