]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
x86/speculation: Rework speculative_store_bypass_update()
authorThomas Gleixner <tglx@linutronix.de>
Thu, 10 May 2018 18:31:44 +0000 (20:31 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 May 2018 07:59:19 +0000 (09:59 +0200)
The upcoming support for the virtual SPEC_CTRL MSR on AMD needs to reuse
speculative_store_bypass_update() to avoid code duplication. Add an
argument for supplying a thread info (TIF) value and create a wrapper
speculative_store_bypass_update_current() which is used at the existing
call site.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CVE-2018-3639 (x86)

(cherry-picked from commit 0270be3e34efb05a88bc4c422572ece038ef3608)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/include/asm/spec-ctrl.h
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/process.c

index ab43063d8dc918fd4ccfbb79b382a456cdb8f23f..3d5b620d73079333b240b1a15c51416cc0b867a4 100644 (file)
@@ -58,6 +58,11 @@ extern void speculative_store_bypass_ht_init(void);
 static inline void speculative_store_bypass_ht_init(void) { }
 #endif
 
-extern void speculative_store_bypass_update(void);
+extern void speculative_store_bypass_update(unsigned long tif);
+
+static inline void speculative_store_bypass_update_current(void)
+{
+       speculative_store_bypass_update(current_thread_info()->flags);
+}
 
 #endif
index 63e490fd0830d060387d6cd6faf0b7d3be49928d..8f1bc5560fd88dcaad9df827af55d0b76cfdc7c8 100644 (file)
@@ -557,7 +557,7 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl)
         * mitigation until it is next scheduled.
         */
        if (task == current && update)
-               speculative_store_bypass_update();
+               speculative_store_bypass_update_current();
 
        return 0;
 }
index 4d8fbdf8935fec02434e0eab145631c72c64e9e3..acf2e9368cf7a9d64db0da238fd420bd221694bc 100644 (file)
@@ -414,10 +414,10 @@ static __always_inline void __speculative_store_bypass_update(unsigned long tifn
                intel_set_ssb_state(tifn);
 }
 
-void speculative_store_bypass_update(void)
+void speculative_store_bypass_update(unsigned long tif)
 {
        preempt_disable();
-       __speculative_store_bypass_update(current_thread_info()->flags);
+       __speculative_store_bypass_update(tif);
        preempt_enable();
 }