]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/cpufeatures: Add X86_BUG_CPU_MELTDOWN
authorKanth Ghatraju <kanth.ghatraju@oracle.com>
Thu, 11 Jan 2018 21:52:30 +0000 (16:52 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 17 Jan 2018 20:20:54 +0000 (15:20 -0500)
Add the BUG bit to indicate that the CPU is affected by the leak due to
lack of isolation of kernel and user space page tables.  Currently AMD
CPUs are not affected by this.

Orabug: 27353383

Signed-off-by: Kanth Ghatraju <kanth.ghatraju@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/include/asm/cpufeature.h
arch/x86/kernel/cpu/common.c

index 3afc42414a4cbf1edfa9b7a63f1340e7483e7ad7..ad042957d1f4b2659d5c45b01e8c8e13cc359894 100644 (file)
 #define X86_BUG_CLFLUSH_MONITOR        X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
 #define X86_BUG_SYSRET_SS_ATTRS        X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
 
+/*Keep the bits consistent with upstream */
+#define X86_BUG_CPU_MELTDOWN   X86_BUG(14) /* CPU is insecure and need PTI */
+
 #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
 
 #include <asm/asm.h>
@@ -361,6 +364,8 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
        set_bit(bit, (unsigned long *)cpu_caps_set);    \
 } while (0)
 
+#define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
+
 #define cpu_has_fpu            boot_cpu_has(X86_FEATURE_FPU)
 #define cpu_has_de             boot_cpu_has(X86_FEATURE_DE)
 #define cpu_has_pse            boot_cpu_has(X86_FEATURE_PSE)
index ecc4c2cf47c99c0c5880f3c1fd897fba8866f9af..bb29cca8b84a600e7f9c2c290cf43c2986c3162a 100644 (file)
@@ -842,6 +842,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
                this_cpu->c_bsp_init(c);
 
        setup_force_cpu_cap(X86_FEATURE_ALWAYS);
+
+       if (c->x86_vendor != X86_VENDOR_AMD)
+               setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN);
 }
 
 void __init early_cpu_init(void)