mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-20 21:24:51 -04:00
x86/bugs: Add attack vector controls for retbleed
Use attack vector controls to determine if retbleed mitigation is required. Disable SMT if cross-thread protection is desired and STIBP is not available. Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250707183316.1349127-13-david.kaplan@amd.com
This commit is contained in:
committed by
Borislav Petkov (AMD)
parent
19a5f3ea43
commit
9687eb2399
@@ -1313,7 +1313,7 @@ early_param("retbleed", retbleed_parse_cmdline);
|
||||
|
||||
static void __init retbleed_select_mitigation(void)
|
||||
{
|
||||
if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off()) {
|
||||
if (!boot_cpu_has_bug(X86_BUG_RETBLEED)) {
|
||||
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
|
||||
return;
|
||||
}
|
||||
@@ -1350,6 +1350,11 @@ static void __init retbleed_select_mitigation(void)
|
||||
if (retbleed_mitigation != RETBLEED_MITIGATION_AUTO)
|
||||
return;
|
||||
|
||||
if (!should_mitigate_vuln(X86_BUG_RETBLEED)) {
|
||||
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Intel mitigation selected in retbleed_update_mitigation() */
|
||||
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
|
||||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
|
||||
@@ -1373,7 +1378,7 @@ static void __init retbleed_select_mitigation(void)
|
||||
|
||||
static void __init retbleed_update_mitigation(void)
|
||||
{
|
||||
if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off())
|
||||
if (!boot_cpu_has_bug(X86_BUG_RETBLEED))
|
||||
return;
|
||||
|
||||
/* ITS can also enable stuffing */
|
||||
@@ -1468,7 +1473,7 @@ static void __init retbleed_apply_mitigation(void)
|
||||
}
|
||||
|
||||
if (mitigate_smt && !boot_cpu_has(X86_FEATURE_STIBP) &&
|
||||
(retbleed_nosmt || cpu_mitigations_auto_nosmt()))
|
||||
(retbleed_nosmt || smt_mitigations == SMT_MITIGATIONS_ON))
|
||||
cpu_smt_disable(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user