]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
KVM: nVMX: Do not emulate #UD while in guest mode
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 9 Mar 2015 19:56:43 +0000 (20:56 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Fri, 13 Mar 2015 16:44:43 +0000 (13:44 -0300)
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 <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/vmx.c

index fbd9499096284cf93519c402e0be35c4edaa565c..50c675b46901aa9e6cafd6c8c38538f815c7e86d 100644 (file)
@@ -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);