From: Jan Kiszka Date: Mon, 9 Mar 2015 19:56:43 +0000 (+0100) Subject: KVM: nVMX: Do not emulate #UD while in guest mode X-Git-Tag: v4.13~5472^2~39 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ae1f57670703656cc9f293722c3b8b6782f8ab3f;p=mirror_ubuntu-bionic-kernel.git KVM: nVMX: Do not emulate #UD while in guest mode While in L2, leave all #UD to L2 and do not try to emulate it. If L1 is interested in doing this, it reports its interest via the exception bitmap, and we never get into handle_exception of L0 anyway. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fbd949909628..50c675b46901 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -5065,6 +5065,10 @@ static int handle_exception(struct kvm_vcpu *vcpu) } if (is_invalid_opcode(intr_info)) { + if (is_guest_mode(vcpu)) { + kvm_queue_exception(vcpu, UD_VECTOR); + return 1; + } er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD); if (er != EMULATE_DONE) kvm_queue_exception(vcpu, UD_VECTOR);