From nobody Thu Apr 10 18:34:30 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 892DE1EB183; Wed, 2 Apr 2025 18:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743618000; cv=none; b=E72FPENkk5pJBKuWqCoM8DbyUylrWz1jKwR/KBqy1QeitfCSs1bad54yjviHk3S5b9/M2tiYzLR97Oo7AK6zJgGtD4mgbBWg5qKeS+uPaQQ/Kbv76rW9QNAOov9uA12kv+jlr08/Nr9wd2EbvUZ9Tmtdl7//vVfcLD0M0ZISYVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743618000; c=relaxed/simple; bh=7LwnFejQ/r4nazVJxKxvMgFD1Q5sOegQn9QdjI3vu+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aF3+fUbYvk47ZhQ96LL7XXNjY0zdEroI+jvksC7AsdgAaQIBWlnaEn/wy6UZDqjSFn75pHJfAS8+M48y3nYI+SzDg/ByAr9X1hSSiRfKmsFXiFSwkKx54Qm5ht4tY5iURU/+eDNqjbD/ckAotC5N3UuXwxl99HjNTf+Eg4Vaowo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y4bjEsyc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y4bjEsyc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 280A7C4CEF0; Wed, 2 Apr 2025 18:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743618000; bh=7LwnFejQ/r4nazVJxKxvMgFD1Q5sOegQn9QdjI3vu+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4bjEsyc9+W+AjGTkFexf1niDmh2IBf0kzAbqZAOdJK/P8gRT9kCf3W9tdnTJRhc7 OKkyl4Lq8MPvqPCGmgucUy0wW/r3vhyyF1PreOiwuBBbutOEDGfIY0HnUcZ31fGegn Wl92MW9O24nn3MWkbrqR/S3nAGM959xj38G5M3MBacjMhUGGDlcT/SDBgQsX87gEuB TllrvbnpCMRVtvTNIEasjcePSAfLe+10P4J/LLiA8QroBESD7lOxSTHcKujz+eg5A/ i/nD1ga69BS04dijSmtYakXNYWGtOBIx1pfzouw1/ZyVF4VhQEWdBsk6G1jCjp7Ofk U6GcGLaxTGxtg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, amit@kernel.org, kvm@vger.kernel.org, amit.shah@amd.com, thomas.lendacky@amd.com, bp@alien8.de, tglx@linutronix.de, peterz@infradead.org, pawan.kumar.gupta@linux.intel.com, corbet@lwn.net, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, daniel.sneddon@linux.intel.com, kai.huang@intel.com, sandipan.das@amd.com, boris.ostrovsky@oracle.com, Babu.Moger@amd.com, david.kaplan@amd.com, dwmw@amazon.co.uk, andrew.cooper3@citrix.com Subject: [PATCH v3 4/6] x86/bugs: Don't fill RSB on VMEXIT with eIBRS+retpoline Date: Wed, 2 Apr 2025 11:19:21 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" eIBRS protects against guest->host RSB underflow/poisoning attacks. Adding retpoline to the mix doesn't change that. Retpoline has a balanced CALL/RET anyway. So the current full RSB filling on VMEXIT with eIBRS+retpoline is overkill. Disable it or do the VMEXIT_LITE mitigation if needed. Suggested-by: Pawan Gupta Reviewed-by: Pawan Gupta Reviewed-by: Amit Shah Signed-off-by: Josh Poimboeuf Reviewed-by: Nikolay Borisov --- arch/x86/kernel/cpu/bugs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 9f9637cff7a3..354411fd4800 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1617,20 +1617,20 @@ static void __init spectre_v2_determine_rsb_fill_ty= pe_at_vmexit(enum spectre_v2_ case SPECTRE_V2_NONE: return; =20 - case SPECTRE_V2_EIBRS_LFENCE: case SPECTRE_V2_EIBRS: + case SPECTRE_V2_EIBRS_LFENCE: + case SPECTRE_V2_EIBRS_RETPOLINE: if (boot_cpu_has_bug(X86_BUG_EIBRS_PBRSB)) { - setup_force_cpu_cap(X86_FEATURE_RSB_VMEXIT_LITE); pr_info("Spectre v2 / PBRSB-eIBRS: Retire a single CALL on VMEXIT\n"); + setup_force_cpu_cap(X86_FEATURE_RSB_VMEXIT_LITE); } return; =20 - case SPECTRE_V2_EIBRS_RETPOLINE: case SPECTRE_V2_RETPOLINE: case SPECTRE_V2_LFENCE: case SPECTRE_V2_IBRS: - setup_force_cpu_cap(X86_FEATURE_RSB_VMEXIT); pr_info("Spectre v2 / SpectreRSB : Filling RSB on VMEXIT\n"); + setup_force_cpu_cap(X86_FEATURE_RSB_VMEXIT); return; } =20 --=20 2.48.1