KVM: VMX: Report unexpected simultaneous exceptions as internal errors
authorAvi Kivity <avi@redhat.com>
Wed, 4 Nov 2009 09:59:01 +0000 (11:59 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 3 Dec 2009 07:32:24 +0000 (09:32 +0200)
These happen when we trap an exception when another exception is being
delivered; we only expect these with MCEs and page faults.  If something
unexpected happens, things probably went south and we're better off reporting
an internal error and freezing.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c
include/linux/kvm.h

index c0e66dd58a47b26a3177da9f34998a38c78a1734..22fcd27a0b58f6eb3c3574f99f6540763e835762 100644 (file)
@@ -2744,9 +2744,14 @@ static int handle_exception(struct kvm_vcpu *vcpu)
                return handle_machine_check(vcpu);
 
        if ((vect_info & VECTORING_INFO_VALID_MASK) &&
-                                               !is_page_fault(intr_info))
-               printk(KERN_ERR "%s: unexpected, vectoring info 0x%x "
-                      "intr info 0x%x\n", __func__, vect_info, intr_info);
+           !is_page_fault(intr_info)) {
+               vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
+               vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
+               vcpu->run->internal.ndata = 2;
+               vcpu->run->internal.data[0] = vect_info;
+               vcpu->run->internal.data[1] = intr_info;
+               return 0;
+       }
 
        if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
                return 1;  /* already handled by vmx_vcpu_run() */
index 172639e94392c0dd5a4c671caa9a0b42be9308e0..976f4d18185879d6cec5e280a562f7dbacb41789 100644 (file)
@@ -163,6 +163,7 @@ struct kvm_pit_config {
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 #define KVM_INTERNAL_ERROR_EMULATION 1
+#define KVM_INTERNAL_ERROR_SIMUL_EX 2
 
 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
 struct kvm_run {