Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3120092rwb; Mon, 15 Aug 2022 18:36:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR6C6uBt2kgS1hKFX92W/ERnxSuqtVGbAcnJV07psKUhDmDJ13R/FEuNEMWmdcCatw+F8snk X-Received: by 2002:a17:90b:907:b0:1f7:6b77:dcbc with SMTP id bo7-20020a17090b090700b001f76b77dcbcmr31132276pjb.244.1660613798682; Mon, 15 Aug 2022 18:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613798; cv=none; d=google.com; s=arc-20160816; b=mc/4lvOVF+PmRsZ8JIbXvpauVnX7yNh+Ka3o5IBmAHjh4xDUOa0b7O+BWdOntj5nRz rlARZRDkN0lITmSjFGQrc73h2uzfCTrRJEHQ0vPDCDttSTDOvNbYHdedTPyjGW3hzKmf JPniqVtcRZl/o3FXs5TRRsAuwh5Q4u9esa5rBbX9psG5WvCtPCocTdcwp5JfRc14qP0+ W6Fs3XpqVbvewlQhV2Z5GEERAaRFkZ/BP94o1Km8TG0mpf7fAaU0ZOqDlAaIZMZJWgHg 88cHkRSxiPQ6gra+GJ4J9Y9DM4s3I5WLTjvtpw4XhEd9QhQoyTKlQzhoZdwj0Q/4XgzF hhvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t/yd7hh1788ITVIb4GSw0bNZPMIr5t9XV1xpYPONEek=; b=0uOokPtYBg5nu+w47x2a4t64VwKsTMBwTo2rooVJtSYRaPNcdqv9FNyGkIEUXwJNU4 fr3LYnUmD7xugM0W9IjGVx8t792NkUDV9s1T2wW/lvyKXApUPXTxYhBtazsuG3DxKROZ l+KkFmuhMRjIhluX1K79HBoMqGPIGvJn3yI2tsV4fOipThqc1RAV1cgBGW21AktdngZg GMQmDibRB6Ehyvz5PfcapVRhgpFOBL4LAwltljt0RbQUBgg1Vt5zpKXtcmtzeX29IJuZ RavMulAtQa7k2zkQlHjgV2YQuPa+haUzusq39hQyofL3LlVuggQiAbdU1/R6+EFbVwBW 4ZgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lb3xQSUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s34-20020a635262000000b00419dc0c2d71si12217230pgl.115.2022.08.15.18.36.28; Mon, 15 Aug 2022 18:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lb3xQSUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349917AbiHPAdR (ORCPT + 99 others); Mon, 15 Aug 2022 20:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352792AbiHPAbA (ORCPT ); Mon, 15 Aug 2022 20:31:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AA3185267; Mon, 15 Aug 2022 13:35:57 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 81A1C611D6; Mon, 15 Aug 2022 20:35:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88FFBC433C1; Mon, 15 Aug 2022 20:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595725; bh=tcxpQnCC4FWeaEHBirbSyphnFcmhMM+J6DV5eHnOI8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lb3xQSUWcUF87hp+KS3ANAeqmjBnknQRvpC3TrN1P/TRDoCOBaC2JwXoUJqyg9YVO aJKVtlkiBfLqf5D/lWGONNXpyz/625ZXM4K5q2cfpQBeDYbpQeulFQbib3IzW504Vb yBfhOIjDkKZvc8HuSQue47U1jFR1ZCiiPE/z98IQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.19 0855/1157] KVM: nVMX: Set UMIP bit CR4_FIXED1 MSR when emulating UMIP Date: Mon, 15 Aug 2022 20:03:31 +0200 Message-Id: <20220815180513.685879966@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson [ Upstream commit a910b5ab6b250a88fff1866bf708642d83317466 ] Make UMIP an "allowed-1" bit CR4_FIXED1 MSR when KVM is emulating UMIP. KVM emulates UMIP for both L1 and L2, and so should enumerate that L2 is allowed to have CR4.UMIP=1. Not setting the bit doesn't immediately break nVMX, as KVM does set/clear the bit in CR4_FIXED1 in response to a guest CPUID update, i.e. KVM will correctly (dis)allow nested VM-Entry based on whether or not UMIP is exposed to L1. That said, KVM should enumerate the bit as being allowed from time zero, e.g. userspace will see the wrong value if the MSR is read before CPUID is written. Fixes: 0367f205a3b7 ("KVM: vmx: add support for emulating UMIP") Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-12-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/vmx/nested.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 66735fbb791d..1b9e5bd2f941 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6786,6 +6786,9 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps) rdmsrl(MSR_IA32_VMX_CR0_FIXED1, msrs->cr0_fixed1); rdmsrl(MSR_IA32_VMX_CR4_FIXED1, msrs->cr4_fixed1); + if (vmx_umip_emulated()) + msrs->cr4_fixed1 |= X86_CR4_UMIP; + msrs->vmcs_enum = nested_vmx_calc_vmcs_enum_msr(); } -- 2.35.1