Skip to content

Commit 98c7a71

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add X86_BUG_SPECTRE_V2_USER
All CPU vulnerabilities with command line options map to a single X86_BUG bit except for Spectre V2 where both the spectre_v2 and spectre_v2_user command line options are related to the same bug. The spectre_v2 command line options mostly relate to user->kernel and guest->host mitigations, while the spectre_v2_user command line options relate to user->user or guest->guest protections. Define a new X86_BUG bit for spectre_v2_user so each *_select_mitigation() function in bugs.c is related to a unique X86_BUG bit. No functional changes. Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20250108202515.385902-2-david.kaplan@amd.com
1 parent 8f64eee commit 98c7a71

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,4 +537,5 @@
537537
#define X86_BUG_RFDS X86_BUG(1*32 + 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
538538
#define X86_BUG_BHI X86_BUG(1*32 + 3) /* "bhi" CPU is affected by Branch History Injection */
539539
#define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4) /* "ibpb_no_ret" IBPB omits return target predictions */
540+
#define X86_BUG_SPECTRE_V2_USER X86_BUG(1*32 + 5) /* "spectre_v2_user" CPU is affected by Spectre variant 2 attack between user processes */
540541
#endif /* _ASM_X86_CPUFEATURES_H */

arch/x86/kernel/cpu/common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,10 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
13311331

13321332
setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
13331333

1334-
if (!cpu_matches(cpu_vuln_whitelist, NO_SPECTRE_V2))
1334+
if (!cpu_matches(cpu_vuln_whitelist, NO_SPECTRE_V2)) {
13351335
setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
1336+
setup_force_cpu_bug(X86_BUG_SPECTRE_V2_USER);
1337+
}
13361338

13371339
if (!cpu_matches(cpu_vuln_whitelist, NO_SSB) &&
13381340
!(x86_arch_cap_msr & ARCH_CAP_SSB_NO) &&

0 commit comments

Comments
 (0)