From 00201d3c0f34c4763a6d455f3632e99a905e7c52 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 29 Jan 2018 14:42:32 -0500 Subject: [PATCH] x86/mitigation/spectre_v2: Add reporting of 'lfence' if IBRS is off, but we do have 'lfence' enabled. Obviously if 'lfence' is IBRS and 'nolfence' has been used - we print that too. OraBug: 27472666 Reviewed-by: John Haxby Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/include/asm/spec_ctrl.h | 3 +++ arch/x86/kernel/cpu/bugs_64.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h index ce23ed0fb502..07797fefedae 100644 --- a/arch/x86/include/asm/spec_ctrl.h +++ b/arch/x86/include/asm/spec_ctrl.h @@ -263,6 +263,9 @@ static inline void clear_ibrs_disabled(void) } extern u32 sysctl_lfence_enabled; + +#define lfence_inuse (!(use_ibrs & SPEC_CTRL_LFENCE_OFF)) + static inline void set_lfence_disabled(void) { use_ibrs |= SPEC_CTRL_LFENCE_OFF; diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index b54a1cc6e91e..3e437853d21f 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -145,10 +145,12 @@ ssize_t cpu_show_spectre_v2(struct device *dev, { if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) return sprintf(buf, "Not affected\n"); - if (ibrs_inuse || ibpb_inuse) + if (ibrs_inuse || ibpb_inuse || lfence_inuse) return sprintf(buf, "Mitigation: %s%s\n", - ibrs_inuse ? "IBRS " : "", + ibrs_inuse ? "IBRS " : + lfence_inuse ? "lfence " : "", ibpb_inuse ? "IBPB" : ""); + return sprintf(buf, "Vulnerable\n"); } #endif -- 2.49.0