Commit 7526685d authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Juerg Haefliger

UBUNTU: SAUCE: x86/speculation: Create spec-ctrl.h to avoid include hell

CVE-2018-3639 (x86)

Having everything in nospec-branch.h creates a hell of dependencies when
adding the prctl based switching mechanism. Move everything which is not
required in nospec-branch.h to spec-ctrl.h and fix up the includes in the
relevant files.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>

[tyhicks: Minor backport for context]
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
[juergh: Context adjustments.]
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
parent 4fef74f2
...@@ -205,26 +205,12 @@ enum spectre_v2_mitigation { ...@@ -205,26 +205,12 @@ enum spectre_v2_mitigation {
extern void x86_spec_ctrl_set(u64); extern void x86_spec_ctrl_set(u64);
extern u64 x86_spec_ctrl_get_default(void); extern u64 x86_spec_ctrl_get_default(void);
/*
* On VMENTER we must preserve whatever view of the SPEC_CTRL MSR
* the guest has, while on VMEXIT we restore the host view. This
* would be easier if SPEC_CTRL were architecturally maskable or
* shadowable for guests but this is not (currently) the case.
* Takes the guest view of SPEC_CTRL MSR as a parameter.
*/
extern void x86_spec_ctrl_set_guest(u64);
extern void x86_spec_ctrl_restore_host(u64);
/* The Speculative Store Bypass disable variants */ /* The Speculative Store Bypass disable variants */
enum ssb_mitigation { enum ssb_mitigation {
SPEC_STORE_BYPASS_NONE, SPEC_STORE_BYPASS_NONE,
SPEC_STORE_BYPASS_DISABLE, SPEC_STORE_BYPASS_DISABLE,
}; };
/* AMD specific Speculative Store Bypass MSR data */
extern u64 x86_amd_ls_cfg_base;
extern u64 x86_amd_ls_cfg_rds_mask;
extern char __indirect_thunk_start[]; extern char __indirect_thunk_start[];
extern char __indirect_thunk_end[]; extern char __indirect_thunk_end[];
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_SPECCTRL_H_
#define _ASM_X86_SPECCTRL_H_
#include <asm/nospec-branch.h>
/*
* On VMENTER we must preserve whatever view of the SPEC_CTRL MSR
* the guest has, while on VMEXIT we restore the host view. This
* would be easier if SPEC_CTRL were architecturally maskable or
* shadowable for guests but this is not (currently) the case.
* Takes the guest view of SPEC_CTRL MSR as a parameter.
*/
extern void x86_spec_ctrl_set_guest(u64);
extern void x86_spec_ctrl_restore_host(u64);
/* AMD specific Speculative Store Bypass MSR data */
extern u64 x86_amd_ls_cfg_base;
extern u64 x86_amd_ls_cfg_rds_mask;
#endif
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/nospec-branch.h> #include <asm/spec-ctrl.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/pci-direct.h> #include <asm/pci-direct.h>
#include <asm/delay.h> #include <asm/delay.h>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/nospec-branch.h> #include <asm/spec-ctrl.h>
#include <asm/cmdline.h> #include <asm/cmdline.h>
#include <asm/bugs.h> #include <asm/bugs.h>
#include <asm/processor.h> #include <asm/processor.h>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/debugreg.h> #include <asm/debugreg.h>
#include <asm/kvm_para.h> #include <asm/kvm_para.h>
#include <asm/nospec-branch.h> #include <asm/spec-ctrl.h>
#include <asm/virtext.h> #include <asm/virtext.h>
#include "trace.h" #include "trace.h"
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/irq_remapping.h> #include <asm/irq_remapping.h>
#include <asm/nospec-branch.h> #include <asm/spec-ctrl.h>
#include <asm/microcode.h> #include <asm/microcode.h>
#include "trace.h" #include "trace.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment