]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/mitigation/spectre_v2: Add reporting of 'lfence'
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 29 Jan 2018 19:42:32 +0000 (14:42 -0500)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 1 Feb 2018 22:20:06 +0000 (14:20 -0800)
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 <john.haxby@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/include/asm/spec_ctrl.h
arch/x86/kernel/cpu/bugs_64.c

index ce23ed0fb50243f2c61c83af1335206c4130eb55..07797fefedae51e5eb59d502cfa37eae1bde2b71 100644 (file)
@@ -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;
index b54a1cc6e91e49c1fad1e0ed842169089dcdeb01..3e437853d21f46a8bbce3f14fdf4753557d5fcc5 100644 (file)
@@ -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