Linux 4.9.120
Greg KH
maintainerI'm announcing the release of the 4.9.120 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:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/ABI/testing/sysfs-devices-system-cpu | 24 Documentation/index.rst | 1 Documentation/kernel-parameters.txt | 78 + Documentation/l1tf.rst | 610 +++++++++++ Documentation/virtual/kvm/api.txt | 40 Makefile | 2 arch/Kconfig | 3 arch/arm/boot/dts/imx6sx.dtsi | 2 arch/parisc/Kconfig | 2 arch/parisc/include/asm/barrier.h | 32 arch/parisc/kernel/entry.S | 2 arch/parisc/kernel/pacache.S | 1 arch/parisc/kernel/syscall.S | 4 arch/x86/Kconfig | 1 arch/x86/include/asm/apic.h | 10 arch/x86/include/asm/cpufeatures.h | 4 arch/x86/include/asm/dmi.h | 2 arch/x86/include/asm/hardirq.h | 26 arch/x86/include/asm/irqflags.h | 2 arch/x86/include/asm/kvm_host.h | 9 arch/x86/include/asm/msr-index.h | 7 arch/x86/include/asm/page_32_types.h | 9 arch/x86/include/asm/pgtable-2level.h | 17 arch/x86/include/asm/pgtable-3level.h | 37 arch/x86/include/asm/pgtable-invert.h | 32 arch/x86/include/asm/pgtable.h | 85 + arch/x86/include/asm/pgtable_64.h | 48 arch/x86/include/asm/pgtable_types.h | 10 arch/x86/include/asm/processor.h | 17 arch/x86/include/asm/smp.h | 1 arch/x86/include/asm/topology.h | 6 arch/x86/include/asm/vmx.h | 11 arch/x86/kernel/apic/apic.c | 19 arch/x86/kernel/apic/htirq.c | 2 arch/x86/kernel/apic/io_apic.c | 1 arch/x86/kernel/apic/msi.c | 1 arch/x86/kernel/apic/vector.c | 1 arch/x86/kernel/cpu/amd.c | 84 - arch/x86/kernel/cpu/bugs.c | 171 ++- arch/x86/kernel/cpu/common.c | 63 - arch/x86/kernel/cpu/cpu.h | 2 arch/x86/kernel/cpu/intel.c | 7 arch/x86/kernel/cpu/microcode/core.c | 26 arch/x86/kernel/cpu/topology.c | 41 arch/x86/kernel/fpu/core.c | 1 arch/x86/kernel/ftrace.c | 1 arch/x86/kernel/hpet.c | 1 arch/x86/kernel/i8259.c | 1 arch/x86/kernel/irq.c | 1 arch/x86/kernel/irq_32.c | 1 arch/x86/kernel/irq_64.c | 1 arch/x86/kernel/irqinit.c | 1 arch/x86/kernel/kprobes/core.c | 5 arch/x86/kernel/kprobes/opt.c | 1 arch/x86/kernel/paravirt.c | 14 arch/x86/kernel/setup.c | 6 arch/x86/kernel/smp.c | 1 arch/x86/kernel/smpboot.c | 25 arch/x86/kernel/time.c | 1 arch/x86/kvm/svm.c | 46 arch/x86/kvm/vmx.c | 426 ++++++- arch/x86/kvm/x86.c | 133 ++ arch/x86/mm/fault.c | 1 arch/x86/mm/init.c | 25 arch/x86/mm/kaiser.c | 1 arch/x86/mm/kmmio.c | 25 arch/x86/mm/mmap.c | 21 arch/x86/mm/pageattr.c | 8 arch/x86/platform/efi/efi_64.c | 1 arch/x86/platform/efi/quirks.c | 1 arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c | 1 arch/x86/platform/uv/tlb_uv.c | 1 arch/x86/xen/enlighten.c | 1 arch/x86/xen/setup.c | 1 drivers/acpi/acpi_lpss.c | 2 drivers/base/cpu.c | 8 drivers/char/tpm/tpm-dev.c | 43 drivers/infiniband/core/umem.c | 11 drivers/infiniband/hw/mlx4/mr.c | 50 drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 2 drivers/mtd/nand/qcom_nandc.c | 3 drivers/net/xen-netfront.c | 8 drivers/pci/host/pci-hyperv.c | 2 drivers/scsi/sr.c | 29 fs/dcache.c | 13 fs/ext4/ialloc.c | 5 fs/ext4/super.c | 8 fs/namespace.c | 28 fs/proc/inode.c | 3 fs/proc/internal.h | 7 fs/proc/proc_sysctl.c | 83 + include/asm-generic/pgtable.h | 13 include/linux/compiler-clang.h | 3 include/linux/cpu.h | 23 include/linux/swapfile.h | 2 include/linux/sysctl.h | 1 include/rdma/ib_verbs.h | 14 include/uapi/linux/kvm.h | 2 init/main.c | 2 kernel/cpu.c | 284 ++++- kernel/smp.c | 2 kernel/softirq.c | 12 mm/memory.c | 29 mm/mprotect.c | 49 mm/swapfile.c | 46 tools/arch/x86/include/asm/cpufeatures.h | 4 106 files changed, 2709 insertions(+), 388 deletions(-)
Abel Vesa (1):
cpu/hotplug: Non-SMP machines do not make use of booted_once
Al Viro (4):
root dentries need RCU-delayed freeing
make sure that __dentry_kill() always invalidates d_seq, unhashed or not fix mntput/mntput race
fix __legitimize_mnt()/mntput() race
Andi Kleen (10):
x86/speculation/l1tf: Increase 32bit PAE __PHYSICAL_PAGE_SHIFT x86/speculation/l1tf: Protect PROT_NONE PTEs against speculation x86/speculation/l1tf: Make sure the first page is always reserved x86/speculation/l1tf: Add sysfs reporting for l1tf x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings x86/speculation/l1tf: Limit swap file size to MAX_PA/2 x86/speculation/l1tf: Invert all not present mappings x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert x86/mm/pat: Make set_memory_np() L1TF safe
x86/mm/kmmio: Make the tracer robust against L1TF
Andrey Konovalov (1):
kasan: add no_sanitize attribute for clang builds
Ashok Raj (1):
x86/microcode: Do not upload microcode if CPUs are offline
Bart Van Assche (1):
scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
Borislav Petkov (3):
x86/CPU/AMD: Do not check CPUID max ext level before parsing SMP info x86/CPU/AMD: Move TOPOEXT reenablement before reading smp_num_siblings x86/CPU/AMD: Have smp_num_siblings and cpu_llc_id always be present
David Woodhouse (1):
tools headers: Synchronise x86 cpufeatures.h for L1TF additions
Eric W. Biederman (2):
proc/sysctl: Don't grab i_lock under sysctl_lock.
proc: Fix proc_sys_prune_dcache to hold a sb reference
Fabio Estevam (1):
mtd: nand: qcom: Add a NULL check for devm_kasprintf()
Greg Kroah-Hartman (1):
Linux 4.9.120
Hans de Goede (1):
ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices
Helge Deller (1):
parisc: Enable CONFIG_MLONGCALLS by default
Jack Morgenstein (2):
IB/core: Make testing MR flags for writability a static inline function IB/mlx4: Mark user MR as writable if actual virtual memory is writable
Jim Mattson (1):
kvm: nVMX: Update MSR load counts on a VMCS switch
Jiri Kosina (4):
x86/speculation: Protect against userspace-userspace spectreRSB cpu/hotplug: Expose SMT control init function
x86/bugs, kvm: Introduce boot-time control of L1TF mitigations x86/speculation/l1tf: Unbreak !__HAVE_ARCH_PFN_MODIFY_ALLOWED architectures
John David Anglin (1):
parisc: Define mb() and add memory barriers to assembler unlock sequences
Josh Poimboeuf (2):
cpu/hotplug: detect SMT disabled by BIOS x86/microcode: Allow late microcode loading with SMT disabled
Juergen Gross (1):
xen/netfront: don't cache skb_shinfo()
Konrad Rzeszutek Wilk (9):
x86/bugs: Move the l1tf function and define pr_fmt properly x86/cpufeatures: Add detection of L1D cache flush support. x86/KVM: Warn user if KVM is loaded SMT and L1TF CPU bug being present x86/KVM/VMX: Add module argument for L1TF mitigation x86/KVM/VMX: Split the VMX MSR LOAD structures to have an host/guest numbers x86/KVM/VMX: Add find_msr() helper function
x86/KVM/VMX: Separate the VMX AUTOLOAD guest/host number accounting x86/KVM/VMX: Extend add_atomic_switch_msr() to allow VMENTER only MSRs x86/KVM/VMX: Use MSR save list for IA32_FLUSH_CMD if required
Konstantin Khlebnikov (1):
proc/sysctl: prune stale dentries during unregistering
Linus Torvalds (4):
Mark HI and TASKLET softirq synchronous
init: rename and re-order boot_cpu_state_init() x86/speculation/l1tf: Change order of offset/type in swap entry x86/speculation/l1tf: Protect swap entries against L1TF
Masami Hiramatsu (1):
kprobes/x86: Fix %p uses in error messages
Michael Mera (1):
IB/ocrdma: fix out of bounds access to local buffer
Michal Hocko (1):
x86/speculation/l1tf: Fix up pte->pfn conversion for PAE
Naoya Horiguchi (1):
mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1
Nick Desaulniers (1):
x86/irqflags: Provide a declaration for native_save_fl
Nicolai Stange (9):
x86/KVM/VMX: Initialize the vmx_l1d_flush_pages' content x86/KVM/VMX: Don't set l1tf_flush_l1d to true from vmx_l1d_flush() x86/KVM/VMX: Replace 'vmx_l1d_flush_always' with 'vmx_l1d_flush_cond' x86/KVM/VMX: Move the l1tf_flush_l1d test to vmx_l1d_flush() x86/irq: Demote irq_cpustat_t::__softirq_pending to u16 x86/KVM/VMX: Introduce per-host-cpu analogue of l1tf_flush_l1d
x86: Don't include linux/irq.h from asm/hardirq.h x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d x86/KVM/VMX: Don't set l1tf_flush_l1d from vmx_handle_external_intr()
Oleksij Rempel (1):
ARM: dts: imx6sx: fix irq for pcie bridge
Paolo Bonzini (7):
x86/KVM/VMX: Add L1D flush algorithm
x86/KVM/VMX: Add L1D MSR based flush
x86/KVM/VMX: Add L1D flush logic
KVM: VMX: support MSR_IA32_ARCH_CAPABILITIES as a feature MSR x86/speculation: Simplify sysfs report of VMX L1TF vulnerability x86/speculation: Use ARCH_CAPABILITIES to skip L1D flush on vmentry
KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry
Peter Zijlstra (1):
x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
Suravee Suthikulpanit (1):
x86/cpu/amd: Limit cpu_core_id fixup to families older than F17h
Tadeusz Struk (1):
tpm: fix race condition in tpm_common_write()
Theodore Ts'o (1):
ext4: fix check to prevent initializing reserved inodes
Thomas Gleixner (26):
x86/smp: Provide topology_is_primary_thread() x86/topology: Provide topology_smt_supported() cpu/hotplug: Make bringup/teardown of smp threads symmetric cpu/hotplug: Split do_cpu_down()
cpu/hotplug: Provide knobs to control SMT
x86/cpu: Remove the pointless CPU printout
x86/cpu/AMD: Remove the pointless detect_ht() call x86/cpu/common: Provide detect_ht_early() x86/cpu/topology: Provide detect_extended_topology_early() x86/cpu/intel: Evaluate smp_num_siblings early x86/cpu/AMD: Evaluate smp_num_siblings early
x86/apic: Ignore secondary threads if nosmt=force
Revert "x86/apic: Ignore secondary threads if nosmt=force" cpu/hotplug: Boot HT siblings at least once
cpu/hotplug: Online siblings when SMT control is turned on x86/litf: Introduce vmx status variable
x86/kvm: Drop L1TF MSR list approach
x86/l1tf: Handle EPT disabled state proper
x86/kvm: Move l1tf setup function
x86/kvm: Add static key for flush always
x86/kvm: Serialize L1D flush parameter setter
x86/kvm: Allow runtime control of L1D flush
cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early
Documentation: Add section about CPU vulnerabilities Documentation/l1tf: Remove Yonah processors from not vulnerable list cpu/hotplug: Fix SMT supported evaluation
Tom Lendacky (2):
KVM: x86: Add a framework for supporting MSR-based features
KVM: SVM: Add MSR-based feature support for serializing LFENCE
Tony Luck (1):
Documentation/l1tf: Fix typos
Vlastimil Babka (4):
x86/speculation/l1tf: Extend 64bit swap file size limit x86/speculation/l1tf: Protect PAE swap entries against L1TF
x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread x86/init: fix build with CONFIG_SWAP=n
Wanpeng Li (2):
KVM: X86: Introduce kvm_get_msr_feature()
KVM: X86: Allow userspace to define the microcode version
Greg KH
maintainerDocumentation/ABI/testing/sysfs-devices-system-cpu +24 -0
@@ -356,6 +356,7 @@ What: /sys/devices/system/cpu/vulnerabilities /sys/devices/system/cpu/vulnerabilities/spectre_v1 /sys/devices/system/cpu/vulnerabilities/spectre_v2 /sys/devices/system/cpu/vulnerabilities/spec_store_bypass + /sys/devices/system/cpu/vulnerabilities/l1tf Date: January 2018 Contact: Linux kernel mailing list <[email protected]> Description: Information about CPU vulnerabilities
@@ -367,3 +368,26 @@ Description: Information about CPU vulnerabilities "Not affected" CPU is not affected by the vulnerability "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 + +What: /sys/devices/system/cpu/smt + /sys/devices/system/cpu/smt/active + /sys/devices/system/cpu/smt/control +Date: June 2018 +Contact: Linux kernel mailing list <[email protected]> +Description: Control Symetric Multi Threading (SMT) + + active: Tells whether SMT is active (enabled and siblings online) + + control: Read/write interface to control SMT. Possible + values: + + "on" SMT is enabled + "off" SMT is disabled + "forceoff" SMT is force disabled. Cannot be changed. + "notsupported" SMT is not supported by the CPU + + If control status is "forceoff" or "notsupported" writes + are rejected.
Documentation/index.rst +1 -0
@@ -12,6 +12,7 @@ Contents: :maxdepth: 2 kernel-documentation + l1tf development-process/index dev-tools/tools driver-api/index
Documentation/kernel-parameters.txt +78 -0
94 lines not on this page · raw message
Documentation/l1tf.rst new file +610 -0
610 lines not on this page · raw message
Documentation/virtual/kvm/api.txt +28 -12
@@ -122,14 +122,15 @@ KVM_CAP_S390_UCONTROL and use the flag KVM_VM_S390_UCONTROL as privileged user (CAP_SYS_ADMIN). -4.3 KVM_GET_MSR_INDEX_LIST +4.3 KVM_GET_MSR_INDEX_LIST, KVM_GET_MSR_FEATURE_INDEX_LIST -Capability: basic +Capability: basic, KVM_CAP_GET_MSR_FEATURES for KVM_GET_MSR_FEATURE_INDEX_LIST Architectures: x86 -Type: system +Type: system ioctl Parameters: struct kvm_msr_list (in/out) Returns: 0 on success; -1 on error Errors: + EFAULT: the msr index list cannot be read from or written to E2BIG: the msr index list is to be to fit in the array specified by the user.
@@ -138,16 +139,23 @@ struct kvm_msr_list { __u32 indices[0]; }; -This ioctl returns the guest msrs that are supported. The list varies -by kvm version and host processor, but does not change otherwise. The -user fills in the size of the indices array in nmsrs, and in return -kvm adjusts nmsrs to reflect the actual number of msrs and fills in -the indices array with their numbers. +The user fills in the size of the indices array in nmsrs, and in return +kvm adjusts nmsrs to reflect the actual number of msrs and fills in the +indices array with their numbers. + +KVM_GET_MSR_INDEX_LIST returns the guest msrs that are supported. The list +varies by kvm version and host processor, but does not change otherwise. Note: if kvm indicates supports MCE (KVM_CAP_MCE), then the MCE bank MSRs are not returned in the MSR list, as different vcpus can have a different number of banks, as set via the KVM_X86_SETUP_MCE ioctl. +KVM_GET_MSR_FEATURE_INDEX_LIST returns the list of MSRs that can be passed +to the KVM_GET_MSRS system ioctl. This lets userspace probe host capabilities +and processor features that are exposed via MSRs (e.g., VMX capabilities). +This list also varies by kvm version and host processor, but does not change +otherwise. + 4.4 KVM_CHECK_EXTENSION
@@ -474,14 +482,22 @@ Support for this has been removed. Use KVM_SET_GUEST_DEBUG instead. 4.18 KVM_GET_MSRS -Capability: basic +Capability: basic (vcpu), KVM_CAP_GET_MSR_FEATURES (system) Architectures: x86 -Type: vcpu ioctl +Type: system ioctl, vcpu ioctl Parameters: struct kvm_msrs (in/out) -Returns: 0 on success, -1 on error +Returns: number of msrs successfully returned; + -1 on error + +When used as a system ioctl: +Reads the values of MSR-based features that are available for the VM. This +is similar to KVM_GET_SUPPORTED_CPUID, but it returns MSR indices and values. +The list of msr-based features can be obtained using KVM_GET_MSR_FEATURE_INDEX_LIST +in a system ioctl. +When used as a vcpu ioctl: Reads model-specific registers from the vcpu. Supported msr indices can -be obtained using KVM_GET_MSR_INDEX_LIST. +be obtained using KVM_GET_MSR_INDEX_LIST in a system ioctl. struct kvm_msrs { __u32 nmsrs; /* number of msrs in entries */
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 119 +SUBLEVEL = 120 EXTRAVERSION = NAME = Roaring Lionus
arch/Kconfig +3 -0
@@ -5,6 +5,9 @@ config KEXEC_CORE bool +config HOTPLUG_SMT + bool + config OPROFILE tristate "OProfile system profiling" depends on PROFILING
arch/arm/boot/dts/imx6sx.dtsi +1 -1
@@ -1280,7 +1280,7 @@ /* non-prefetchable memory */ 0x82000000 0 0x08000000 0x08000000 0 0x00f00000>; num-lanes = <1>; - interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SX_CLK_PCIE_REF_125M>, <&clks IMX6SX_CLK_PCIE_AXI>, <&clks IMX6SX_CLK_LVDS1_OUT>,
arch/parisc/Kconfig +1 -1
@@ -184,7 +184,7 @@ config PREFETCH config MLONGCALLS bool "Enable the -mlong-calls compiler option for big kernels" - def_bool y if (!MODULES) + default y depends on PA8X00 help If you configure the kernel to include many drivers built-in instead
arch/parisc/include/asm/barrier.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_BARRIER_H +#define __ASM_BARRIER_H + +#ifndef __ASSEMBLY__ + +/* The synchronize caches instruction executes as a nop on systems in +which all memory references are performed in order. */ +#define synchronize_caches () __asm__ __volatile__ ("sync" : : : "memory") + +#if defined(CONFIG_SMP ) +#define mb () do { synchronize_caches(); } while (0) +#define rmb () mb() +#define wmb () mb() +#define dma_rmb () mb() +#define dma_wmb () mb() +#else +#define mb () barrier() +#define rmb () barrier() +#define wmb () barrier() +#define dma_rmb () barrier() +#define dma_wmb () barrier() +#endif + +#define __smp_mb () mb() +#define __smp_rmb () mb() +#define __smp_wmb () mb() + +#include <asm-generic/barrier.h> + +#endif /* !__ASSEMBLY__ */ +#endif /* __ASM_BARRIER_H */
arch/parisc/kernel/entry.S +2 -0
@@ -481,6 +481,8 @@ /* Release pa_tlb_lock lock without reloading lock address. */ .macro tlb_unlock0 spc,tmp #ifdef CONFIG_SMP + or,COND(=) %r0,\spc,%r0 + sync or,COND(=) %r0,\spc,%r0 stw \spc,0(\tmp) #endif
arch/parisc/kernel/pacache.S +1 -0
@@ -354,6 +354,7 @@ ENDPROC_CFI(flush_data_cache_local) .macro tlb_unlock la,flags,tmp #ifdef CONFIG_SMP ldi 1,\tmp + sync stw \tmp,0(\la) mtsm \flags #endif
arch/parisc/kernel/syscall.S +4 -0
@@ -633,6 +633,7 @@ cas_action: sub,<> %r28, %r25, %r0 2: stw,ma %r24, 0(%r26) /* Free lock */ + sync stw,ma %r20, 0(%sr2,%r20) #if ENABLE_LWS_DEBUG /* Clear thread register indicator */
@@ -647,6 +648,7 @@ cas_action: 3: /* Error occurred on load or store */ /* Free lock */ + sync stw %r20, 0(%sr2,%r20) #if ENABLE_LWS_DEBUG stw %r0, 4(%sr2,%r20)
@@ -848,6 +850,7 @@ cas2_action: cas2_end: /* Free lock */ + sync stw,ma %r20, 0(%sr2,%r20) /* Enable interrupts */ ssm PSW_SM_I, %r0
@@ -858,6 +861,7 @@ cas2_end: 22: /* Error occurred on load or store */ /* Free lock */ + sync stw %r20, 0(%sr2,%r20) ssm PSW_SM_I, %r0 ldo 1(%r0),%r28
arch/x86/Kconfig +1 -0
@@ -147,6 +147,7 @@ config X86 select HAVE_UID16 if X86_32 || IA32_EMULATION select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_USER_RETURN_NOTIFIER + select HOTPLUG_SMT if SMP select IRQ_FORCED_THREADING select MODULES_USE_ELF_RELA if X86_64 select MODULES_USE_ELF_REL if X86_32
arch/x86/include/asm/apic.h +10 -0
@@ -12,6 +12,7 @@#include <asm/mpspec.h> #include <asm/msr.h> #include <asm/idle.h> +#include <asm/hardirq.h> #define ARCH_APICTIMER_STOPS_ON_C3 1
@@ -633,6 +634,13 @@ extern int default_check_phys_apicid_present(int phys_apicid);#endif #endif /* CONFIG_X86_LOCAL_APIC */ + +#ifdef CONFIG_SMP +bool apic_id_is_primary_thread (unsigned int id); +#else +static inline bool apic_id_is_primary_thread (unsigned int id) {return false; } +#endif +extern void irq_enter (void );extern void irq_exit (void );
@@ -640,6 +648,7 @@ static inline void entering_irq(void) {irq_enter ();exit_idle (); +kvm_set_cpu_l1tf_flush_l1d (); }static inline void entering_ack_irq (void )
@@ -652,6 +661,7 @@ static inline void ipi_entering_ack_irq(void) {irq_enter ();ack_APIC_irq (); +kvm_set_cpu_l1tf_flush_l1d (); }static inline void exiting_irq (void )
arch/x86/include/asm/cpufeatures.h +3 -1
@@ -213,7 +213,7 @@#define X86_FEATURE_IBPB ( 7*32+26)/* Indirect Branch Prediction Barrier */ #define X86_FEATURE_STIBP ( 7*32+27)/* Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ZEN ( 7*32+28)/* "" CPU is AMD family 0x17 (Zen) */ - +#define X86_FEATURE_L1TF_PTEINV ( 7*32+29)/* "" L1TF workaround PTE inversion */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0)/* Intel TPR Shadow */
@@ -317,6 +317,7 @@#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 */ +#define X86_FEATURE_FLUSH_L1D (18*32+28)/* Flush L1D cache */ #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29)/* IA32_ARCH_CAPABILITIES MSR (Intel) */ #define X86_FEATURE_SPEC_CTRL_SSBD (18*32+31)/* "" Speculative Store Bypass Disable */
@@ -349,5 +350,6 @@#define X86_BUG_SPECTRE_V1 X86_BUG(15)/* CPU is affected by Spectre variant 1 attack with conditional branches */ #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 */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/dmi.h +1 -1
@@ -3,8 +3,8 @@#include <linux/compiler.h> #include <linux/init.h> +#include <linux/io.h> -#include <asm/io.h> #include <asm/setup.h> static __always_inline __init void *dmi_alloc(unsigned len)
arch/x86/include/asm/hardirq.h +24 -2
@@ -2,10 +2,12 @@#define _ASM_X86_HARDIRQ_H#include <linux/threads.h> -#include <linux/irq.h> typedef struct { - unsigned int __softirq_pending; + u16 __softirq_pending; +#if IS_ENABLED(CONFIG_KVM_INTEL) + u8 kvm_cpu_l1tf_flush_l1d; +#endif unsigned int __nmi_count; /* arch dependent */ #ifdef CONFIG_X86_LOCAL_APIC unsigned int apic_timer_irqs; /* arch dependent */
@@ -60,4 +62,24 @@ extern u64 arch_irq_stat_cpu(unsigned int cpu);extern u64 arch_irq_stat (void );#define arch_irq_stat arch_irq_stat + +#if IS_ENABLED (CONFIG_KVM_INTEL ) +static inline void kvm_set_cpu_l1tf_flush_l1d (void ) +{ +__this_cpu_write (irq_stat.kvm_cpu_l1tf_flush_l1d,1 ); +} + +static inline void kvm_clear_cpu_l1tf_flush_l1d (void ) +{ +__this_cpu_write (irq_stat.kvm_cpu_l1tf_flush_l1d,0 ); +} + +static inline bool kvm_get_cpu_l1tf_flush_l1d (void ) +{ +return __this_cpu_read (irq_stat.kvm_cpu_l1tf_flush_l1d); +} +#else /* !IS_ENABLED(CONFIG_KVM_INTEL) */ +static inline void kvm_set_cpu_l1tf_flush_l1d (void ) { } +#endif /* IS_ENABLED(CONFIG_KVM_INTEL) */ +#endif /* _ASM_X86_HARDIRQ_H */
arch/x86/include/asm/irqflags.h +2 -0
@@ -12,6 +12,8 @@* Interrupt control: */ +/* Declaration required for gcc < 4.9 to prevent -Werror=missing-prototypes */ +extern inline unsigned long native_save_fl (void );extern inline unsigned long native_save_fl (void ) {unsigned long flags;
arch/x86/include/asm/kvm_host.h +9 -0
@@ -17,6 +17,7 @@#include <linux/tracepoint.h> #include <linux/cpumask.h> #include <linux/irq_work.h> +#include <linux/irq.h> #include <linux/kvm.h> #include <linux/kvm_para.h>
@@ -485,6 +486,7 @@ struct kvm_vcpu_arch {u64 smbase;bool tpr_access_reporting;u64 ia32_xss; +u64 microcode_version;/* * Paging state of the vcpu
@@ -659,6 +661,9 @@ struct kvm_vcpu_arch {int pending_ioapic_eoi;int pending_external_vector; + +/* Flush the L1 Data cache for L1TF mitigation on VMENTER */ +bool l1tf_flush_l1d; };struct kvm_lpage_info {
@@ -819,6 +824,7 @@ struct kvm_vcpu_stat {u64 signal_exits;u64 irq_window_exits;u64 nmi_window_exits; +u64 l1d_flush;u64 halt_exits;u64 halt_successful_poll;u64 halt_attempted_poll;
@@ -1020,6 +1026,8 @@ struct kvm_x86_ops {void (*cancel_hv_timer)(struct kvm_vcpu *vcpu);void (*setup_mce)(struct kvm_vcpu *vcpu); + +int (*get_msr_feature)(struct kvm_msr_entry *entry); };struct kvm_arch_async_pf {
@@ -1338,6 +1346,7 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);void kvm_arch_mmu_notifier_invalidate_page (struct kvm *kvm,unsigned long address); +u64 kvm_get_arch_capabilities (void );void kvm_define_shared_msr (unsigned index,u32 msr);int kvm_set_shared_msr (unsigned index,u64 val,u64 mask);
arch/x86/include/asm/msr-index.h +7 -0
@@ -63,12 +63,19 @@#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 MSR_IA32_FLUSH_CMD 0x0000010b +#define L1D_FLUSH (1 << 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/page_32_types.h +7 -2
@@ -28,8 +28,13 @@#define N_EXCEPTION_STACKS 1#ifdef CONFIG_X86_PAE -/* 44=32+12, the limit we can fit into an unsigned long pfn */ -#define __PHYSICAL_MASK_SHIFT 44 +/* +* This is beyond the 44 bit limit imposed by the 32bit long pfns, +* but we need the full mask to make sure inverted PROT_NONE +* entries have all the host bits set in a guest. +* The real limit is still 44 bits. +*/ +#define __PHYSICAL_MASK_SHIFT 52#define __VIRTUAL_MASK_SHIFT 32#else /* !CONFIG_X86_PAE */
arch/x86/include/asm/pgtable-2level.h +17 -0
@@ -77,4 +77,21 @@ static inline unsigned long pte_bitop(unsigned long value, unsigned int rightshi#define __pte_to_swp_entry (pte) ((swp_entry_t) { (pte).pte_low })#define __swp_entry_to_pte (x) ((pte_t) { .pte = (x).val }) +/* No inverted PFNs on 2 level page tables */ + +static inline u64 protnone_mask (u64 val) +{ +return 0 ; +} + +static inline u64 flip_protnone_guard (u64 oldval,u64 val,u64 mask) +{ +return val; +} + +static inline bool __pte_needs_invert (u64 val) +{ +return false; +} +#endif /* _ASM_X86_PGTABLE_2LEVEL_H */
arch/x86/include/asm/pgtable-3level.h +35 -2
@@ -177,11 +177,44 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *pmdp)#endif /* Encode and de-code a swap entry */ +#define SWP_TYPE_BITS 5 + +#define SWP_OFFSET_FIRST_BIT (_PAGE_BIT_PROTNONE + 1) + +/* We always extract/encode the offset by shifting it all the way up, and then down again */ +#define SWP_OFFSET_SHIFT (SWP_OFFSET_FIRST_BIT + SWP_TYPE_BITS) +#define MAX_SWAPFILES_CHECK () BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)#define __swp_type (x) (((x).val) & 0x1f)#define __swp_offset (x) ((x).val >> 5)#define __swp_entry (type, offset) ((swp_entry_t){(type) | (offset) << 5}) -#define __pte_to_swp_entry (pte) ((swp_entry_t){ (pte).pte_high }) -#define __swp_entry_to_pte (x) ((pte_t){ { .pte_high = (x).val } }) + +/* +* Normally, __swp_entry() converts from arch-independent swp_entry_t to +* arch-dependent swp_entry_t, and __swp_entry_to_pte() just stores the result +* to pte. But here we have 32bit swp_entry_t and 64bit pte, and need to use the +* whole 64 bits. Thus, we shift the "real" arch-dependent conversion to +* __swp_entry_to_pte() through the following helper macro based on 64bit +* __swp_entry(). +*/ +#define __swp_pteval_entry (type, offset) ((pteval_t) { \ + (~(pteval_t)(offset) << SWP_OFFSET_SHIFT >> SWP_TYPE_BITS) \ + | ((pteval_t)(type) << (64 - SWP_TYPE_BITS)) }) + +#define __swp_entry_to_pte (x) ((pte_t){ .pte = \ + __swp_pteval_entry(__swp_type(x), __swp_offset(x)) }) +/* +* Analogically, __pte_to_swp_entry() doesn't just extract the arch-dependent +* swp_entry_t, but also has to convert it from 64bit to the 32bit +* intermediate representation, using the following macros based on 64bit +* __swp_type() and __swp_offset(). +*/ +#define __pteval_swp_type (x) ((unsigned long)((x).pte >> (64 - SWP_TYPE_BITS))) +#define __pteval_swp_offset (x) ((unsigned long)(~((x).pte) << SWP_TYPE_BITS >> SWP_OFFSET_SHIFT)) + +#define __pte_to_swp_entry (pte) (__swp_entry(__pteval_swp_type(pte), \ + __pteval_swp_offset(pte))) + +#include <asm/pgtable-invert.h> #endif /* _ASM_X86_PGTABLE_3LEVEL_H */
arch/x86/include/asm/pgtable-invert.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_PGTABLE_INVERT_H +#define _ASM_PGTABLE_INVERT_H 1 + +#ifndef __ASSEMBLY__ + +static inline bool __pte_needs_invert (u64 val) +{ +return !(val & _PAGE_PRESENT); +} + +/* Get a mask to xor with the page table entry to get the correct pfn. */ +static inline u64 protnone_mask (u64 val) +{ +return __pte_needs_invert (val) ? ~0ull :0 ; +} + +static inline u64 flip_protnone_guard (u64 oldval,u64 val,u64 mask) +{ +/* +* When a PTE transitions from NONE to !NONE or vice-versa +* invert the PFN part to stop speculation. +* pte_pfn undoes this when needed. +*/ +if (__pte_needs_invert (oldval) !=__pte_needs_invert (val)) + val = (val & ~mask) | (~val & mask); +return val; +} + +#endif /* __ASSEMBLY__ */ + +#endif
arch/x86/include/asm/pgtable.h +69 -16
141 lines not on this page · raw message
arch/x86/include/asm/pgtable_64.h +35 -13
70 lines not on this page · raw message
arch/x86/include/asm/pgtable_types.h +5 -5
@@ -97,15 +97,15 @@/* * Tracking soft dirty bit when a page goes to a swap is tricky. * We need a bit which can be stored in pte _and_ not conflict -* with swap entry format. On x86 bits 6 and 7 are *not* involved -* into swap entry computation, but bit 6 is used for nonlinear -* file mapping, so we borrow bit 7 for soft dirty tracking. +* with swap entry format. On x86 bits 1-4 are *not* involved +* into swap entry computation, but bit 7 is used for thp migration, +* so we borrow bit 1 for soft dirty tracking. * * Please note that this bit must be treated as swap dirty page -* mark if and only if the PTE has present bit clear! +* mark if and only if the PTE/PMD has present bit clear! */ #ifdef CONFIG_MEM_SOFT_DIRTY -#define _PAGE_SWP_SOFT_DIRTY _PAGE_PSE +#define _PAGE_SWP_SOFT_DIRTY _PAGE_RW#else #define _PAGE_SWP_SOFT_DIRTY (_AT(pteval_t, 0))#endif
arch/x86/include/asm/processor.h +17 -0
@@ -173,6 +173,11 @@ extern const struct seq_operations cpuinfo_op;extern void cpu_detect (struct cpuinfo_x86 *c); +static inline unsigned long l1tf_pfn_limit (void ) +{ +return BIT (boot_cpu_data.x86_phys_bits -1 -PAGE_SHIFT ) -1 ; +} +extern void early_cpu_init (void );extern void identify_boot_cpu (void );extern void identify_secondary_cpu (struct cpuinfo_x86 *);
@@ -855,4 +860,16 @@ bool xen_set_default_idle(void);void stop_this_cpu (void *dummy);void df_debug (struct pt_regs *regs,long error_code); + +enum l1tf_mitigations { +L1TF_MITIGATION_OFF , +L1TF_MITIGATION_FLUSH_NOWARN , +L1TF_MITIGATION_FLUSH , +L1TF_MITIGATION_FLUSH_NOSMT , +L1TF_MITIGATION_FULL , +L1TF_MITIGATION_FULL_FORCE +}; + +extern enum l1tf_mitigations l1tf_mitigation; +#endif /* _ASM_X86_PROCESSOR_H */
arch/x86/include/asm/smp.h +0 -1
@@ -156,7 +156,6 @@ static inline int wbinvd_on_all_cpus(void)wbinvd (); return 0; } -#define smp_num_siblings 1#endif /* CONFIG_SMP */ extern unsigned disabled_cpus;
arch/x86/include/asm/topology.h +5 -1
@@ -129,13 +129,17 @@ static inline int topology_max_smt_threads(void) }int topology_update_package_map (unsigned int apicid,unsigned int cpu); -extern int topology_phys_to_logical_pkg (unsigned int pkg); +int topology_phys_to_logical_pkg (unsigned int pkg); +bool topology_is_primary_thread (unsigned int cpu); +bool topology_smt_supported (void );#else #define topology_max_packages () (1)static inline int topology_update_package_map (unsigned int apicid,unsigned int cpu) {return 0 ; }static inline int topology_phys_to_logical_pkg (unsigned int pkg) {return 0 ; }static inline int topology_max_smt_threads (void ) {return 1 ; } +static inline bool topology_is_primary_thread (unsigned int cpu) {return true; } +static inline bool topology_smt_supported (void ) {return false; }#endif static inline void arch_fix_phys_package_id (int num,u32 slot)
arch/x86/include/asm/vmx.h +11 -0
@@ -499,4 +499,15 @@ enum vm_instruction_error_number { VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID = 28, }; +enum vmx_l1d_flush_state { +VMENTER_L1D_FLUSH_AUTO , +VMENTER_L1D_FLUSH_NEVER , +VMENTER_L1D_FLUSH_COND , +VMENTER_L1D_FLUSH_ALWAYS , +VMENTER_L1D_FLUSH_EPT_DISABLED , +VMENTER_L1D_FLUSH_NOT_REQUIRED , +}; + +extern enum vmx_l1d_flush_state l1tf_vmx_mitigation; +#endif
arch/x86/kernel/apic/apic.c +19 -0
@@ -34,6 +34,7 @@#include <linux/dmi.h> #include <linux/smp.h> #include <linux/mm.h> +#include <linux/irq.h> #include <asm/trace/irq_vectors.h> #include <asm/irq_remapping.h>
@@ -55,6 +56,7 @@#include <asm/mce.h> #include <asm/tsc.h> #include <asm/hypervisor.h> +#include <asm/irq_regs.h> unsigned int num_processors;
@@ -2041,6 +2043,23 @@ static int cpuid_to_apicid[] = { [0 ... NR_CPUS - 1] = -1, }; +#ifdef CONFIG_SMP +/** +* apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread +* @id: APIC ID to check +*/ +bool apic_id_is_primary_thread (unsigned int apicid) +{ +u32 mask; + +if (smp_num_siblings ==1 ) +return true; +/* Isolate the SMT bit(s) in the APICID and check for 0 */ + mask = (1U << (fls (smp_num_siblings) -1 )) -1 ; +return !(apicid & mask); +} +#endif +/* * Should use this API to allocate logical CPU IDs to keep nr_logical_cpuids * and cpuid_to_apicid[] synchronized.
arch/x86/kernel/apic/htirq.c +2 -0
@@ -16,6 +16,8 @@#include <linux/device.h> #include <linux/pci.h> #include <linux/htirq.h> +#include <linux/irq.h> +#include <asm/irqdomain.h> #include <asm/hw_irq.h> #include <asm/apic.h>
arch/x86/kernel/apic/io_apic.c +1 -0
@@ -32,6 +32,7 @@#include <linux/mm.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/sched.h>
arch/x86/kernel/apic/msi.c +1 -0
@@ -12,6 +12,7 @@*/ #include <linux/mm.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/pci.h> #include <linux/dmar.h> #include <linux/hpet.h>
arch/x86/kernel/apic/vector.c +1 -0
@@ -11,6 +11,7 @@* published by the Free Software Foundation. */ #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/init.h> #include <linux/compiler.h> #include <linux/slab.h>
arch/x86/kernel/cpu/amd.c +45 -39
152 lines not on this page · raw message
arch/x86/kernel/cpu/bugs.c +140 -31
229 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +42 -21
108 lines not on this page · raw message
arch/x86/kernel/cpu/cpu.h +2 -0
@@ -46,6 +46,8 @@ extern const struct cpu_dev *const __x86_cpu_dev_start[],extern void get_cpu_cap (struct cpuinfo_x86 *c);extern void cpu_detect_cache_sizes (struct cpuinfo_x86 *c); +extern int detect_extended_topology_early (struct cpuinfo_x86 *c); +extern int detect_ht_early (struct cpuinfo_x86 *c);extern void x86_spec_ctrl_setup_ap (void );
arch/x86/kernel/cpu/intel.c +7 -0
@@ -283,6 +283,13 @@ static void early_init_intel(struct cpuinfo_x86 *c) }check_mpx_erratum (c); + +/* +* Get the number of SMT siblings early from the extended topology +* leaf, if available. Otherwise try the legacy SMT detection. +*/ +if (detect_extended_topology_early (c) <0 ) +detect_ht_early (c); }#ifdef CONFIG_X86_32
arch/x86/kernel/cpu/microcode/core.c +26 -0
@@ -384,6 +384,24 @@ static void __exit microcode_dev_exit(void)/* fake device for request_firmware */ static struct platform_device *microcode_pdev; +static int check_online_cpus (void ) +{ +unsigned int cpu; + +/* +* Make sure all CPUs are online. It's fine for SMT to be disabled if +* all the primary threads are still online. +*/ +for_each_present_cpu (cpu) { +if (topology_is_primary_thread (cpu) && !cpu_online (cpu)) { +pr_err ("Not all CPUs online, aborting microcode update.\n" ); +return -EINVAL ; + } + } + +return 0 ; +} +static int reload_for_cpu (int cpu) {struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -418,7 +436,13 @@ static ssize_t reload_store(struct device *dev,return size;get_online_cpus (); + + ret =check_online_cpus (); +if (ret) + goto put; +mutex_lock (µcode_mutex); +for_each_online_cpu (cpu) { tmp_ret =reload_for_cpu (cpu);if (tmp_ret !=0 )
@@ -431,6 +455,8 @@ static ssize_t reload_store(struct device *dev,if (!ret)perf_check_microcode ();mutex_unlock (µcode_mutex); + +put:put_online_cpus ();if (!ret)
arch/x86/kernel/cpu/topology.c +24 -17
72 lines not on this page · raw message
arch/x86/kernel/fpu/core.c +1 -0
@@ -10,6 +10,7 @@#include <asm/fpu/signal.h> #include <asm/fpu/types.h> #include <asm/traps.h> +#include <asm/irq_regs.h> #include <linux/hardirq.h> #include <linux/pkeys.h>
arch/x86/kernel/ftrace.c +1 -0
@@ -26,6 +26,7 @@#include <asm/cacheflush.h> #include <asm/kprobes.h> +#include <asm/sections.h> #include <asm/ftrace.h> #include <asm/nops.h>
arch/x86/kernel/hpet.c +1 -0
@@ -1,6 +1,7 @@#include <linux/clocksource.h> #include <linux/clockchips.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/export.h> #include <linux/delay.h> #include <linux/errno.h>
arch/x86/kernel/i8259.c +1 -0
@@ -4,6 +4,7 @@#include <linux/sched.h> #include <linux/ioport.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/timex.h> #include <linux/random.h> #include <linux/init.h>
arch/x86/kernel/irq.c +1 -0
@@ -10,6 +10,7 @@#include <linux/ftrace.h> #include <linux/delay.h> #include <linux/export.h> +#include <linux/irq.h> #include <asm/apic.h> #include <asm/io_apic.h>
arch/x86/kernel/irq_32.c +1 -0
@@ -10,6 +10,7 @@#include <linux/seq_file.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/kernel_stat.h> #include <linux/notifier.h> #include <linux/cpu.h>
arch/x86/kernel/irq_64.c +1 -0
@@ -10,6 +10,7 @@#include <linux/kernel_stat.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/seq_file.h> #include <linux/delay.h> #include <linux/ftrace.h>
arch/x86/kernel/irqinit.c +1 -0
@@ -4,6 +4,7 @@#include <linux/sched.h> #include <linux/ioport.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/timex.h> #include <linux/random.h> #include <linux/kprobes.h>
arch/x86/kernel/kprobes/core.c +2 -3
@@ -61,6 +61,7 @@#include <asm/alternative.h> #include <asm/insn.h> #include <asm/debugreg.h> +#include <asm/sections.h> #include "common.h"
@@ -396,7 +397,6 @@ int __copy_instruction(u8 *dest, u8 *src) newdisp = (u8 *) src + (s64 ) insn.displacement.value - (u8 *) dest;if ((s64 ) (s32 ) newdisp != newdisp) {pr_err ("Kprobes error: new displacement does not fit into s32 (%llx)\n" , newdisp); -pr_err ("\tSrc: %p, Dest: %p, old disp: %x\n" , src, dest, insn.displacement.value);return 0 ; } disp = (u8 *) dest +insn_offset_displacement (&insn);
@@ -612,8 +612,7 @@ static int reenter_kprobe(struct kprobe *p, struct pt_regs *regs,* Raise a BUG or we'll continue in an endless reentering loop * and eventually a stack overflow. */ -printk (KERN_WARNING "Unrecoverable kprobe detected at %p.\n" , - p->addr); +pr_err ("Unrecoverable kprobe detected.\n" );dump_kprobe (p);BUG ();default :
arch/x86/kernel/kprobes/opt.c +1 -0
@@ -39,6 +39,7 @@#include <asm/insn.h> #include <asm/debugreg.h> #include <asm/nospec-branch.h> +#include <asm/sections.h> #include "common.h"
arch/x86/kernel/paravirt.c +10 -4
@@ -88,10 +88,12 @@ unsigned paravirt_patch_call(void *insnbuf,struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 ); -if (tgt_clobbers & ~site_clobbers) -return len;/* target would clobber too much for this site */ -if (len <5 ) +if (len <5 ) { +#ifdef CONFIG_RETPOLINE +WARN_ONCE ("Failing to patch indirect CALL in %ps\n" , (void *)addr); +#endif return len;/* call too long for patch site */ + } b->opcode =0xe8 ;/* call */ b->delta = delta;
@@ -106,8 +108,12 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 ); -if (len <5 ) +if (len <5 ) { +#ifdef CONFIG_RETPOLINE +WARN_ONCE ("Failing to patch indirect JMP in %ps\n" , (void *)addr); +#endif return len;/* call too long for patch site */ + } b->opcode =0xe9 ;/* jmp */ b->delta = delta;
arch/x86/kernel/setup.c +6 -0
@@ -854,6 +854,12 @@ void __init setup_arch(char **cmdline_p)memblock_reserve (__pa_symbol (_text), (unsigned long )__bss_stop - (unsigned long )_text); +/* +* Make sure page 0 is always reserved because on systems with +* L1TF its contents can be leaked to user processes. +*/ +memblock_reserve (0 ,PAGE_SIZE ); +early_reserve_initrd ();/*
arch/x86/kernel/smp.c +1 -0
@@ -271,6 +271,7 @@ __visible void __irq_entry smp_reschedule_interrupt(struct pt_regs *regs)/* * KVM uses this interrupt to force a cpu out of guest mode */ +kvm_set_cpu_l1tf_flush_l1d (); } __visible void __irq_entry smp_trace_reschedule_interrupt(struct pt_regs *regs)
arch/x86/kernel/smpboot.c +18 -7
@@ -76,13 +76,7 @@#include <asm/realmode.h> #include <asm/misc.h> #include <asm/spec-ctrl.h> - -/* Number of siblings per CPU package */ -int smp_num_siblings =1 ; -EXPORT_SYMBOL (smp_num_siblings); - -/* Last level cache ID of each logical CPU */ -DEFINE_PER_CPU_READ_MOSTLY (u16, cpu_llc_id) =BAD_APICID ; +#include <asm/hw_irq.h> /* representing HT siblings of each logical CPU */ DEFINE_PER_CPU_READ_MOSTLY (cpumask_var_t, cpu_sibling_map);
@@ -295,6 +289,23 @@ int topology_update_package_map(unsigned int pkg, unsigned int cpu)return 0 ; } +/** +* topology_is_primary_thread - Check whether CPU is the primary SMT thread +* @cpu: CPU to check +*/ +bool topology_is_primary_thread (unsigned int cpu) +{ +return apic_id_is_primary_thread (per_cpu (x86_cpu_to_apicid, cpu)); +} + +/** +* topology_smt_supported - Check whether SMT is supported by the CPUs +*/ +bool topology_smt_supported (void ) +{ +return smp_num_siblings >1 ; +} +/** * topology_phys_to_logical_pkg - Map a physical package id to a logical *
arch/x86/kernel/time.c +1 -0
@@ -11,6 +11,7 @@#include <linux/clockchips.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/i8253.h> #include <linux/time.h> #include <linux/export.h>
arch/x86/kvm/svm.c +43 -3
94 lines not on this page · raw message
arch/x86/kvm/vmx.c +377 -49
520 lines not on this page · raw message
arch/x86/kvm/x86.c +126 -7
133 lines not on this page · raw message
arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/char/tpm/tpm-dev.c +20 -23
43 lines not on this page · raw message
drivers/infiniband/hw/mlx4/mr.c +42 -8
50 lines not on this page · raw message
drivers/infiniband/hw/ocrdma/ocrdma_stats.c +1 -1
Lines of this file are not shown. View the raw message.
fs/proc/proc_sysctl.c +66 -17
83 lines not on this page · raw message
kernel/cpu.c +271 -13
284 lines not on this page · raw message
mm/mprotect.c +49 -0
49 lines not on this page · raw message
mm/swapfile.c +30 -16
46 lines not on this page · raw message
tools/arch/x86/include/asm/cpufeatures.h +3 -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.