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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 8AA0EC76191 for ; Fri, 26 Jul 2019 15:36:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 560E82054F for ; Fri, 26 Jul 2019 15:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564155369; bh=H+PFAhJnfasRI2CQQwAOMPBazNoKG0UptdFUcKC+uqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KrfBkQW07FkZsLCzGR9KpfUGO5UW9rB306HA/dpeUZJbjUhmBFKnUDkP1uUYAo4Kc 0ubRiJcxLkpKpqbsPN0VmfNo3hHZuQsIcJ7bgeaRZ3GpY1xeCtDmTSBQLP/5UcT/m8 OEduo0DGh0IIelKAPLECRnmyqr/Nm90DWPpXU9AI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389367AbfGZPcB (ORCPT ); Fri, 26 Jul 2019 11:32:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388577AbfGZPby (ORCPT ); Fri, 26 Jul 2019 11:31:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D366922CD1; Fri, 26 Jul 2019 15:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564155113; bh=H+PFAhJnfasRI2CQQwAOMPBazNoKG0UptdFUcKC+uqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qIsx4s1yyGIJzMObshp0+zJc+NZFmGitfuwY8jL61moxe/F+/eTXoLqZ1ZM1g9ZaL +TSoGa6M9TCCusgYp07GH4Ks5BHhKq/JbZGbtphTdR4PLZXoou3ZwDLxypsxnxrtbS 73tWcWgvc5NjDpv74gud8LQMuanx2YTZMuZ1NQnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kiszka , Liran Alon , Paolo Bonzini Subject: [PATCH 5.1 58/62] KVM: nVMX: Clear pending KVM_REQ_GET_VMCS12_PAGES when leaving nested Date: Fri, 26 Jul 2019 17:25:10 +0200 Message-Id: <20190726152308.052374385@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726152301.720139286@linuxfoundation.org> References: <20190726152301.720139286@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kiszka commit cf64527bb33f6cec2ed50f89182fc4688d0056b6 upstream. Letting this pend may cause nested_get_vmcs12_pages to run against an invalid state, corrupting the effective vmcs of L1. This was triggerable in QEMU after a guest corruption in L2, followed by a L1 reset. Signed-off-by: Jan Kiszka Reviewed-by: Liran Alon Cc: stable@vger.kernel.org Fixes: 7f7f1ba33cf2 ("KVM: x86: do not load vmcs12 pages while still in SMM") Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -212,6 +212,8 @@ static void free_nested(struct kvm_vcpu if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) return; + kvm_clear_request(KVM_REQ_GET_VMCS12_PAGES, vcpu); + vmx->nested.vmxon = false; vmx->nested.smm.vmxon = false; free_vpid(vmx->nested.vpid02);