Message ID | 20221003131038.12645-30-cascardo@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1701C4332F for <kvm@archiver.kernel.org>; Mon, 3 Oct 2022 13:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbiJCNNj (ORCPT <rfc822;kvm@archiver.kernel.org>); Mon, 3 Oct 2022 09:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbiJCNNN (ORCPT <rfc822;kvm@vger.kernel.org>); Mon, 3 Oct 2022 09:13:13 -0400 Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050A752DDE; Mon, 3 Oct 2022 06:12:49 -0700 (PDT) Received: from quatroqueijos.. (unknown [179.93.174.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id DE6D142FBB; Mon, 3 Oct 2022 13:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1664802759; bh=IiHUhseaDgub13o9nigORbD3lpcbWJSxiYI+GaZ4KGs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rGsGjI6URkFqCUA94ywsGc37sEomaNclTG8WzQw9MGAGodVu3txJkagZfbKGy8Xtq JEldX9+wVT+f73UAV6JEX98wkvEls9mQCqRM7+B6Cfkj6h0BvDf4lDxrLZizfZ+qu1 AWNV858BXbmyJP7bZKzBEAb8dwI9PfSwQNR4yl6sX281f9unzBc2sv82DICq3UC9r3 k2vawIIx5dxzspzrId2nl92hY9Ls/SxKA7qbITe78yDmx/UKD5Bnf5AFV/q574ZDjX tAn9OsuvBzXgx0DhQeWSq58wbHCy23ffHqaSqff0xIsKqhq6cG8S7sr/7ytrtr3eUT OKCIMpsTx3v5g== From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> To: stable@vger.kernel.org Cc: x86@kernel.org, kvm@vger.kernel.org, bp@alien8.de, pbonzini@redhat.com, peterz@infradead.org, jpoimboe@kernel.org Subject: [PATCH 5.4 29/37] KVM: VMX: Fix IBRS handling after vmexit Date: Mon, 3 Oct 2022 10:10:30 -0300 Message-Id: <20221003131038.12645-30-cascardo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221003131038.12645-1-cascardo@canonical.com> References: <20221003131038.12645-1-cascardo@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org |
Series |
IBRS support // Retbleed mitigations
|
expand
|
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 85d5dfb261f5..d522c9de41df 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6571,8 +6571,13 @@ void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx, /* * If the guest/host SPEC_CTRL values differ, restore the host value. + * + * For legacy IBRS, the IBRS bit always needs to be written after + * transitioning from a less privileged predictor mode, regardless of + * whether the guest/host values differ. */ - if (vmx->spec_ctrl != hostval) + if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) || + vmx->spec_ctrl != hostval) native_wrmsrl(MSR_IA32_SPEC_CTRL, hostval); barrier_nospec();