Skip to content

Commit b2467e7

Browse files
Haozhong Zhangbonzini
authored andcommitted
KVM: nVMX: remove incorrect vpid check in nested invvpid emulation
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> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 8bd142c commit b2467e7

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

arch/x86/kvm/vmx.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7394,11 +7394,6 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
73947394

73957395
switch (type) {
73967396
case VMX_VPID_EXTENT_ALL_CONTEXT:
7397-
if (get_vmcs12(vcpu)->virtual_processor_id == 0) {
7398-
nested_vmx_failValid(vcpu,
7399-
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
7400-
return 1;
7401-
}
74027397
__vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
74037398
nested_vmx_succeed(vcpu);
74047399
break;

0 commit comments

Comments
 (0)