Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp337129pxb; Mon, 16 Aug 2021 06:36:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4s5wK2nIj0F1hEewLoeQXAnBeutuFtfTUdl3D6EQsAPlKHd/NCHH5kTcmQUwsTfuJuB80 X-Received: by 2002:a17:906:ced1:: with SMTP id si17mr15531168ejb.506.1629121019100; Mon, 16 Aug 2021 06:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629121019; cv=none; d=google.com; s=arc-20160816; b=dqtMfQNf+Ne6LpvMxeiIzqlqu4BilI/hsVIg0QwcOPCLOuvNhJp8OO3lPpQeFkhxBN AI8F9qnn9PBk+iVBoIh0jaZcew1NnpFIFzufnCcQNG/vZjxc9RXKzGsllTAnzm+rVTNT 6OYZpdSa9EiF0Npljh86Tx8+7YHJhJu7SMCcKEPavo/j/HBK4mFxxepQxt+e3x/CQsSv kaIJv8YVr3BYSWkOfhE2C6sSIswIZauwtE343piS/XWsEr2OTmmjuj/yXHRfyXv8N9PJ qJKmj7PnAMluURJdlpWA5WJuwlvWNvfQI57Fq9NfVLfDwu5bZDgeAoMQa8BAYYzqdkOj iG0w== 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=2aeIVpDX8V4geIDuJUQ0CteE9h9VUoqNoUtVETeHTdY=; b=Vnuljrt+/CjF43bLOPV4nObPN8ne+6jSNx0mZpl4/cB5msFWffQTL0asKsQRYPC1AO 6sVYArLog0TdxwLbqhZt3NFIHmvj62Y5ArRIy+CYFtoUx86OBDxrp7XXY7VbbbThU8TW n2r3+V6ZWZdVN4/9ZZrPwHyDOzd5WMsRklFDppzty9xseKh4uJqfdvseGKBOt0YA+40C fmHEzuJEacdQO5Snydeknczb5Fup7z+g2WVN4lpiM/kfLIScxQ1sMmD+QWOdtCww/74i saif+pFY08DtCytdNriS244co2VNYRWURCl+V5sZlskPJDeA04jDt7LURTzFuWgFwI0H NWDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DQuAOFU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si11350652eds.165.2021.08.16.06.36.35; Mon, 16 Aug 2021 06:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DQuAOFU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S240852AbhHPNcb (ORCPT + 99 others); Mon, 16 Aug 2021 09:32:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240946AbhHPNUY (ORCPT ); Mon, 16 Aug 2021 09:20:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7D3C3632D0; Mon, 16 Aug 2021 13:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629119739; bh=c+B2Q63swed6lgVACd+RD2REdEKCYunUhrIZzk7deD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQuAOFU171sGiS4vKeyMdqGcuExr/4FISchhLZL4lMSY0s6Vj3v8arqM7nMvpGZaN 6cd9Ybj7ya1VqPzrYMfYy68WnbGm6js5jREiBZTPtPYv28yPLaYAbS5OUkcU/yMJjG cpZC0zuQp0SIGaoGJR6ZD96OublLQijJhM2uCd9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.13 144/151] KVM: VMX: Use current VMCS to query WAITPKG support for MSR emulation Date: Mon, 16 Aug 2021 15:02:54 +0200 Message-Id: <20210816125448.816970866@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210816125444.082226187@linuxfoundation.org> References: <20210816125444.082226187@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 7b9cae027ba3aaac295ae23a62f47876ed97da73 upstream. Use the secondary_exec_controls_get() accessor in vmx_has_waitpkg() to effectively get the controls for the current VMCS, as opposed to using vmx->secondary_exec_controls, which is the cached value of KVM's desired controls for vmcs01 and truly not reflective of any particular VMCS. While the waitpkg control is not dynamic, i.e. vmcs01 will always hold the same waitpkg configuration as vmx->secondary_exec_controls, the same does not hold true for vmcs02 if the L1 VMM hides the feature from L2. If L1 hides the feature _and_ does not intercept MSR_IA32_UMWAIT_CONTROL, L2 could incorrectly read/write L1's virtual MSR instead of taking a #GP. Fixes: 6e3ba4abcea5 ("KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20210810171952.2758100-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/vmx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -538,7 +538,7 @@ static inline void decache_tsc_multiplie static inline bool vmx_has_waitpkg(struct vcpu_vmx *vmx) { - return vmx->secondary_exec_control & + return secondary_exec_controls_get(vmx) & SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE; }