From patchwork Tue Oct 27 13:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 311922 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=unavailable 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 B29FAC55179 for ; Tue, 27 Oct 2020 17:44:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6373B206DD for ; Tue, 27 Oct 2020 17:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603820661; bh=2kuZP5vndc47XkvVWqZbxCy/vUYb5FUlMMklHag2ST0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hCirZ104GdOLYTYF2mjWB8VQ1NkjFSX7w9NqLLz1V08X516LtqLrGEE440p8TfRbJ y8m2S1cjlY6T9YD1KufkBNpyoVDyhjHE/uWpne1xwXlDPmVeddERfZAeWNCrK+JdBy 1nbDCbk2+/3PQQa4ccqY1lCflazL39KwCtTbwWAs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760033AbgJ0ObR (ORCPT ); Tue, 27 Oct 2020 10:31:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:57952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2902189AbgJ0ObP (ORCPT ); Tue, 27 Oct 2020 10:31:15 -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 C441C20754; Tue, 27 Oct 2020 14:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809075; bh=2kuZP5vndc47XkvVWqZbxCy/vUYb5FUlMMklHag2ST0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLRL3ZGc6RAmzLdvIdx+0lvw6nEoCV4LRQGRlkN2GvuNBrEvyFCTaucFZjc+QjBgt bxN5pXF1A3f7Ft5uthfcsk6C8wgo1nMSwx56j98PRo9niCwVFCaWuOV/wpsVReKcga kOdQzCfEneWz7GV6Ck97uw4gzurl2BVJJgW3ADxs= 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.4 049/408] KVM: nVMX: Reload vmcs01 if getting vmcs12s pages fails Date: Tue, 27 Oct 2020 14:49:47 +0100 Message-Id: <20201027135457.341683029@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 @@ -3096,8 +3096,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);