From patchwork Tue Oct 27 13:46:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA10C388F9 for ; Tue, 27 Oct 2020 14:53:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B4BD22264 for ; Tue, 27 Oct 2020 14:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810428; bh=wAwUV958LU8bHx875DfGLCK3nKrFyDCPa9vQFyPV5ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k+ZQf8rgUwE9PL2Z7PQhqUljgJtVNpdQGZa5HjxuZMw3g8Ht9OVmuVxDgZ2OQeWpR Y4U0DMecDv02QfCfdWVKprwGEy98Re9eheuAYaEGww/ZewJjYyQbG1rSFIdFKea3LI pU6l8Vlp94EPS4pt8VkW2sA06tEA50FOWMXLobw0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752262AbgJ0Oxo (ORCPT ); Tue, 27 Oct 2020 10:53:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1772997AbgJ0Ous (ORCPT ); Tue, 27 Oct 2020 10:50:48 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52DAF20709; Tue, 27 Oct 2020 14:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810248; bh=wAwUV958LU8bHx875DfGLCK3nKrFyDCPa9vQFyPV5ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fv3mRTg649YEsDjT7mUQQf0szoxapl40IN9fGt8Fy8YRfdDTwP8JBtZtt0u5CE+Wd KTpVmsiloTQ9dhGSRCMFNmyyI55McwOnQtuOkD2pcddH15iMfYMS+Lxdh41V0HPSKX /G9yFFhm1k3phJerQl+V36/W+gjFKZfw3wKODMxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Cross , Jim Mattson , Peter Shier , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.8 071/633] KVM: nVMX: Reload vmcs01 if getting vmcs12s pages fails Date: Tue, 27 Oct 2020 14:46:54 +0100 Message-Id: <20201027135526.034984129@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sean Christopherson commit b89d5ad00e789967a5e2c5335f75c48755bebd88 upstream. Reload vmcs01 when bailing from nested_vmx_enter_non_root_mode() as KVM expects vmcs01 to be loaded when is_guest_mode() is false. Fixes: 671ddc700fd08 ("KVM: nVMX: Don't leak L1 MMIO regions to L2") Cc: stable@vger.kernel.org Cc: Dan Cross Cc: Jim Mattson Cc: Peter Shier Signed-off-by: Sean Christopherson Message-Id: <20200923184452.980-3-sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3297,8 +3297,10 @@ enum nvmx_vmentry_status nested_vmx_ente prepare_vmcs02_early(vmx, vmcs12); if (from_vmentry) { - if (unlikely(!nested_get_vmcs12_pages(vcpu))) + if (unlikely(!nested_get_vmcs12_pages(vcpu))) { + vmx_switch_vmcs(vcpu, &vmx->vmcs01); return NVMX_VMENTRY_KVM_INTERNAL_ERROR; + } if (nested_vmx_check_vmentry_hw(vcpu)) { vmx_switch_vmcs(vcpu, &vmx->vmcs01);