From patchwork Tue Oct 27 13:45:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312620 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 32574C63699 for ; Tue, 27 Oct 2020 15:27:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D93D9206F4 for ; Tue, 27 Oct 2020 15:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812471; bh=lYpwbHxaRmTQJ7jeGSQa7wzRpTRhbsZU+H2+e6SE/QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LcuJ3o1omg6CE6fggLlmpBIuIq23PMxlyl4c+A/iuRNABUDDAmHei0sDSE0SYjO0q lr5Zf0RBmIGSY0n+2ZMD3hjhri9yAZpvqi0O7h0HgtNsi/m1DMFxtzbq3qosIh4jDu qZanos92SNiNwmDjjDDEGXu3qHeyBJHmi9S95/5I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S368796AbgJ0P1t (ORCPT ); Tue, 27 Oct 2020 11:27:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:36922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1797197AbgJ0PWJ (ORCPT ); Tue, 27 Oct 2020 11:22:09 -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 C17E62064B; Tue, 27 Oct 2020 15:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812129; bh=lYpwbHxaRmTQJ7jeGSQa7wzRpTRhbsZU+H2+e6SE/QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uplIfOJGZCnEd1QobAVcUj5QrHsb1zI4yMkSOqZ+PatzO2Zc+TuIorSsmHOLM9eHE yC6tSEIaaZGTb15B2sXalgegnNmVDR2BMGWXHfFglg1tzfNQWNX47pkZYOrflfm+iZ YQu8xsf6LCNzrobkncWOsJfuy/PfFHIcLD0kOnHU= 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.9 075/757] KVM: nVMX: Reload vmcs01 if getting vmcs12s pages fails Date: Tue, 27 Oct 2020 14:45:25 +0100 Message-Id: <20201027135454.063790863@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@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 @@ -3346,8 +3346,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);