summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorLiran Alon <liran.alon@oracle.com>2017-11-05 16:56:32 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-05 11:26:32 +0100
commit15cc35bc76f95d22d1e3e42617f6103568f19931 (patch)
tree41a867918a8e4b8755a11681dd9f56f067dc8e4d /arch/x86/kvm/svm.c
parent6c4eaffbad3701f037f1d60ca892dcbe7641ff74 (diff)
downloadlinux-stable-15cc35bc76f95d22d1e3e42617f6103568f19931.tar.gz
linux-stable-15cc35bc76f95d22d1e3e42617f6103568f19931.tar.bz2
linux-stable-15cc35bc76f95d22d1e3e42617f6103568f19931.zip
KVM: x86: Exit to user-mode on #UD intercept when emulator requires
commit 61cb57c9ed631c95b54f8e9090c89d18b3695b3c upstream. Instruction emulation after trapping a #UD exception can result in an MMIO access, for example when emulating a MOVBE on a processor that doesn't support the instruction. In this case, the #UD vmexit handler must exit to user mode, but there wasn't any code to do so. Add it for both VMX and SVM. 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> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ca209a4a7834..17fb6c6d939a 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2189,6 +2189,8 @@ static int ud_interception(struct vcpu_svm *svm)
int er;
er = emulate_instruction(&svm->vcpu, EMULTYPE_TRAP_UD);
+ if (er == EMULATE_USER_EXIT)
+ return 0;
if (er != EMULATE_DONE)
kvm_queue_exception(&svm->vcpu, UD_VECTOR);
return 1;