Linux 4.9.176
Greg KH
maintainerI'm announcing the release of the 4.9.176 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/ABI/testing/sysfs-devices-system-cpu | 4 Documentation/hw-vuln/index.rst | 13 Documentation/hw-vuln/l1tf.rst | 615 +++++++++++++++++++ Documentation/hw-vuln/mds.rst | 308 +++++++++ Documentation/index.rst | 19 Documentation/kernel-parameters.txt | 119 +++ Documentation/l1tf.rst | 610 ------------------- Documentation/spec_ctrl.txt | 9 Documentation/x86/conf.py | 10 Documentation/x86/index.rst | 8 Documentation/x86/mds.rst | 225 +++++++ Makefile | 2 arch/x86/Kconfig | 8 arch/x86/entry/common.c | 3 arch/x86/events/intel/core.c | 18 arch/x86/events/intel/cstate.c | 4 arch/x86/events/msr.c | 4 arch/x86/include/asm/cpufeatures.h | 11 arch/x86/include/asm/intel-family.h | 30 arch/x86/include/asm/irqflags.h | 4 arch/x86/include/asm/microcode_intel.h | 15 arch/x86/include/asm/msr-index.h | 40 - arch/x86/include/asm/mwait.h | 7 arch/x86/include/asm/nospec-branch.h | 65 ++ arch/x86/include/asm/pgtable_64.h | 16 arch/x86/include/asm/processor.h | 6 arch/x86/include/asm/spec-ctrl.h | 20 arch/x86/include/asm/switch_to.h | 3 arch/x86/include/asm/thread_info.h | 20 arch/x86/include/asm/tlbflush.h | 8 arch/x86/include/uapi/asm/Kbuild | 1 arch/x86/include/uapi/asm/mce.h | 2 arch/x86/kernel/cpu/bugs.c | 657 +++++++++++++++++---- arch/x86/kernel/cpu/common.c | 139 ++-- arch/x86/kernel/cpu/intel.c | 11 arch/x86/kernel/cpu/mcheck/mce.c | 4 arch/x86/kernel/cpu/microcode/amd.c | 22 arch/x86/kernel/cpu/microcode/intel.c | 70 +- arch/x86/kernel/nmi.c | 4 arch/x86/kernel/process.c | 101 ++- arch/x86/kernel/process.h | 39 + arch/x86/kernel/process_32.c | 9 arch/x86/kernel/process_64.c | 9 arch/x86/kernel/traps.c | 8 arch/x86/kernel/tsc.c | 2 arch/x86/kvm/cpuid.c | 13 arch/x86/kvm/cpuid.h | 2 arch/x86/kvm/svm.c | 2 arch/x86/kvm/vmx.c | 7 arch/x86/mm/init.c | 2 arch/x86/mm/kaiser.c | 4 arch/x86/mm/pgtable.c | 6 arch/x86/mm/tlb.c | 114 ++- arch/x86/platform/atom/punit_atom_debug.c | 4 drivers/acpi/acpi_lpss.c | 2 drivers/base/cpu.c | 8 drivers/cpufreq/intel_pstate.c | 2 drivers/idle/intel_idle.c | 14 drivers/mmc/host/sdhci-acpi.c | 2 drivers/pci/pci-mid.c | 4 drivers/powercap/intel_rapl.c | 8 drivers/thermal/intel_soc_dts_thermal.c | 2 include/linux/bitops.h | 21 include/linux/bits.h | 26 include/linux/cpu.h | 26 include/linux/ptrace.h | 21 include/linux/sched.h | 9 include/linux/sched/smt.h | 20 include/uapi/linux/prctl.h | 1 kernel/cpu.c | 29 kernel/ptrace.c | 10 kernel/sched/core.c | 19 kernel/sched/sched.h | 1 tools/power/x86/turbostat/Makefile | 2 74 files changed, 2662 insertions(+), 1021 deletions(-)
Andi Kleen (3):
x86/speculation/mds: Add basic bug infrastructure for MDS x86/kvm: Expose X86_FEATURE_MD_CLEAR to guests x86/cpu/bugs: Use __initconst for 'const' init data
Ashok Raj (1):
x86/microcode/intel: Check microcode revision before updating sibling threads
Ben Hutchings (2):
x86/cpufeatures: Hide AMD-specific speculation flags
sched: Add sched_smt_active()
Boris Ostrovsky (1):
x86/speculation/mds: Fix comment
Borislav Petkov (1):
x86/microcode/intel: Add a helper which gives the microcode revision
Dominik Brodowski (1):
x86/speculation: Simplify the CPU bug detection logic
Eduardo Habkost (1):
kvm: x86: Report STIBP on GET_SUPPORTED_CPUID
Filippo Sironi (1):
x86/microcode: Update the new microcode revision unconditionally
Greg Kroah-Hartman (1):
Linux 4.9.176
Jiang Biao (1):
x86/speculation: Remove SPECTRE_V2_IBRS in enum spectre_v2_mitigation
Jiri Kosina (3):
x86/speculation: Apply IBPB more strictly to avoid cross-process data leak x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation x86/speculation: Propagate information about RSB filling mitigation to sysfs
Josh Poimboeuf (7):
x86/speculation/mds: Add mds=full,nosmt cmdline option x86/speculation: Move arch_smt_update() call to after mitigation decisions x86/speculation/mds: Add SMT warning message
cpu/speculation: Add 'mitigations=' cmdline option x86/speculation: Support 'mitigations=' cmdline option x86/speculation/mds: Add 'mitigations=' support for MDS x86/speculation/mds: Fix documentation typo
Konrad Rzeszutek Wilk (4):
x86/bugs: Add AMD's variant of SSB_NO
x86/bugs: Add AMD's SPEC_CTRL MSR usage
x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features x86/speculation/mds: Print SMT vulnerable on MSBDS with mitigations off
Matthias Kaehlcke (1):
bitops: avoid integer overflow in GENMASK(_ULL)
Michal Hocko (1):
x86/speculation/l1tf: Drop the swap storage limit restriction when l1tf=off
Nadav Amit (1):
x86/mm: Use WRITE_ONCE() when setting PTEs
Nicolas Dichtel (1):
x86: stop exporting msr-index.h to userland
Peter Zijlstra (1):
x86/cpu: Sanitize FAM6_ATOM naming
Prarit Bhargava (1):
x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
Salvatore Bonaccorso (1):
Documentation/l1tf: Fix small spelling typo
Thomas Gleixner (31):
x86/speculation: Rename SSBD update functions
x86/Kconfig: Select SCHED_SMT if SMP enabled x86/speculation: Rework SMT state change
x86/l1tf: Show actual SMT state
x86/speculation: Reorder the spec_v2 code
x86/speculation: Mark string arrays const correctly x86/speculataion: Mark command line parser data __initdata x86/speculation: Unify conditional spectre v2 print functions x86/speculation: Add command line control for indirect branch speculation x86/process: Consolidate and simplify switch_to_xtra() code x86/speculation: Avoid __switch_to_xtra() calls x86/speculation: Prepare for conditional IBPB in switch_mm() x86/speculation: Split out TIF update
x86/speculation: Prepare arch_smt_update() for PRCTL mode x86/speculation: Prevent stale SPEC_CTRL msr content x86/speculation: Add prctl() control for indirect branch speculation x86/speculation: Enable prctl mode for spectre_v2_user x86/speculation: Add seccomp Spectre v2 user space protection mode x86/speculation: Provide IBPB always command line options x86/msr-index: Cleanup bit defines
x86/speculation: Consolidate CPU whitelists x86/speculation/mds: Add BUG_MSBDS_ONLY
x86/speculation/mds: Add mds_clear_cpu_buffers() x86/speculation/mds: Clear CPU buffers on exit to user x86/kvm/vmx: Add MDS protection when L1D Flush is not active x86/speculation/mds: Conditionally clear CPU buffers on idle entry x86/speculation/mds: Add mitigation control for MDS x86/speculation/mds: Add sysfs reporting for MDS x86/speculation/mds: Add mitigation mode VMWERV
Documentation: Move L1TF to separate directory
Documentation: Add MDS vulnerability documentation
Tim Chen (7):
x86/speculation: Update the TIF_SSBD comment
x86/speculation: Clean up spectre_v2_parse_cmdline() x86/speculation: Remove unnecessary ret variable in cpu_show_common() x86/speculation: Move STIPB/IBPB string conditionals out of cpu_show_common() x86/speculation: Disable STIBP when enhanced IBRS is in use x86/speculation: Reorganize speculation control MSRs update x86/speculation: Prepare for per task indirect branch speculation control
Tom Lendacky (1):
x86/bugs: Fix the AMD SSBD usage of the SPEC_CTRL MSR
Tony Luck (1):
x86/MCE: Save microcode revision in machine check records
Tyler Hicks (1):
Documentation: Correct the possible MDS sysfs values
Will Deacon (1):
locking/atomics, asm-generic: Move some macros from <linux/bitops.h> to a new <linux/bits.h> file
speck for Pawan Gupta (1):
x86/mds: Add MDSUM variant to the MDS documentation
Greg KH
maintainerDocumentation/ABI/testing/sysfs-devices-system-cpu +2 -2
@@ -357,6 +357,7 @@ What: /sys/devices/system/cpu/vulnerabilities /sys/devices/system/cpu/vulnerabilities/spectre_v2 /sys/devices/system/cpu/vulnerabilities/spec_store_bypass /sys/devices/system/cpu/vulnerabilities/l1tf + /sys/devices/system/cpu/vulnerabilities/mds Date: January 2018 Contact: Linux kernel mailing list <[email protected]> Description: Information about CPU vulnerabilities
@@ -369,8 +370,7 @@ Description: Information about CPU vulnerabilities "Vulnerable" CPU is affected and no mitigation in effect "Mitigation: $M" CPU is affected and mitigation $M is in effect - Details about the l1tf file can be found in - Documentation/admin-guide/l1tf.rst + See also: Documentation/hw-vuln/index.rst What: /sys/devices/system/cpu/smt /sys/devices/system/cpu/smt/active
Documentation/hw-vuln/index.rst new file +13 -0
@@ -0,0 +1,13 @@ +======================== +Hardware vulnerabilities +======================== + +This section describes CPU vulnerabilities and provides an overview of the +possible mitigations along with guidance for selecting mitigations if they +are configurable at compile, boot or run time. + +.. toctree:: + :maxdepth: 1 + + l1tf + mds
Documentation/hw-vuln/l1tf.rst new file +615 -0
615 lines not on this page · raw message
Documentation/hw-vuln/mds.rst new file +308 -0
308 lines not on this page · raw message
Documentation/index.rst +18 -1
@@ -12,7 +12,6 @@ Contents: :maxdepth: 2 kernel-documentation - l1tf development-process/index dev-tools/tools driver-api/index
@@ -20,6 +19,24 @@ Contents: gpu/index 80211/index +This section describes CPU vulnerabilities and their mitigations. + +.. toctree:: + :maxdepth: 1 + + hw-vuln/index + +Architecture-specific documentation +----------------------------------- + +These books provide programming details about architecture-specific +implementation. + +.. toctree:: + :maxdepth: 2 + + x86/index + Indices and tables ==================
Documentation/kernel-parameters.txt +116 -3
159 lines not on this page · raw message
Documentation/l1tf.rst deleted +0 -610
610 lines not on this page · raw message
Documentation/spec_ctrl.txt +9 -0
@@ -92,3 +92,12 @@ Speculation misfeature controls * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_ENABLE, 0, 0); * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0); * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_FORCE_DISABLE, 0, 0); + +- PR_SPEC_INDIR_BRANCH: Indirect Branch Speculation in User Processes + (Mitigate Spectre V2 style attacks against user processes) + + Invocations: + * prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, 0, 0, 0); + * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_ENABLE, 0, 0); + * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_DISABLE, 0, 0); + * prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_FORCE_DISABLE, 0, 0);
Documentation/x86/conf.py new file +10 -0
@@ -0,0 +1,10 @@ +# -*- coding: utf-8; mode: python -*- + +project = "X86 architecture specific documentation" + +tags.add("subproject") + +latex_documents = [ + ('index', 'x86.tex', project, + 'The kernel development community', 'manual'), +]
Documentation/x86/index.rst new file +8 -0
@@ -0,0 +1,8 @@ +========================== +x86 architecture specifics +========================== + +.. toctree:: + :maxdepth: 1 + + mds
Documentation/x86/mds.rst new file +225 -0
225 lines not on this page · raw message
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 175 +SUBLEVEL = 176 EXTRAVERSION = NAME = Roaring Lionus
arch/x86/Kconfig +1 -7
@@ -937,13 +937,7 @@ config NR_CPUS approximately eight kilobytes to the kernel image. config SCHED_SMT - bool "SMT (Hyperthreading) scheduler support" - depends on SMP - ---help--- - SMT scheduler support improves the CPU scheduler's decision making - when dealing with Intel Pentium 4 chips with HyperThreading at a - cost of slightly increased overhead in some places. If unsure say - N here. + def_bool y if SMP config SCHED_MC def_bool y
arch/x86/entry/common.c +3 -0
@@ -28,6 +28,7 @@#include <asm/vdso.h> #include <asm/uaccess.h> #include <asm/cpufeature.h> +#include <asm/nospec-branch.h> #define CREATE_TRACE_POINTS #include <trace/events/syscalls.h>
@@ -206,6 +207,8 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs)#endif user_enter_irqoff (); + +mds_user_clear_cpu_buffers (); }#define SYSCALL_EXIT_WORK_FLAGS \
arch/x86/events/intel/core.c +10 -8
@@ -3750,11 +3750,11 @@ __init int intel_pmu_init(void)pr_cont ("Nehalem events, " );break ; -case INTEL_FAM6_ATOM_PINEVIEW : -case INTEL_FAM6_ATOM_LINCROFT : -case INTEL_FAM6_ATOM_PENWELL : -case INTEL_FAM6_ATOM_CLOVERVIEW : -case INTEL_FAM6_ATOM_CEDARVIEW : +case INTEL_FAM6_ATOM_BONNELL : +case INTEL_FAM6_ATOM_BONNELL_MID : +case INTEL_FAM6_ATOM_SALTWELL : +case INTEL_FAM6_ATOM_SALTWELL_MID : +case INTEL_FAM6_ATOM_SALTWELL_TABLET :memcpy (hw_cache_event_ids, atom_hw_cache_event_ids,sizeof (hw_cache_event_ids));
@@ -3766,9 +3766,11 @@ __init int intel_pmu_init(void)pr_cont ("Atom events, " );break ; -case INTEL_FAM6_ATOM_SILVERMONT1 : -case INTEL_FAM6_ATOM_SILVERMONT2 : +case INTEL_FAM6_ATOM_SILVERMONT : +case INTEL_FAM6_ATOM_SILVERMONT_X : +case INTEL_FAM6_ATOM_SILVERMONT_MID :case INTEL_FAM6_ATOM_AIRMONT : +case INTEL_FAM6_ATOM_AIRMONT_MID :memcpy (hw_cache_event_ids, slm_hw_cache_event_ids,sizeof (hw_cache_event_ids)); memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs,
@@ -3785,7 +3787,7 @@ __init int intel_pmu_init(void)break ;case INTEL_FAM6_ATOM_GOLDMONT : -case INTEL_FAM6_ATOM_DENVERTON : +case INTEL_FAM6_ATOM_GOLDMONT_X :memcpy (hw_cache_event_ids, glm_hw_cache_event_ids,sizeof (hw_cache_event_ids)); memcpy(hw_cache_extra_regs, glm_hw_cache_extra_regs,
arch/x86/events/intel/cstate.c +2 -2
@@ -531,8 +531,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {X86_CSTATES_MODEL (INTEL_FAM6_HASWELL_ULT , hswult_cstates), -X86_CSTATES_MODEL (INTEL_FAM6_ATOM_SILVERMONT1 , slm_cstates), -X86_CSTATES_MODEL (INTEL_FAM6_ATOM_SILVERMONT2 , slm_cstates), +X86_CSTATES_MODEL (INTEL_FAM6_ATOM_SILVERMONT , slm_cstates), +X86_CSTATES_MODEL (INTEL_FAM6_ATOM_SILVERMONT_X , slm_cstates),X86_CSTATES_MODEL (INTEL_FAM6_ATOM_AIRMONT , slm_cstates), X86_CSTATES_MODEL(INTEL_FAM6_BROADWELL_CORE, snb_cstates),
arch/x86/events/msr.c +2 -2
@@ -61,8 +61,8 @@ static bool test_intel(int idx)case INTEL_FAM6_BROADWELL_GT3E :case INTEL_FAM6_BROADWELL_X : -case INTEL_FAM6_ATOM_SILVERMONT1 : -case INTEL_FAM6_ATOM_SILVERMONT2 : +case INTEL_FAM6_ATOM_SILVERMONT : +case INTEL_FAM6_ATOM_SILVERMONT_X :case INTEL_FAM6_ATOM_AIRMONT :if (idx ==PERF_MSR_SMI )return true;
arch/x86/include/asm/cpufeatures.h +8 -3
@@ -271,10 +271,12 @@/* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */ #define X86_FEATURE_CLZERO (13*32+0)/* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+1)/* Instructions Retired Count */ -#define X86_FEATURE_AMD_IBPB (13*32+12)/* Indirect Branch Prediction Barrier */ -#define X86_FEATURE_AMD_IBRS (13*32+14)/* Indirect Branch Restricted Speculation */ -#define X86_FEATURE_AMD_STIBP (13*32+15)/* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_IBPB (13*32+12)/* "" Indirect Branch Prediction Barrier */ +#define X86_FEATURE_AMD_IBRS (13*32+14)/* "" Indirect Branch Restricted Speculation */ +#define X86_FEATURE_AMD_STIBP (13*32+15)/* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_SSBD (13*32+24)/* "" Speculative Store Bypass Disable */ #define X86_FEATURE_VIRT_SSBD (13*32+25)/* Virtualized Speculative Store Bypass Disable */ +#define X86_FEATURE_AMD_SSB_NO (13*32+26)/* "" Speculative Store Bypass is fixed in hardware. */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */
@@ -315,6 +317,7 @@#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2)/* AVX-512 Neural Network Instructions */ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3)/* AVX-512 Multiply Accumulation Single precision */ #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13)/* "" TSX_FORCE_ABORT */ +#define X86_FEATURE_MD_CLEAR (18*32+10)/* VERW clears CPU buffers */ #define X86_FEATURE_PCONFIG (18*32+18)/* Intel PCONFIG */ #define X86_FEATURE_SPEC_CTRL (18*32+26)/* "" Speculation Control (IBRS + IBPB) */ #define X86_FEATURE_INTEL_STIBP (18*32+27)/* "" Single Thread Indirect Branch Predictors */
@@ -352,5 +355,7 @@#define X86_BUG_SPECTRE_V2 X86_BUG(16)/* CPU is affected by Spectre variant 2 attack with indirect branches */ #define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17)/* CPU is affected by speculative store bypass attack */ #define X86_BUG_L1TF X86_BUG(18)/* CPU is affected by L1 Terminal Fault */ +#define X86_BUG_MDS X86_BUG(19)/* CPU is affected by Microarchitectural data sampling */ +#define X86_BUG_MSBDS_ONLY X86_BUG(20)/* CPU is only affected by the MSDBS variant of BUG_MDS */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/intel-family.h +17 -13
@@ -50,19 +50,23 @@/* "Small Core" Processors (Atom) */ -#define INTEL_FAM6_ATOM_PINEVIEW 0x1C -#define INTEL_FAM6_ATOM_LINCROFT 0x26 -#define INTEL_FAM6_ATOM_PENWELL 0x27 -#define INTEL_FAM6_ATOM_CLOVERVIEW 0x35 -#define INTEL_FAM6_ATOM_CEDARVIEW 0x36 -#define INTEL_FAM6_ATOM_SILVERMONT1 0x37/* BayTrail/BYT / Valleyview */ -#define INTEL_FAM6_ATOM_SILVERMONT2 0x4D/* Avaton/Rangely */ -#define INTEL_FAM6_ATOM_AIRMONT 0x4C/* CherryTrail / Braswell */ -#define INTEL_FAM6_ATOM_MERRIFIELD 0x4A/* Tangier */ -#define INTEL_FAM6_ATOM_MOOREFIELD 0x5A/* Anniedale */ -#define INTEL_FAM6_ATOM_GOLDMONT 0x5C -#define INTEL_FAM6_ATOM_DENVERTON 0x5F/* Goldmont Microserver */ -#define INTEL_FAM6_ATOM_GEMINI_LAKE 0x7A +#define INTEL_FAM6_ATOM_BONNELL 0x1C/* Diamondville, Pineview */ +#define INTEL_FAM6_ATOM_BONNELL_MID 0x26/* Silverthorne, Lincroft */ + +#define INTEL_FAM6_ATOM_SALTWELL 0x36/* Cedarview */ +#define INTEL_FAM6_ATOM_SALTWELL_MID 0x27/* Penwell */ +#define INTEL_FAM6_ATOM_SALTWELL_TABLET 0x35/* Cloverview */ + +#define INTEL_FAM6_ATOM_SILVERMONT 0x37/* Bay Trail, Valleyview */ +#define INTEL_FAM6_ATOM_SILVERMONT_X 0x4D/* Avaton, Rangely */ +#define INTEL_FAM6_ATOM_SILVERMONT_MID 0x4A/* Merriefield */ + +#define INTEL_FAM6_ATOM_AIRMONT 0x4C/* Cherry Trail, Braswell */ +#define INTEL_FAM6_ATOM_AIRMONT_MID 0x5A/* Moorefield */ + +#define INTEL_FAM6_ATOM_GOLDMONT 0x5C/* Apollo Lake */ +#define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F/* Denverton */ +#define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A/* Gemini Lake */ /* Xeon Phi */
arch/x86/include/asm/irqflags.h +4 -0
@@ -5,6 +5,8 @@#ifndef __ASSEMBLY__ +#include <asm/nospec-branch.h> +/* Provide __cpuidle; we can't safely include <linux/cpu.h> */ #define __cpuidle __attribute__((__section__(".cpuidle.text")))
@@ -53,11 +55,13 @@ static inline void native_irq_enable(void) static inline __cpuidle void native_safe_halt(void) { +mds_idle_clear_cpu_buffers (); asmvolatile ("sti; hlt" : : :"memory" ); } static inline __cpuidle void native_halt(void) { +mds_idle_clear_cpu_buffers (); asmvolatile ("hlt" : : :"memory" ); }
arch/x86/include/asm/microcode_intel.h +15 -0
@@ -52,6 +52,21 @@ struct extended_sigtable {#define exttable_size (et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) +static inline u32 intel_get_microcode_revision (void ) +{ +u32 rev, dummy; + +native_wrmsrl (MSR_IA32_UCODE_REV ,0 ); + +/* As documented in the SDM: Do a CPUID 1 here */ +sync_core (); + +/* get the current revision from MSR 0x8B */ +native_rdmsr (MSR_IA32_UCODE_REV , dummy, rev); + +return rev; +} +extern int has_newer_microcode (void *mc,unsigned int csig,int cpf,int rev);extern int microcode_sanity_check (void *mc,int print_err);extern int find_matching_signature (void *mc,unsigned int csig,int cpf);
arch/x86/include/asm/msr-index.h +24 -16
@@ -1,6 +1,8 @@#ifndef _ASM_X86_MSR_INDEX_H#define _ASM_X86_MSR_INDEX_H +#include <linux/bits.h> +/* * CPU model specific register (MSR) numbers. *
@@ -38,13 +40,14 @@/* Intel MSRs. Some also available on other CPUs */ #define MSR_IA32_SPEC_CTRL 0x00000048/* Speculation Control */ -#define SPEC_CTRL_IBRS (1 << 0)/* Indirect Branch Restricted Speculation */ -#define SPEC_CTRL_STIBP (1 << 1)/* Single Thread Indirect Branch Predictors */ +#define SPEC_CTRL_IBRS BIT(0)/* Indirect Branch Restricted Speculation */ +#define SPEC_CTRL_STIBP_SHIFT 1/* Single Thread Indirect Branch Predictor (STIBP) bit */ +#define SPEC_CTRL_STIBP BIT(SPEC_CTRL_STIBP_SHIFT)/* STIBP mask */ #define SPEC_CTRL_SSBD_SHIFT 2/* Speculative Store Bypass Disable bit */ -#define SPEC_CTRL_SSBD (1 << SPEC_CTRL_SSBD_SHIFT)/* Speculative Store Bypass Disable */ +#define SPEC_CTRL_SSBD BIT(SPEC_CTRL_SSBD_SHIFT)/* Speculative Store Bypass Disable */ #define MSR_IA32_PRED_CMD 0x00000049/* Prediction Command */ -#define PRED_CMD_IBPB (1 << 0)/* Indirect Branch Prediction Barrier */ +#define PRED_CMD_IBPB BIT(0)/* Indirect Branch Prediction Barrier */ #define MSR_IA32_PERFCTR0 0x000000c1#define MSR_IA32_PERFCTR1 0x000000c2
@@ -61,20 +64,25 @@#define MSR_MTRRcap 0x000000fe#define MSR_IA32_ARCH_CAPABILITIES 0x0000010a -#define ARCH_CAP_RDCL_NO (1 << 0)/* Not susceptible to Meltdown */ -#define ARCH_CAP_IBRS_ALL (1 << 1)/* Enhanced IBRS support */ -#define ARCH_CAP_SKIP_VMENTRY_L1DFLUSH (1 << 3)/* Skip L1D flush on vmentry */ -#define ARCH_CAP_SSB_NO (1 << 4)/* -* Not susceptible to Speculative Store Bypass -* attack, so no Speculative Store Bypass -* control required. -*/ +#define ARCH_CAP_RDCL_NO BIT(0)/* Not susceptible to Meltdown */ +#define ARCH_CAP_IBRS_ALL BIT(1)/* Enhanced IBRS support */ +#define ARCH_CAP_SKIP_VMENTRY_L1DFLUSH BIT(3)/* Skip L1D flush on vmentry */ +#define ARCH_CAP_SSB_NO BIT(4)/* +* Not susceptible to Speculative Store Bypass +* attack, so no Speculative Store Bypass +* control required. +*/ +#define ARCH_CAP_MDS_NO BIT(5)/* +* Not susceptible to +* Microarchitectural Data +* Sampling (MDS) vulnerabilities. +*/ #define MSR_IA32_FLUSH_CMD 0x0000010b -#define L1D_FLUSH (1 << 0)/* -* Writeback and invalidate the -* L1 data cache. -*/ +#define L1D_FLUSH BIT(0)/* +* Writeback and invalidate the +* L1 data cache. +*/ #define MSR_IA32_BBL_CR_CTL 0x00000119#define MSR_IA32_BBL_CR_CTL3 0x0000011e
arch/x86/include/asm/mwait.h +7 -0
@@ -4,6 +4,7 @@#include <linux/sched.h> #include <asm/cpufeature.h> +#include <asm/nospec-branch.h> #define MWAIT_SUBSTATE_MASK 0xf#define MWAIT_CSTATE_MASK 0xf
@@ -38,6 +39,8 @@ static inline void __monitorx(const void *eax, unsigned long ecx,static inline void __mwait (unsigned long eax,unsigned long ecx) { +mds_idle_clear_cpu_buffers (); +/* "mwait %eax, %ecx;" */ asmvolatile (".byte 0x0f, 0x01, 0xc9;" ::"a" (eax),"c" (ecx));
@@ -72,6 +75,8 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)static inline void __mwaitx (unsigned long eax,unsigned long ebx,unsigned long ecx) { +/* No MDS buffer clear as this is AMD/HYGON only */ +/* "mwaitx %eax, %ebx, %ecx;" */ asmvolatile (".byte 0x0f, 0x01, 0xfb;" ::"a" (eax),"b" (ebx),"c" (ecx));
@@ -79,6 +84,8 @@ static inline void __mwaitx(unsigned long eax, unsigned long ebx,static inline void __sti_mwait (unsigned long eax,unsigned long ecx) { +mds_idle_clear_cpu_buffers (); +trace_hardirqs_on ();/* "mwait %eax, %ecx;" */ asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
arch/x86/include/asm/nospec-branch.h +64 -1
86 lines not on this page · raw message
arch/x86/include/asm/pgtable_64.h +8 -8
@@ -44,15 +44,15 @@ struct mm_struct;void set_pte_vaddr_pud (pud_t *pud_page,unsigned long vaddr,pte_t new_pte); -static inline void native_pte_clear (struct mm_struct *mm,unsigned long addr, -pte_t *ptep) +static inline void native_set_pte (pte_t *ptep,pte_t pte) { - *ptep =native_make_pte (0 ); +WRITE_ONCE (*ptep, pte); } -static inline void native_set_pte (pte_t *ptep,pte_t pte) +static inline void native_pte_clear (struct mm_struct *mm,unsigned long addr, +pte_t *ptep) { - *ptep = pte; +native_set_pte (ptep,native_make_pte (0 )); }static inline void native_set_pte_atomic (pte_t *ptep,pte_t pte)
@@ -62,7 +62,7 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)static inline void native_set_pmd (pmd_t *pmdp,pmd_t pmd) { - *pmdp = pmd; +WRITE_ONCE (*pmdp, pmd); }static inline void native_pmd_clear (pmd_t *pmd)
@@ -98,7 +98,7 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)static inline void native_set_pud (pud_t *pudp,pud_t pud) { - *pudp = pud; +WRITE_ONCE (*pudp, pud); }static inline void native_pud_clear (pud_t *pud)
@@ -131,7 +131,7 @@ static inline pgd_t *native_get_shadow_pgd(pgd_t *pgdp)static inline void native_set_pgd (pgd_t *pgdp,pgd_t pgd) { - *pgdp =kaiser_set_shadow_pgd (pgdp, pgd); +WRITE_ONCE (*pgdp,kaiser_set_shadow_pgd (pgdp, pgd)); }static inline void native_pgd_clear (pgd_t *pgd)
arch/x86/include/asm/processor.h +6 -0
@@ -874,4 +874,10 @@ enum l1tf_mitigations {extern enum l1tf_mitigations l1tf_mitigation; +enum mds_mitigations { +MDS_MITIGATION_OFF , +MDS_MITIGATION_FULL , +MDS_MITIGATION_VMWERV , +}; +#endif /* _ASM_X86_PROCESSOR_H */
arch/x86/include/asm/spec-ctrl.h +14 -6
@@ -53,12 +53,24 @@ static inline u64 ssbd_tif_to_spec_ctrl(u64 tifn)return (tifn & _TIF_SSBD) >> (TIF_SSBD -SPEC_CTRL_SSBD_SHIFT ); } +static inline u64 stibp_tif_to_spec_ctrl (u64 tifn) +{ +BUILD_BUG_ON (TIF_SPEC_IB <SPEC_CTRL_STIBP_SHIFT ); +return (tifn & _TIF_SPEC_IB) >> (TIF_SPEC_IB -SPEC_CTRL_STIBP_SHIFT ); +} +static inline unsigned long ssbd_spec_ctrl_to_tif (u64 spec_ctrl) {BUILD_BUG_ON (TIF_SSBD <SPEC_CTRL_SSBD_SHIFT );return (spec_ctrl &SPEC_CTRL_SSBD ) << (TIF_SSBD -SPEC_CTRL_SSBD_SHIFT ); } +static inline unsigned long stibp_spec_ctrl_to_tif (u64 spec_ctrl) +{ +BUILD_BUG_ON (TIF_SPEC_IB <SPEC_CTRL_STIBP_SHIFT ); +return (spec_ctrl &SPEC_CTRL_STIBP ) << (TIF_SPEC_IB -SPEC_CTRL_STIBP_SHIFT ); +} +static inline u64 ssbd_tif_to_amd_ls_cfg (u64 tifn) {return (tifn & _TIF_SSBD) ? x86_amd_ls_cfg_ssbd_mask :0ULL ;
@@ -70,11 +82,7 @@ extern void speculative_store_bypass_ht_init(void);static inline void speculative_store_bypass_ht_init (void ) { }#endif -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); -} +extern void speculation_ctrl_update (unsigned long tif); +extern void speculation_ctrl_update_current (void );#endif
arch/x86/include/asm/switch_to.h +0 -3
@@ -8,9 +8,6 @@ struct task_struct *__switch_to_asm(struct task_struct *prev, __visible struct task_struct *__switch_to(struct task_struct *prev,struct task_struct *next); -struct tss_struct ; -void __switch_to_xtra (struct task_struct *prev_p,struct task_struct *next_p, -struct tss_struct *tss);/* This runs runs on the previous thread's stack. */ static inline void prepare_switch_to(struct task_struct *prev,
arch/x86/include/asm/thread_info.h +17 -3
@@ -83,10 +83,12 @@ struct thread_info {#define TIF_SIGPENDING 2/* signal pending */ #define TIF_NEED_RESCHED 3/* rescheduling necessary */ #define TIF_SINGLESTEP 4/* reenable singlestep on user return*/ -#define TIF_SSBD 5/* Reduced data speculation */ +#define TIF_SSBD 5/* Speculative store bypass disable */ #define TIF_SYSCALL_EMU 6/* syscall emulation active */ #define TIF_SYSCALL_AUDIT 7/* syscall auditing active */ #define TIF_SECCOMP 8/* secure computing */ +#define TIF_SPEC_IB 9/* Indirect branch speculation mitigation */ +#define TIF_SPEC_FORCE_UPDATE 10/* Force speculation MSR update in context switch */ #define TIF_USER_RETURN_NOTIFY 11/* notify kernel of userspace return */ #define TIF_UPROBE 12/* breakpointed or singlestepping */ #define TIF_NOTSC 16/* TSC is not accessible in userland */
@@ -111,6 +113,8 @@ struct thread_info {#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)#define _TIF_SECCOMP (1 << TIF_SECCOMP) +#define _TIF_SPEC_IB (1 << TIF_SPEC_IB) +#define _TIF_SPEC_FORCE_UPDATE (1 << TIF_SPEC_FORCE_UPDATE)#define _TIF_USER_RETURN_NOTIFY (1 << TIF_USER_RETURN_NOTIFY)#define _TIF_UPROBE (1 << TIF_UPROBE)#define _TIF_NOTSC (1 << TIF_NOTSC)
@@ -140,8 +144,18 @@ struct thread_info { _TIF_NOHZ)/* flags to check in __switch_to() */ -#define _TIF_WORK_CTXSW \ - (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP|_TIF_SSBD) +#define _TIF_WORK_CTXSW_BASE \ + (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP| \ + _TIF_SSBD | _TIF_SPEC_FORCE_UPDATE) + +/* +* Avoid calls to __switch_to_xtra() on UP as STIBP is not evaluated. +*/ +#ifdef CONFIG_SMP +# define _TIF_WORK_CTXSW (_TIF_WORK_CTXSW_BASE | _TIF_SPEC_IB) +#else +# define _TIF_WORK_CTXSW (_TIF_WORK_CTXSW_BASE) +#endif #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
arch/x86/include/asm/tlbflush.h +6 -2
@@ -68,8 +68,12 @@ static inline void invpcid_flush_all_nonglobals(void)struct tlb_state {struct mm_struct *active_mm;int state; -/* last user mm's ctx id */ -u64 last_ctx_id; + +/* Last user mm for optimizing IBPB */ +union { +struct mm_struct *last_user_mm; +unsigned long last_user_mm_ibpb; + };/* * Access to this CR4 shadow and to H/W CR4 is protected by
arch/x86/include/uapi/asm/Kbuild +0 -1
@@ -27,7 +27,6 @@ header-y += ldt.h header-y += mce.h header-y += mman.h header-y += msgbuf.h -header-y += msr-index.h header-y += msr.h header-y += mtrr.h header-y += param.h
arch/x86/include/uapi/asm/mce.h +2 -0
@@ -28,6 +28,8 @@ struct mce {__u64 mcgcap;/* MCGCAP MSR: machine check capabilities of CPU */ __u64 synd;/* MCA_SYND MSR: only valid on SMCA systems */ __u64 ipid;/* MCA_IPID MSR: only valid on SMCA systems */ +__u64 ppin;/* Protected Processor Inventory Number */ +__u32 microcode;/* Microcode revision */ };#define MCE_GET_RECORD_LEN _IOR('M', 1, int)
arch/x86/kernel/cpu/bugs.c +550 -107
443 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +78 -61
139 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel.c +38 -32
70 lines not on this page · raw message
arch/x86/kernel/process.c +82 -19
101 lines not on this page · raw message
arch/x86/mm/tlb.c +90 -24
114 lines not on this page · raw message
arch/x86/platform/atom/punit_atom_debug.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/thermal/intel_soc_dts_thermal.c +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.