aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiran Alon <liran.alon@oracle.com>2017-11-05 09:56:33 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2017-11-17 07:20:11 -0500
commit1f4dcb3b213235e642088709a1c54964d23365e9 (patch)
tree444ea25f9205cf8e4c6bc63adb404346346a28dd
parent61cb57c9ed631c95b54f8e9090c89d18b3695b3c (diff)
KVM: x86: emulator: Return to user-mode on L1 CPL=0 emulation failure
On this case, handle_emulation_failure() fills kvm_run with internal-error information which it expects to be delivered to user-mode for further processing. However, the code reports a wrong return-value which makes KVM to never return to user-mode on this scenario. Fixes: 6d77dbfc88e3 ("KVM: inject #UD if instruction emulation fails and exit to userspace") Signed-off-by: Liran Alon <liran.alon@oracle.com> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1d492b3660d5..e5a7c53a19c6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5433,7 +5433,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu)
5433 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 5433 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
5434 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; 5434 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
5435 vcpu->run->internal.ndata = 0; 5435 vcpu->run->internal.ndata = 0;
5436 r = EMULATE_FAIL; 5436 r = EMULATE_USER_EXIT;
5437 } 5437 }
5438 kvm_queue_exception(vcpu, UD_VECTOR); 5438 kvm_queue_exception(vcpu, UD_VECTOR);
5439 5439