From: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri, 18 Mar 2016 15:53:42 +0000 (+0100)
Subject: KVM: VMX: avoid guest hang on invalid invvpid instruction
X-Git-Tag: firefly_0821_release~176^2~4^2~50^2~194
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f9153f95f2b5a1a90b81c746342bed9d40dc9ae0;p=firefly-linux-kernel-4.4.55.git

KVM: VMX: avoid guest hang on invalid invvpid instruction

commit f6870ee9e53430f2a318ccf0dd5e66bb46194e43 upstream.

A guest executing an invalid invvpid instruction would hang
because the instruction pointer was not updated.

Reported-by: jmontleo@redhat.com
Tested-by: jmontleo@redhat.com
Fixes: 99b83ac893b84ed1a62ad6d1f2b6cc32026b9e85
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 89d5e02b14ae..75d5d5b75e1f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7399,6 +7399,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
 	if (!(types & (1UL << type))) {
 		nested_vmx_failValid(vcpu,
 			VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
+		skip_emulated_instruction(vcpu);
 		return 1;
 	}