diff options
| author | Haozhong Zhang <haozhong.zhang@intel.com> | 2015-11-25 04:21:39 -0500 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-11-25 09:52:55 -0500 |
| commit | b2467e744f89fcb2e723143c2b78bcbaf391828a (patch) | |
| tree | 6bf43a5affc9ecc1a8d027dbb2fad3e72eb2ea36 | |
| parent | 8bd142c01648cdb33e9bcafa0448ba2c20ed814c (diff) | |
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>
| -rw-r--r-- | arch/x86/kvm/vmx.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 87acc5221740..af823a388c19 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) | |||
| 7394 | 7394 | ||
| 7395 | switch (type) { | 7395 | switch (type) { |
| 7396 | case VMX_VPID_EXTENT_ALL_CONTEXT: | 7396 | 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 | } | ||
| 7402 | __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); | 7397 | __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); |
| 7403 | nested_vmx_succeed(vcpu); | 7398 | nested_vmx_succeed(vcpu); |
| 7404 | break; | 7399 | break; |
