From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4E9DC43217 for ; Mon, 7 Nov 2022 16:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbiKGQvr (ORCPT ); Mon, 7 Nov 2022 11:51:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232705AbiKGQvh (ORCPT ); Mon, 7 Nov 2022 11:51:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0608A20BFE for ; Mon, 7 Nov 2022 08:51:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A14AEB815A0 for ; Mon, 7 Nov 2022 16:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0273EC433B5; Mon, 7 Nov 2022 16:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667839894; bh=WAADxS8waKRX9wz7FwqdoVg6zwMW38qukloGSuZzzTg=; h=Subject:To:Cc:From:Date:From; b=IzTAfcNdw83MFkIdCUPF/okctBuk9wyTj/KXogj7P+tXG1Y3NZzk/cSVDswCVnR6w gsdciWyPIKLwW6uEiez8yMHJtDgTVYSK5CGBjeH+RLHlxXnQ9UrqNF2HiIX5Q14zeg 14GYwIU9L8lTwmbeF5SUVmBXXKaeYXel4T437XmY= Subject: FAILED: patch "[PATCH] KVM: x86: emulator: update the emulation mode after rsm" failed to apply to 4.14-stable tree To: mlevitsk@redhat.com, pbonzini@redhat.com Cc: From: Date: Mon, 07 Nov 2022 17:51:26 +0100 Message-ID: <1667839886235135@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Possible dependencies: 055f37f84e30 ("KVM: x86: emulator: update the emulation mode after rsm") 0128116550ac ("KVM: x86: Drop .post_leave_smm(), i.e. the manual post-RSM MMU reset") fa75e08bbe4f ("KVM: x86: Invoke kvm_smm_changed() immediately after clearing SMM flag") edce46548b70 ("KVM: x86: Replace .set_hflags() with dedicated .exiting_smm() helper") 25b17226cd9a ("KVM: x86: Emulate triple fault shutdown if RSM emulation fails") 78fcb2c91adf ("KVM: x86: Immediately reset the MMU context when the SMM flag is cleared") 02d4160fbd76 ("x86: KVM: add xsetbv to the emulator") 9ec19493fb86 ("KVM: x86: clear SMM flags before loading state while leaving SMM") c5833c7a43a6 ("KVM: x86: Open code kvm_set_hflags") ed19321fb657 ("KVM: x86: Load SMRAM in a single shot when leaving SMM") a821bab2d1ee ("KVM: VMX: Move VMX specific files to a "vmx" subdirectory") a633e41e7362 ("KVM: nVMX: assimilate nested_vmx_entry_failure() into nested_vmx_enter_non_root_mode()") 7671ce21b13b ("KVM: nVMX: move check_vmentry_postreqs() call to nested_vmx_enter_non_root_mode()") d63907dc7dd1 ("KVM: nVMX: rename enter_vmx_non_root_mode to nested_vmx_enter_non_root_mode") 7e7126846c95 ("kvm: nVMX: fix entry with pending interrupt if APICv is enabled") e6c67d8cf117 ("KVM: nVMX: Wake blocked vCPU in guest-mode if pending interrupt in virtual APICv") b5861e5cf2fc ("KVM: nVMX: Fix loss of pending IRQ/NMI before entering L2") 61ada7488ffd ("KVM: nVMX: Cache shadow vmcs12 on VMEntry and flush to memory on VMExit") 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") 7f7f1ba33cf2 ("KVM: x86: do not load vmcs12 pages while still in SMM") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 055f37f84e304e59c046d1accfd8f08462f52c4c Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Tue, 25 Oct 2022 15:47:30 +0300 Subject: [PATCH] KVM: x86: emulator: update the emulation mode after rsm Update the emulation mode after RSM so that RIP will be correctly written back, because the RSM instruction can switch the CPU mode from 32 bit (or less) to 64 bit. This fixes a guest crash in case the #SMI is received while the guest runs a code from an address > 32 bit. Signed-off-by: Maxim Levitsky Message-Id: <20221025124741.228045-13-mlevitsk@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index e5522a23d985..33385ebae100 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2662,7 +2662,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) * those side effects need to be explicitly handled for both success * and shutdown. */ - return X86EMUL_CONTINUE; + return emulator_recalc_and_set_mode(ctxt); emulate_shutdown: ctxt->ops->triple_fault(ctxt);