From mboxrd@z Thu Jan 1 00:00:00 1970 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 ED6A3275855; Mon, 14 Apr 2025 13:32:36 +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=1744637557; cv=none; b=r17fykL+rTUTD2cKSrQeP1ckc2i+KTPHMy65fn8hRC5+h1lopyy6V3ivaWl+CucR4rBAi2jbyKLVaIP4jm9TQhDCOYdYKhmCrqZOeOC58DaLg2sIBQj+hMYW3D4HSspmzCHkhiCN5VOVF8Yalo0GFnE8CgSf5q6+r+bvLn91Hi8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744637557; c=relaxed/simple; bh=xSAkdHyLm0BbLTXjNPY0QAHDsgE7I90h6SKsfhAiTuI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BIZPHfFFD9T9TpmxttEdCm3Rvubc6nQISO8vwEeTWY4yDj488hHZGXu+RYehst43GafRN+WbStXbNowF7Ip0PfP9EQOKysy5awcQ3mcz3Cc1dGfVHsTerG9LpRJr2JH7O/QPpNugVVZKQsC8D8XFtM+cBkPMKRnzK0NhdvVQcOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gdxM7q++; 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="gdxM7q++" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1213EC4CEE2; Mon, 14 Apr 2025 13:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744637556; bh=xSAkdHyLm0BbLTXjNPY0QAHDsgE7I90h6SKsfhAiTuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdxM7q++0D7EdlLkUv4QJJOgHUfQ5fB7wpIHWpq+d0oKriQuC5qeSXBA4kc5rlEhW ts7fHh2uKkVYTpJY9ZQggKZCErm7yELai8ZXoj7Mk5KR/u99lSwMhcg4lbI17Y2Zfb ub05DCrPalWfY4XKGWUnp8qVJIyqvA+PmHrYVz453DrDpkBhxcu3NCLrYdDOG8MGAa l3GqI8i7Mu99zIq/YZzgkNoLcVv27xkYPPvI0NKpuph9DQvgFiJVM5GvNfZ/T0kUoc 9iv4y5WdbpMC4UxTGIJs5EyHFloqkDp7TnlkQ0dXhfvLPsCaazG4putax8NN3jQqSv AsNsRTVIMGecg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josh Poimboeuf , Pawan Gupta , Ingo Molnar , Amit Shah , Nikolay Borisov , Paolo Bonzini , Vitaly Kuznetsov , Sean Christopherson , David Woodhouse , Sasha Levin , tglx@linutronix.de, bp@alien8.de, peterz@infradead.org, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org Subject: [PATCH AUTOSEL 5.4 5/5] x86/bugs: Don't fill RSB on VMEXIT with eIBRS+retpoline Date: Mon, 14 Apr 2025 09:32:23 -0400 Message-Id: <20250414133223.681195-5-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250414133223.681195-1-sashal@kernel.org> References: <20250414133223.681195-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.292 Content-Transfer-Encoding: 8bit From: Josh Poimboeuf [ Upstream commit 18bae0dfec15b24ec14ca17dc18603372f5f254f ] 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 Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Reviewed-by: Pawan Gupta Reviewed-by: Amit Shah Reviewed-by: Nikolay Borisov Cc: Paolo Bonzini Cc: Vitaly Kuznetsov Cc: Sean Christopherson Cc: David Woodhouse Link: https://lore.kernel.org/r/84a1226e5c9e2698eae1b5ade861f1b8bf3677dc.1744148254.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin --- 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 af748d1c78d41..4f803aed2ef0e 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1348,20 +1348,20 @@ static void __init spectre_v2_determine_rsb_fill_type_at_vmexit(enum spectre_v2_ case SPECTRE_V2_NONE: return; - 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; - 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; } -- 2.39.5