Skip to content

Commit 4b0a180

Browse files
dkaplan2Ulrich Hecht
authored andcommitted
x86/bugs: Fix reporting of LFENCE retpoline
[ Upstream commit d1cc1baef67ac6c09b74629ca053bf3fb812f7dc ] The LFENCE retpoline mitigation is not secure but the kernel prints inconsistent messages about this fact. The dmesg log says 'Mitigation: LFENCE', implying the system is mitigated. But sysfs reports 'Vulnerable: LFENCE' implying the system (correctly) is not mitigated. Fix this by printing a consistent 'Vulnerable: LFENCE' string everywhere when this mitigation is selected. Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250915134706.3201818-1-david.kaplan@amd.com Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 0ce1519 commit 4b0a180

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

arch/x86/kernel/cpu/bugs.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ spectre_v2_user_select_mitigation(void)
11881188
static const char * const spectre_v2_strings[] = {
11891189
[SPECTRE_V2_NONE] = "Vulnerable",
11901190
[SPECTRE_V2_RETPOLINE] = "Mitigation: Retpolines",
1191-
[SPECTRE_V2_LFENCE] = "Mitigation: LFENCE",
1191+
[SPECTRE_V2_LFENCE] = "Vulnerable: LFENCE",
11921192
[SPECTRE_V2_EIBRS] = "Mitigation: Enhanced / Automatic IBRS",
11931193
[SPECTRE_V2_EIBRS_LFENCE] = "Mitigation: Enhanced / Automatic IBRS + LFENCE",
11941194
[SPECTRE_V2_EIBRS_RETPOLINE] = "Mitigation: Enhanced / Automatic IBRS + Retpolines",
@@ -2269,9 +2269,6 @@ static char *pbrsb_eibrs_state(void)
22692269

22702270
static ssize_t spectre_v2_show_state(char *buf)
22712271
{
2272-
if (spectre_v2_enabled == SPECTRE_V2_LFENCE)
2273-
return sysfs_emit(buf, "Vulnerable: LFENCE\n");
2274-
22752272
if (spectre_v2_enabled == SPECTRE_V2_EIBRS && unprivileged_ebpf_enabled())
22762273
return sysfs_emit(buf, "Vulnerable: eIBRS with unprivileged eBPF\n");
22772274

0 commit comments

Comments
 (0)