From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Mattson Subject: [PATCH v2] kvm: vmx: Properly handle machine check during VM-entry Date: Fri, 19 May 2017 08:56:03 -0700 Message-ID: <20170519155603.16076-1-jmattson@google.com> References: <20170519133916.GB9960@potion> Cc: Jim Mattson To: kvm@vger.kernel.org Return-path: Received: from mail-pf0-f179.google.com ([209.85.192.179]:35524 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756125AbdESP4q (ORCPT ); Fri, 19 May 2017 11:56:46 -0400 Received: by mail-pf0-f179.google.com with SMTP id n23so41749680pfb.2 for ; Fri, 19 May 2017 08:56:41 -0700 (PDT) In-Reply-To: <20170519133916.GB9960@potion> Sender: kvm-owner@vger.kernel.org List-ID: When bit 31 of the exit reason is set to indicate a VM-entry failure, only the exit reason and exit qualification fields are set. All other VM-exit information fields, including "VM-exit interruption information," are unmodified. Fixes: 00eba012d53e6 ("KVM: VMX: Refactor vmx_complete_atomic_exit()") Signed-off-by: Jim Mattson --- arch/x86/kvm/vmx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c6f4ad44aa95..7c7ebefa8d15 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -8614,17 +8614,19 @@ static void vmx_apicv_post_state_restore(struct kvm_vcpu *vcpu) static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) { - u32 exit_intr_info; + u32 exit_intr_info = 0; if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)) return; - vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); - exit_intr_info = vmx->exit_intr_info; + if (vmx->exit_reason != EXIT_REASON_MCE_DURING_VMENTRY) + exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + vmx->exit_intr_info = exit_intr_info; /* Handle machine checks before interrupts are enabled */ - if (is_machine_check(exit_intr_info)) + if (vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY || + is_machine_check(exit_intr_info)) kvm_machine_check(); /* We need to handle NMIs before interrupts are enabled */ -- 2.13.0.303.g4ebf302169-goog