Linux 4.14.14
Greg KH
maintainerI'm announcing the release of the 4.14.14 kernel.
All users of the 4.14 kernel series must upgrade.
The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.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 | 16 Documentation/admin-guide/kernel-parameters.txt | 49 + Documentation/x86/pti.txt | 186 +++++ Makefile | 2 arch/mips/kernel/process.c | 12 arch/mips/kernel/ptrace.c | 147 +++- arch/powerpc/kvm/book3s_64_mmu.c | 1 arch/powerpc/kvm/book3s_64_mmu_hv.c | 90 +- arch/powerpc/kvm/book3s_pr.c | 2 arch/x86/Kconfig | 14 arch/x86/Makefile | 8 arch/x86/crypto/aesni-intel_asm.S | 5 arch/x86/crypto/camellia-aesni-avx-asm_64.S | 3 arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 3 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 arch/x86/entry/calling.h | 36 - arch/x86/entry/entry_32.S | 5 arch/x86/entry/entry_64.S | 12 arch/x86/events/intel/bts.c | 18 arch/x86/include/asm/asm-prototypes.h | 25 arch/x86/include/asm/cpufeatures.h | 4 arch/x86/include/asm/mshyperv.h | 18 arch/x86/include/asm/msr-index.h | 3 arch/x86/include/asm/nospec-branch.h | 214 ++++++ arch/x86/include/asm/processor-flags.h | 2 arch/x86/include/asm/tlbflush.h | 6 arch/x86/include/asm/xen/hypercall.h | 5 arch/x86/kernel/acpi/boot.c | 61 + arch/x86/kernel/alternative.c | 7 arch/x86/kernel/cpu/amd.c | 28 arch/x86/kernel/cpu/bugs.c | 185 +++++ arch/x86/kernel/cpu/common.c | 3 arch/x86/kernel/cpu/microcode/intel.c | 13 arch/x86/kernel/ftrace_32.S | 6 arch/x86/kernel/ftrace_64.S | 8 arch/x86/kernel/irq_32.c | 9 arch/x86/kernel/tboot.c | 11 arch/x86/kvm/svm.c | 23 arch/x86/kvm/vmx.c | 30 arch/x86/kvm/x86.c | 8 arch/x86/lib/Makefile | 1 arch/x86/lib/checksum_32.S | 7 arch/x86/lib/retpoline.S | 48 + arch/x86/mm/pti.c | 32 arch/x86/platform/efi/efi_64.c | 2 crypto/algapi.c | 12 drivers/base/Kconfig | 3 drivers/base/cpu.c | 48 + drivers/block/rbd.c | 18 drivers/gpu/drm/i915/gvt/gtt.c | 5 drivers/gpu/drm/i915/i915_drv.c | 1 drivers/gpu/drm/i915/i915_reg.h | 2 drivers/gpu/drm/i915/intel_display.c | 14 drivers/gpu/drm/i915/intel_engine_cs.c | 5 drivers/gpu/drm/i915/intel_pm.c | 44 - drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 41 - drivers/infiniband/hw/cxgb4/cq.c | 7 drivers/infiniband/hw/cxgb4/ev.c | 8 drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 drivers/infiniband/hw/cxgb4/qp.c | 119 ++- drivers/infiniband/hw/cxgb4/t4.h | 6 drivers/infiniband/ulp/srpt/ib_srpt.c | 5 drivers/md/dm-bufio.c | 8 drivers/mmc/host/renesas_sdhi_core.c | 3 drivers/mux/core.c | 4 drivers/net/can/usb/gs_usb.c | 2 drivers/net/can/vxcan.c | 2 drivers/net/ethernet/freescale/fec_main.c | 7 drivers/net/ethernet/intel/e1000e/ich8lan.c | 11 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 11 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 6 drivers/net/ethernet/renesas/sh_eth.c | 29 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 drivers/net/phy/phylink.c | 3 drivers/net/phy/sfp-bus.c | 6 drivers/net/wireless/intel/iwlwifi/pcie/internal.h | 10 drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 11 drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 8 drivers/platform/x86/wmi.c | 2 drivers/staging/android/ashmem.c | 2 drivers/usb/gadget/udc/core.c | 28 drivers/usb/misc/usb3503.c | 2 drivers/usb/mon/mon_bin.c | 8 drivers/usb/serial/cp210x.c | 2 drivers/usb/storage/unusual_uas.h | 7 drivers/usb/usbip/usbip_common.c | 17 drivers/usb/usbip/vudc_rx.c | 19 drivers/usb/usbip/vudc_tx.c | 11 include/linux/bpf.h | 2 include/linux/cpu.h | 7 include/linux/crash_core.h | 2 include/linux/sh_eth.h | 1 include/net/sctp/structs.h | 2 include/trace/events/kvm.h | 7 kernel/bpf/arraymap.c | 61 + kernel/bpf/verifier.c | 41 + kernel/cgroup/cgroup.c | 14 kernel/crash_core.c | 2 kernel/sched/membarrier.c | 2 net/8021q/vlan.c | 7 net/bluetooth/l2cap_core.c | 20 net/core/ethtool.c | 15 net/core/sock_diag.c | 2 net/ipv6/exthdrs.c | 9 net/ipv6/ip6_output.c | 5 net/ipv6/ip6_tunnel.c | 9 net/rds/rdma.c | 4 net/sched/act_gact.c | 2 net/sched/act_mirred.c | 2 net/sctp/input.c | 28 net/sctp/transport.c | 29 security/Kconfig | 2 security/apparmor/include/perms.h | 3 security/apparmor/ipc.c | 53 - sound/core/oss/pcm_oss.c | 41 - sound/core/oss/pcm_plugin.c | 14 sound/core/pcm_lib.c | 4 sound/core/pcm_native.c | 9 sound/drivers/aloop.c | 98 +- tools/objtool/check.c | 69 +- tools/objtool/check.h | 2 tools/testing/selftests/bpf/test_verifier.c | 40 + tools/testing/selftests/x86/Makefile | 2 tools/testing/selftests/x86/test_vsyscall.c | 500 +++++++++++++++ virt/kvm/arm/mmio.c | 6 130 files changed, 2524 insertions(+), 542 deletions(-)
Alan Stern (1):
USB: UDC core: fix double-free in usb_add_gadget_udc_release
Alexei Starovoitov (1):
bpf: prevent out-of-bounds speculation
Alexey Kardashevskiy (1):
KVM: PPC: Book3S PR: Fix WIMG handling under pHyp
Andi Kleen (1):
x86/retpoline/irq32: Convert assembler indirect jumps
Andrew Honig (1):
KVM: x86: Add memory barrier on vmcs field lookup
Andrii Vladyka (1):
net: core: fix module type in sock_diag_bind
Andy Lutomirski (1):
selftests/x86: Add test_vsyscall
Bart Van Assche (2):
IB/srpt: Disable RDMA access by the initiator IB/srpt: Fix ACL lookup during login
Ben Seri (1):
Bluetooth: Prevent stack info leak from the EFS element.
Benjamin Poirier (1):
e1000e: Fix e1000_check_for_copper_link_ich8lan return value.
Borislav Petkov (1):
x86/alternatives: Fix optimize_nops() checking
Christian Holl (1):
USB: serial: cp210x: add new device ID ELV ALC 8xxx
Cong Wang (1):
8021q: fix a memory leak for VLAN 0 device
Dan Carpenter (1):
drm/vmwgfx: Potential off by one in vmw_view_add()
Daniel Borkmann (2):
bpf, array: fix overflow in max_entries and undefined behavior in index_mask
bpf: arsh is not supported in 32 bit alu thus reject it
Dave Hansen (3):
x86/Documentation: Add PTI description
x86/tboot: Unbreak tboot with PTI enabled x86/pti: Make unpoison of pgd for trusted boot work for real
David Gibson (1):
KVM: PPC: Book3S HV: Always flush TLB in kvmppc_alloc_reset_hpt()
David Woodhouse (11):
x86/cpufeatures: Add X86_BUG_SPECTRE_V[12]
sysfs/cpu: Fix typos in vulnerability documentation x86/retpoline: Add initial retpoline support x86/spectre: Add boot time option to select Spectre v2 mitigation x86/retpoline/crypto: Convert crypto assembler indirect jumps x86/retpoline/entry: Convert entry assembler indirect jumps x86/retpoline/ftrace: Convert ftrace assembler indirect jumps x86/retpoline/hyperv: Convert assembler indirect jumps x86/retpoline/xen: Convert Xen hypercall indirect jumps x86/retpoline/checksum32: Convert assembler indirect jumps x86/retpoline: Fill return stack buffer on vmexit
Diego Elio Pettenò (1):
USB: serial: cp210x: add IDs for LifeScan OneTouch Verio IQ
Eli Cooper (1):
ip6_tunnel: disable dst caching if tunnel is dual-stack
Emmanuel Grumbach (1):
iwlwifi: pcie: fix DMA memory mapping / unmapping
Eric Biggers (1):
crypto: algapi - fix NULL dereference in crypto_remove_spawns()
Eric Dumazet (1):
ipv6: fix possible mem leaks in ipv6_make_skb()
Florian Margaine (1):
rbd: reacquire lock should update lock owner client id
Fugang Duan (3):
net: fec: restore dev_id in the cases of probe error
net: fec: defer probe if regulator is not ready
net: fec: free/restore resource in related probe error pathes
Greg Kroah-Hartman (1):
Linux 4.14.14
Hans de Goede (1):
mux: core: fix double get_device()
Icenowy Zheng (1):
uas: ignore UAS for Norelsys NS1068(X) chips
Ido Schimmel (2):
mlxsw: spectrum_router: Fix NULL pointer deref
mlxsw: spectrum: Relax sanity checks during enslavement
Ilya Dryomov (1):
rbd: set max_segments to USHRT_MAX
Jerome Brunet (1):
net: stmmac: enable EEE in MII, GMII or RGMII only
Jia Zhang (1):
x86/microcode/intel: Extend BDW late-loading with a revision check
Jike Song (1):
x86/mm/pti: Remove dead logic in pti_user_pagetable_walk*()
Jim Mattson (1):
kvm: vmx: Scrub hardware GPRs at VM-exit
Jiri Kosina (1):
x86/pti: Unbreak EFI old_memmap
John Johansen (1):
apparmor: fix ptrace label match when matching stacked labels
Josh Poimboeuf (2):
objtool: Detect jumps to retpoline thunks
objtool: Allow alternatives to be ignored
Kenneth Graunke (1):
drm/i915: Whitelist SLICE_COMMON_ECO_CHICKEN1 on Geminilake.
Kirill A. Shutemov (1):
kdump: write correct address of mem_section into vmcoreinfo
Maciej W. Rozycki (7):
MIPS: Validate PR_SET_FP_MODE prctl(2) requests against the ABI of the task
MIPS: Factor out NT_PRFPREG regset access helpers
MIPS: Guard against any partial write attempt with PTRACE_SETREGSET
MIPS: Consistently handle buffer counter with PTRACE_SETREGSET
MIPS: Fix an FCSR access API regression with NT_PRFPREG and MSA
MIPS: Also verify sizeof `elf_fpreg_t' with PTRACE_SETREGSET
MIPS: Disallow outsized PTRACE_SETREGSET NT_PRFPREG regset accesses
Marcelo Ricardo Leitner (2):
sctp: do not retransmit upon FragNeeded if PMTU discovery is disabled
sctp: fix the handling of ICMP Frag Needed for too small MTUs
Masaharu Hayakawa (1):
mmc: renesas_sdhi: Add MODULE_LICENSE
Mathieu Desnoyers (1):
membarrier: Disable preemption when calling smp_call_function_many()
Mathieu Xhonneux (1):
ipv6: sr: fix TLVs not being copied using setsockopt
Mohamed Ghannam (2):
RDS: Heap OOB write in rds_message_alloc_sgs()
RDS: null pointer dereference in rds_atomic_free_op
Oliver Hartkopp (1):
can: vxcan: improve handling of missing peer name attribute
Pete Zaitcev (1):
USB: fix usbmon BUG trigger
Peter Zijlstra (1):
x86,perf: Disable intel_bts when PTI
Rafael J. Wysocki (1):
platform/x86: wmi: Call acpi_wmi_init() later
Roi Dayan (1):
net/sched: Fix update of lastuse in act modules implementing stats_update
Russell King (2):
phylink: ensure we report link down when LOS asserted
sfp: fix sfp-bus oops when removing socket/upstream
Sergei Shtylyov (2):
sh_eth: fix TSU resource handling
sh_eth: fix SH7757 GEther initialization
Serhii Popovych (2):
KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt
KVM: PPC: Book3S HV: Fix use after free in case of multiple resize requests
Shuah Khan (3):
usbip: remove kernel addresses from usb device and urb debug msgs
usbip: fix vudc_rx: harden CMD_SUBMIT path to handle malicious input
usbip: vudc_tx: fix v_send_ret_submit() vulnerability to null xfer buffer
Stefan Agner (1):
usb: misc: usb3503: make sure reset is low for at least 100us
Stephen Hemminger (1):
ethtool: do not print warning for applications using legacy API
Steve Wise (5):
iw_cxgb4: only call the cq comp_handler when the cq is armed
iw_cxgb4: atomically flush the qp
iw_cxgb4: only clear the ARMED bit if a notification is needed
iw_cxgb4: reflect the original WR opcode in drain cqes
iw_cxgb4: when flushing, complete all wrs in a chain
Suren Baghdasaryan (1):
dm bufio: fix shrinker scans when (nr_to_scan < retain_target)
Takashi Iwai (8):
ALSA: pcm: Remove incorrect snd_BUG_ON() usages
ALSA: pcm: Workaround for weird PulseAudio behavior on rewind error
ALSA: pcm: Add missing error checks in OSS emulation plugin builder
ALSA: pcm: Abort properly at pending signal in OSS read/write loops
ALSA: pcm: Allow aborting mutex lock at OSS read/write loops
ALSA: aloop: Release cable upon open error path
ALSA: aloop: Fix inconsistent format due to incomplete rule
ALSA: aloop: Fix racy hw constraints adjustment
Tejun Heo (1):
cgroup: fix css_task_iter crash on CSS_TASK_ITER_PROC
Thomas Gleixner (4):
sysfs/cpu: Add vulnerability folder
x86/cpu: Implement CPU vulnerabilites sysfs functions x86/pti: Fix !PCID and sanitize defines x86/retpoline: Remove compile time warning
Thomas Hellstrom (1):
drm/vmwgfx: Don't cache framebuffer maps
Tom Lendacky (2):
x86/cpu/AMD: Make LFENCE a serializing instruction x86/cpu/AMD: Use LFENCE_RDTSC in preference to MFENCE_RDTSC
Vikas C Sajjan (2):
x86/acpi: Handle SCI interrupts above legacy space gracefully x86/acpi: Reduce code duplication in mp_override_legacy_irq()
Viktor Slavkovic (1):
staging: android: ashmem: fix a race condition in ASHMEM_SET_SIZE ioctl
Ville Syrjälä (2):
drm/i915: Move init_clock_gating() back to where it was drm/i915: Fix init_clock_gating for resume
W. Trevor King (1):
security/Kconfig: Correct the Documentation reference for PTI
Wanpeng Li (1):
KVM: Fix stack-out-of-bounds read in write_mmio
Wolfgang Grandegger (1):
can: gs_usb: fix return value of the "set_bittiming" callback
Zhi Wang (1):
drm/i915/gvt: Clear the shadow page table entry after post-sync
Greg KH
maintainerDocumentation/ABI/testing/sysfs-devices-system-cpu +16 -0
@@ -373,3 +373,19 @@ Contact: Linux kernel mailing list <[email protected]> Description: information about CPUs heterogeneity. cpu_capacity: capacity of cpu#. + +What: /sys/devices/system/cpu/vulnerabilities + /sys/devices/system/cpu/vulnerabilities/meltdown + /sys/devices/system/cpu/vulnerabilities/spectre_v1 + /sys/devices/system/cpu/vulnerabilities/spectre_v2 +Date: January 2018 +Contact: Linux kernel mailing list <[email protected]> +Description: Information about CPU vulnerabilities + + The files are named after the code names of CPU + vulnerabilities. The output of those files reflects the + state of the CPUs in the system. Possible output values: + + "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
Documentation/admin-guide/kernel-parameters.txt +42 -7
73 lines not on this page · raw message
Documentation/x86/pti.txt new file +186 -0
186 lines not on this page · raw message
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 13 +SUBLEVEL = 14 EXTRAVERSION = NAME = Petit Gorille
arch/mips/kernel/process.c +12 -0
@@ -705,6 +705,18 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)struct task_struct *t;int max_users; +/* If nothing to change, return right away, successfully. */ +if (value ==mips_get_process_fp_mode (task)) +return 0 ; + +/* Only accept a mode change if 64-bit FP enabled for o32. */ +if (!IS_ENABLED (CONFIG_MIPS_O32_FP64_SUPPORT )) +return -EOPNOTSUPP ; + +/* And only for o32 tasks. */ +if (IS_ENABLED (CONFIG_64BIT ) && !test_thread_flag (TIF_32BIT_REGS )) +return -EOPNOTSUPP ; +/* Check the value is valid */ if (value & ~known_bits)return -EOPNOTSUPP ;
arch/mips/kernel/ptrace.c +122 -25
185 lines not on this page · raw message
arch/powerpc/kvm/book3s_64_mmu.c +1 -0
@@ -235,6 +235,7 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, gpte->may_read = true; gpte->may_write = true; gpte->page_size =MMU_PAGE_4K ; + gpte->wimg =HPTE_R_M ;return 0 ; }
arch/powerpc/kvm/book3s_64_mmu_hv.c +61 -29
155 lines not on this page · raw message
arch/powerpc/kvm/book3s_pr.c +2 -0
@@ -60,6 +60,7 @@ static void kvmppc_giveup_fac(struct kvm_vcpu *vcpu, ulong fac);#define MSR_USER32 MSR_USER#define MSR_USER64 MSR_USER#define HW_PAGE_SIZE PAGE_SIZE +#define HPTE_R_M _PAGE_COHERENT#endif static bool kvmppc_is_split_real (struct kvm_vcpu *vcpu)
@@ -557,6 +558,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu, pte.eaddr = eaddr; pte.vpage = eaddr >>12 ; pte.page_size =MMU_PAGE_64K ; + pte.wimg =HPTE_R_M ; }switch (kvmppc_get_msr (vcpu) & (MSR_DR |MSR_IR )) {
arch/x86/Kconfig +14 -0
@@ -89,6 +89,7 @@ config X86 select GENERIC_CLOCKEVENTS_MIN_ADJUST select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE + select GENERIC_CPU_VULNERABILITIES select GENERIC_EARLY_IOREMAP select GENERIC_FIND_FIRST_BIT select GENERIC_IOMAP
@@ -428,6 +429,19 @@ config GOLDFISH def_bool y depends on X86_GOLDFISH +config RETPOLINE + bool "Avoid speculative indirect branches in kernel" + default y + help + Compile kernel with the retpoline compiler options to guard against + kernel-to-user data leaks by avoiding speculative indirect + branches. Requires a compiler with -mindirect-branch=thunk-extern + support for full protection. The kernel may run slower. + + Without compiler support, at least indirect branches in assembler + code are eliminated. Since this includes the syscall entry path, + it is not entirely pointless. + config INTEL_RDT bool "Intel Resource Director Technology support" default n
arch/x86/Makefile +8 -0
@@ -235,6 +235,14 @@ KBUILD_CFLAGS += -Wno-sign-compare # KBUILD_CFLAGS += -fno-asynchronous-unwind-tables +# Avoid indirect branches in kernel to deal with Spectre +ifdef CONFIG_RETPOLINE + RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) + ifneq ($(RETPOLINE_CFLAGS),) + KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE + endif +endif + archscripts: scripts_basic $(Q)$(MAKE) $(build)=arch/x86/tools relocs
arch/x86/crypto/aesni-intel_asm.S +3 -2
@@ -32,6 +32,7 @@ #include <linux/linkage.h> #include <asm/inst.h> #include <asm/frame.h> +#include <asm/nospec-branch.h> /* * The following macros are used to move an (un)aligned 16 byte value to/from
@@ -2884,7 +2885,7 @@ ENTRY(aesni_xts_crypt8) pxor INC, STATE4 movdqu IV, 0x30(OUTP) - call *%r11 + CALL_NOSPEC %r11 movdqu 0x00(OUTP), INC pxor INC, STATE1
@@ -2929,7 +2930,7 @@ ENTRY(aesni_xts_crypt8) _aesni_gf128mul_x_ble() movups IV, (IVP) - call *%r11 + CALL_NOSPEC %r11 movdqu 0x40(OUTP), INC pxor INC, STATE1
arch/x86/crypto/camellia-aesni-avx-asm_64.S +2 -1
@@ -17,6 +17,7 @@ #include <linux/linkage.h> #include <asm/frame.h> +#include <asm/nospec-branch.h> #define CAMELLIA_TABLE_BYTE_LEN 272
@@ -1227,7 +1228,7 @@ camellia_xts_crypt_16way: vpxor 14 * 16(%rax), %xmm15, %xmm14; vpxor 15 * 16(%rax), %xmm15, %xmm15; - call *%r9; + CALL_NOSPEC %r9; addq $(16 * 16), %rsp;
arch/x86/crypto/camellia-aesni-avx2-asm_64.S +2 -1
@@ -12,6 +12,7 @@ #include <linux/linkage.h> #include <asm/frame.h> +#include <asm/nospec-branch.h> #define CAMELLIA_TABLE_BYTE_LEN 272
@@ -1343,7 +1344,7 @@ camellia_xts_crypt_32way: vpxor 14 * 32(%rax), %ymm15, %ymm14; vpxor 15 * 32(%rax), %ymm15, %ymm15; - call *%r9; + CALL_NOSPEC %r9; addq $(16 * 32), %rsp;
arch/x86/crypto/crc32c-pcl-intel-asm_64.S +2 -1
@@ -45,6 +45,7 @@ #include <asm/inst.h> #include <linux/linkage.h> +#include <asm/nospec-branch.h> ## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction
@@ -172,7 +173,7 @@ continue_block: movzxw (bufp, %rax, 2), len lea crc_array(%rip), bufp lea (bufp, len, 1), bufp - jmp *bufp + JMP_NOSPEC bufp ################################################################ ## 2a) PROCESS FULL BLOCKS:
arch/x86/entry/calling.h +19 -17
@@ -198,8 +198,11 @@ For 32-bit we have the following conventions - kernel is built with* PAGE_TABLE_ISOLATION PGDs are 8k. Flip bit 12 to switch between the two * halves: */ -#define PTI_SWITCH_PGTABLES_MASK (1<<PAGE_SHIFT) -#define PTI_SWITCH_MASK (PTI_SWITCH_PGTABLES_MASK|(1<<X86_CR3_PTI_SWITCH_BIT)) +#define PTI_USER_PGTABLE_BIT PAGE_SHIFT +#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT) +#define PTI_USER_PCID_BIT X86_CR3_PTI_PCID_USER_BIT +#define PTI_USER_PCID_MASK (1 << PTI_USER_PCID_BIT) +#define PTI_USER_PGTABLE_AND_PCID_MASK (PTI_USER_PCID_MASK | PTI_USER_PGTABLE_MASK) .macro SET_NOFLUSH_BIT reg:req bts $X86_CR3_PCID_NOFLUSH_BIT, \reg
@@ -208,7 +211,7 @@ For 32-bit we have the following conventions - kernel is built with .macro ADJUST_KERNEL_CR3 reg:req ALTERNATIVE "", "SET_NOFLUSH_BIT \reg", X86_FEATURE_PCID /* Clear PCID and "PAGE_TABLE_ISOLATION bit", point CR3 at kernel pagetables: */ - andq $(~PTI_SWITCH_MASK), \reg + andq $(~PTI_USER_PGTABLE_AND_PCID_MASK), \reg .endm .macro SWITCH_TO_KERNEL_CR3 scratch_reg:req
@@ -239,15 +242,19 @@ For 32-bit we have the following conventions - kernel is built with/* Flush needed, clear the bit */ btr \scratch_reg, THIS_CPU_user_pcid_flush_mask movq \scratch_reg2, \scratch_reg - jmp .Lwrcr3_\@ + jmp .Lwrcr3_pcid_\@ .Lnoflush_\@: movq \scratch_reg2, \scratch_reg SET_NOFLUSH_BIT \scratch_reg +.Lwrcr3_pcid_\@: +/* Flip the ASID to the user version */ + orq $(PTI_USER_PCID_MASK), \scratch_reg + .Lwrcr3_\@: -/* Flip the PGD and ASID to the user version */ - orq $(PTI_SWITCH_MASK), \scratch_reg +/* Flip the PGD to the user version */ + orq $(PTI_USER_PGTABLE_MASK), \scratch_reg mov \scratch_reg, %cr3 .Lend_\@: .endm
@@ -263,17 +270,12 @@ For 32-bit we have the following conventions - kernel is built with movq %cr3, \scratch_reg movq \scratch_reg, \save_reg /* -* Is the "switch mask" all zero? That means that both of -* these are zero: -* -* 1. The user/kernel PCID bit, and -* 2. The user/kernel "bit" that points CR3 to the -* bottom half of the 8k PGD -* -* That indicates a kernel CR3 value, not a user CR3. + * Test the user pagetable bit. If set, then the user page tables + * are active. If clear CR3 already has the kernel page table + * active. */ - testq $(PTI_SWITCH_MASK), \scratch_reg - jz .Ldone_\@ + bt $PTI_USER_PGTABLE_BIT, \scratch_reg + jnc .Ldone_\@ ADJUST_KERNEL_CR3 \scratch_reg movq \scratch_reg, %cr3
@@ -290,7 +292,7 @@ For 32-bit we have the following conventions - kernel is built with* KERNEL pages can always resume with NOFLUSH as we do * explicit flushes. */ - bt $X86_CR3_PTI_SWITCH_BIT, \save_reg + bt $PTI_USER_PGTABLE_BIT, \save_reg jnc .Lnoflush_\@/*
arch/x86/entry/entry_32.S +3 -2
@@ -44,6 +44,7 @@ #include <asm/asm.h> #include <asm/smap.h> #include <asm/frame.h> +#include <asm/nospec-branch.h> .section .entry.text, "ax"
@@ -290,7 +291,7 @@ ENTRY(ret_from_fork) /* kernel thread */ 1: movl %edi, %eax - call *%ebx + CALL_NOSPEC %ebx /* * A kernel thread is allowed to return here after successfully * calling do_execve(). Exit to userspace to complete the execve()
@@ -919,7 +920,7 @@ common_exception: movl %ecx, %es TRACE_IRQS_OFF movl %esp, %eax # pt_regs pointer - call *%edi + CALL_NOSPEC %edi jmp ret_from_exception END(common_exception)
arch/x86/entry/entry_64.S +9 -3
@@ -37,6 +37,7 @@ #include <asm/pgtable_types.h> #include <asm/export.h> #include <asm/frame.h> +#include <asm/nospec-branch.h> #include <linux/err.h> #include "calling.h"
@@ -187,7 +188,7 @@ ENTRY(entry_SYSCALL_64_trampoline) */ pushq %rdi movq $entry_SYSCALL_64_stage2, %rdi - jmp *%rdi + JMP_NOSPEC %rdi END(entry_SYSCALL_64_trampoline) .popsection
@@ -266,7 +267,12 @@ entry_SYSCALL_64_fastpath: * It might end up jumping to the slow path. If it jumps, RAX * and all argument registers are clobbered. */ +#ifdef CONFIG_RETPOLINE + movq sys_call_table(, %rax, 8), %rax + call __x86_indirect_thunk_rax +#else call *sys_call_table(, %rax, 8) +#endif .Lentry_SYSCALL_64_after_fastpath_call: movq %rax, RAX(%rsp)
@@ -438,7 +444,7 @@ ENTRY(stub_ptregs_64) jmp entry_SYSCALL64_slow_path 1: - jmp *%rax /* Called from C */ + JMP_NOSPEC %rax /* Called from C */ END(stub_ptregs_64) .macro ptregs_stub func
@@ -517,7 +523,7 @@ ENTRY(ret_from_fork) 1: /* kernel thread */ movq %r12, %rdi - call *%rbx + CALL_NOSPEC %rbx /* * A kernel thread is allowed to return here after successfully * calling do_execve(). Exit to userspace to complete the execve()
arch/x86/events/intel/bts.c +18 -0
@@ -582,6 +582,24 @@ static __init int bts_init(void)if (!boot_cpu_has (X86_FEATURE_DTES64 ) || !x86_pmu.bts)return -ENODEV ; +if (boot_cpu_has (X86_FEATURE_PTI )) { +/* +* BTS hardware writes through a virtual memory map we must +* either use the kernel physical map, or the user mapping of +* the AUX buffer. +* +* However, since this driver supports per-CPU and per-task inherit +* we cannot use the user mapping since it will not be availble +* if we're not running the owning process. +* +* With PTI we can't use the kernal map either, because its not +* there when we run userspace. +* +* For now, disable this driver when using PTI. +*/ +return -ENODEV ; + } + bts_pmu.capabilities =PERF_PMU_CAP_AUX_NO_SG |PERF_PMU_CAP_ITRACE |PERF_PMU_CAP_EXCLUSIVE ; bts_pmu.task_ctx_nr = perf_sw_context;
arch/x86/include/asm/asm-prototypes.h +25 -0
@@ -11,7 +11,32 @@#include <asm/pgtable.h> #include <asm/special_insns.h> #include <asm/preempt.h> +#include <asm/asm.h> #ifndef CONFIG_X86_CMPXCHG64 extern void cmpxchg8b_emu (void );#endif + +#ifdef CONFIG_RETPOLINE +#ifdef CONFIG_X86_32 +#define INDIRECT_THUNK (reg) extern asmlinkage void __x86_indirect_thunk_e ## reg(void); +#else +#define INDIRECT_THUNK (reg) extern asmlinkage void __x86_indirect_thunk_r ## reg(void); +INDIRECT_THUNK(8) +INDIRECT_THUNK(9) +INDIRECT_THUNK(10) +INDIRECT_THUNK(11) +INDIRECT_THUNK(12) +INDIRECT_THUNK(13) +INDIRECT_THUNK(14) +INDIRECT_THUNK(15) +#endif +INDIRECT_THUNK(ax) +INDIRECT_THUNK(bx) +INDIRECT_THUNK(cx) +INDIRECT_THUNK(dx) +INDIRECT_THUNK(si) +INDIRECT_THUNK(di) +INDIRECT_THUNK(bp) +INDIRECT_THUNK(sp) +#endif /* CONFIG_RETPOLINE */
arch/x86/include/asm/cpufeatures.h +4 -0
@@ -203,6 +203,8 @@#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME ( 7*32+10)/* AMD Secure Memory Encryption */ #define X86_FEATURE_PTI ( 7*32+11)/* Kernel Page Table Isolation enabled */ +#define X86_FEATURE_RETPOLINE ( 7*32+12)/* Generic Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_AMD ( 7*32+13)/* AMD Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ #define X86_FEATURE_AVX512_4VNNIW ( 7*32+16)/* AVX-512 Neural Network Instructions */
@@ -342,5 +344,7 @@#define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ #define X86_BUG_CPU_MELTDOWN X86_BUG(14)/* CPU is affected by meltdown attack and needs kernel page table isolation */ +#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 */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/mshyperv.h +10 -8
@@ -7,6 +7,7 @@#include <linux/nmi.h> #include <asm/io.h> #include <asm/hyperv.h> +#include <asm/nospec-branch.h> /* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
@@ -186,10 +187,11 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)return U64_MAX ; __asm__ __volatile__("mov %4, %%r8\n" -"call *%5" +CALL_NOSPEC : "=a" (hv_status), ASM_CALL_CONSTRAINT,"+c" (control),"+d" (input_address) - :"r" (output_address),"m" (hv_hypercall_pg) + : "r" (output_address), + THUNK_TARGET(hv_hypercall_pg) :"cc" ,"memory" ,"r8" ,"r9" ,"r10" ,"r11" );#else u32 input_address_hi =upper_32_bits (input_address);
@@ -200,13 +202,13 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)if (!hv_hypercall_pg)return U64_MAX ; - __asm__ __volatile__("call *%7" + __asm__ __volatile__(CALL_NOSPEC : "=A" (hv_status), "+c" (input_address_lo), ASM_CALL_CONSTRAINT : "A" (control), "b" (input_address_hi), "D"(output_address_hi), "S"(output_address_lo), -"m" (hv_hypercall_pg) + THUNK_TARGET(hv_hypercall_pg) : "cc", "memory");#endif /* !x86_64 */ return hv_status;
@@ -227,10 +229,10 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)#ifdef CONFIG_X86_64 { - __asm__ __volatile__("call *%4" + __asm__ __volatile__(CALL_NOSPEC : "=a" (hv_status), ASM_CALL_CONSTRAINT, "+c" (control), "+d" (input1) - :"m" (hv_hypercall_pg) + : THUNK_TARGET(hv_hypercall_pg) : "cc", "r8", "r9", "r10", "r11"); }#else
@@ -238,13 +240,13 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)u32 input1_hi =upper_32_bits (input1);u32 input1_lo =lower_32_bits (input1); - __asm__ __volatile__ ("call *%5" + __asm__ __volatile__ (CALL_NOSPEC : "=A"(hv_status), "+c"(input1_lo), ASM_CALL_CONSTRAINT : "A" (control), "b" (input1_hi), -"m" (hv_hypercall_pg) + THUNK_TARGET(hv_hypercall_pg) : "cc", "edi", "esi"); }#endif
arch/x86/include/asm/msr-index.h +3 -0
@@ -352,6 +352,9 @@#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffffULL#define FAM10H_MMIO_CONF_BASE_SHIFT 20#define MSR_FAM10H_NODE_ID 0xc001100c +#define MSR_F10H_DECFG 0xc0011029 +#define MSR_F10H_DECFG_LFENCE_SERIALIZE_BIT 1 +#define MSR_F10H_DECFG_LFENCE_SERIALIZE BIT_ULL(MSR_F10H_DECFG_LFENCE_SERIALIZE_BIT)/* K8 MSRs */ #define MSR_K8_TOP_MEM1 0xc001001a
arch/x86/include/asm/nospec-branch.h new file +214 -0
214 lines not on this page · raw message
arch/x86/include/asm/processor-flags.h +1 -1
@@ -40,7 +40,7 @@#define CR3_NOFLUSH BIT_ULL(63)#ifdef CONFIG_PAGE_TABLE_ISOLATION -# define X86_CR3_PTI_SWITCH_BIT 11 +# define X86_CR3_PTI_PCID_USER_BIT 11#endif #else
arch/x86/include/asm/tlbflush.h +3 -3
@@ -81,13 +81,13 @@ static inline u16 kern_pcid(u16 asid)* Make sure that the dynamic ASID space does not confict with the * bit we are using to switch between user and kernel ASIDs. */ -BUILD_BUG_ON (TLB_NR_DYN_ASIDS >= (1 <<X86_CR3_PTI_SWITCH_BIT )); +BUILD_BUG_ON (TLB_NR_DYN_ASIDS >= (1 <<X86_CR3_PTI_PCID_USER_BIT ));/* * The ASID being passed in here should have respected the * MAX_ASID_AVAILABLE and thus never have the switch bit set. */ -VM_WARN_ON_ONCE (asid & (1 <<X86_CR3_PTI_SWITCH_BIT )); +VM_WARN_ON_ONCE (asid & (1 <<X86_CR3_PTI_PCID_USER_BIT ));#endif /* * The dynamically-assigned ASIDs that get passed in are small
@@ -112,7 +112,7 @@ static inline u16 user_pcid(u16 asid) {u16 ret =kern_pcid (asid);#ifdef CONFIG_PAGE_TABLE_ISOLATION - ret |=1 <<X86_CR3_PTI_SWITCH_BIT ; + ret |=1 <<X86_CR3_PTI_PCID_USER_BIT ;#endif return ret; }
arch/x86/include/asm/xen/hypercall.h +3 -2
@@ -44,6 +44,7 @@#include <asm/page.h> #include <asm/pgtable.h> #include <asm/smap.h> +#include <asm/nospec-branch.h> #include <xen/interface/xen.h> #include <xen/interface/sched.h>
@@ -217,9 +218,9 @@ privcmd_call(unsigned call,__HYPERCALL_5ARG (a1, a2, a3, a4, a5);stac (); - asmvolatile ("call *%[call]" + asmvolatile (CALL_NOSPEC : __HYPERCALL_5PARAM - : [call]"a" (&hypercall_page[call]) + : [thunk_target] "a" (&hypercall_page[call]) : __HYPERCALL_CLOBBER5);clac ();
arch/x86/kernel/acpi/boot.c +38 -23
94 lines not on this page · raw message
arch/x86/kernel/alternative.c +5 -2
@@ -344,9 +344,12 @@ recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf) static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr) {unsigned long flags; +int i; -if (instr[0 ] !=0x90 ) -return ; +for (i =0 ; i < a->padlen; i++) { +if (instr[i] !=0x90 ) +return ; + }local_irq_save (flags);add_nops (instr + (a->instrlen - a->padlen), a->padlen);
arch/x86/kernel/cpu/amd.c +26 -2
@@ -829,8 +829,32 @@ static void init_amd(struct cpuinfo_x86 *c)set_cpu_cap (c,X86_FEATURE_K8 );if (cpu_has (c,X86_FEATURE_XMM2 )) { -/* MFENCE stops RDTSC speculation */ -set_cpu_cap (c,X86_FEATURE_MFENCE_RDTSC ); +unsigned long long val; +int ret; + +/* +* A serializing LFENCE has less overhead than MFENCE, so +* use it for execution serialization. On families which +* don't have that MSR, LFENCE is already serializing. +* msr_set_bit() uses the safe accessors, too, even if the MSR +* is not present. +*/ +msr_set_bit (MSR_F10H_DECFG , +MSR_F10H_DECFG_LFENCE_SERIALIZE_BIT ); + +/* +* Verify that the MSR write was successful (could be running +* under a hypervisor) and only then assume that LFENCE is +* serializing. +*/ + ret =rdmsrl_safe (MSR_F10H_DECFG , &val); +if (!ret && (val &MSR_F10H_DECFG_LFENCE_SERIALIZE )) { +/* A serializing LFENCE stops RDTSC speculation */ +set_cpu_cap (c,X86_FEATURE_LFENCE_RDTSC ); + }else { +/* MFENCE stops RDTSC speculation */ +set_cpu_cap (c,X86_FEATURE_MFENCE_RDTSC ); + } }/*
arch/x86/kernel/cpu/bugs.c +185 -0
206 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +3 -0
@@ -902,6 +902,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)if (c->x86_vendor !=X86_VENDOR_AMD )setup_force_cpu_bug (X86_BUG_CPU_MELTDOWN ); +setup_force_cpu_bug (X86_BUG_SPECTRE_V1 ); +setup_force_cpu_bug (X86_BUG_SPECTRE_V2 ); +fpu__init_system (c);#ifdef CONFIG_X86_32
arch/x86/kernel/cpu/microcode/intel.c +11 -2
@@ -910,8 +910,17 @@ static bool is_blacklisted(unsigned int cpu) {struct cpuinfo_x86 *c = &cpu_data (cpu); -if (c->x86 ==6 && c->x86_model ==INTEL_FAM6_BROADWELL_X ) { -pr_err_once ("late loading on model 79 is disabled.\n" ); +/* +* Late loading on model 79 with microcode revision less than 0x0b000021 +* may result in a system hang. This behavior is documented in item +* BDF90, #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family). +*/ +if (c->x86 ==6 && + c->x86_model ==INTEL_FAM6_BROADWELL_X && + c->x86_mask ==0x01 && + c->microcode <0x0b000021 ) { +pr_err_once ("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n" , c->microcode); +pr_err_once ("Please consider either early loading through initrd/built-in or a potential BIOS update.\n" );return true; }
arch/x86/kernel/ftrace_32.S +4 -2
@@ -8,6 +8,7 @@ #include <asm/segment.h> #include <asm/export.h> #include <asm/ftrace.h> +#include <asm/nospec-branch.h> #ifdef CC_USING_FENTRY # define function_hook __fentry__
@@ -197,7 +198,8 @@ ftrace_stub: movl 0x4(%ebp), %edx subl $MCOUNT_INSN_SIZE, %eax - call *ftrace_trace_function + movl ftrace_trace_function, %ecx + CALL_NOSPEC %ecx popl %edx popl %ecx
@@ -241,5 +243,5 @@ return_to_handler: movl %eax, %ecx popl %edx popl %eax - jmp *%ecx + JMP_NOSPEC %ecx #endif
arch/x86/kernel/ftrace_64.S +4 -4
@@ -7,7 +7,7 @@ #include <asm/ptrace.h> #include <asm/ftrace.h> #include <asm/export.h> - +#include <asm/nospec-branch.h> .code64 .section .entry.text, "ax"
@@ -286,8 +286,8 @@ trace: * ip and parent ip are used and the list function is called when * function tracing is enabled. */ - call *ftrace_trace_function - + movq ftrace_trace_function, %r8 + CALL_NOSPEC %r8 restore_mcount_regs jmp fgraph_trace
@@ -329,5 +329,5 @@ GLOBAL(return_to_handler) movq 8(%rsp), %rdx movq (%rsp), %rax addq $24, %rsp - jmp *%rdi + JMP_NOSPEC %rdi #endif
arch/x86/kernel/irq_32.c +5 -4
@@ -20,6 +20,7 @@#include <linux/mm.h> #include <asm/apic.h> +#include <asm/nospec-branch.h> #ifdef CONFIG_DEBUG_STACKOVERFLOW
@@ -55,11 +56,11 @@ DEFINE_PER_CPU(struct irq_stack *, softirq_stack);static void call_on_stack (void *func,void *stack) { asmvolatile ("xchgl %%ebx,%%esp \n" -"call *%%edi \n" +CALL_NOSPEC "movl %%ebx,%%esp \n" :"=b" (stack) :"0" (stack), -"D" (func) + [thunk_target]"D" (func) :"memory" ,"cc" ,"edx" ,"ecx" ,"eax" ); }
@@ -95,11 +96,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)call_on_stack (print_stack_overflow, isp); asmvolatile ("xchgl %%ebx,%%esp \n" -"call *%%edi \n" +CALL_NOSPEC "movl %%ebx,%%esp \n" :"=a" (arg1),"=b" (isp) :"0" (desc),"1" (isp), -"D" (desc->handle_irq) + [thunk_target]"D" (desc->handle_irq) :"memory" ,"cc" ,"ecx" );return 1 ; }
arch/x86/kernel/tboot.c +11 -0
@@ -138,6 +138,17 @@ static int map_tboot_page(unsigned long vaddr, unsigned long pfn,return -1 ;set_pte_at (&tboot_mm, vaddr, pte,pfn_pte (pfn, prot));pte_unmap (pte); + +/* +* PTI poisons low addresses in the kernel page tables in the +* name of making them unusable for userspace. To execute +* code at such a low address, the poison must be cleared. +* +* Note: 'pgd' actually gets set in p4d_alloc() _or_ +* pud_alloc() depending on 4/5-level paging. +*/ + pgd->pgd &= ~_PAGE_NX; +return 0 ; }
arch/x86/kvm/svm.c +23 -0
@@ -45,6 +45,7 @@#include <asm/debugreg.h> #include <asm/kvm_para.h> #include <asm/irq_remapping.h> +#include <asm/nospec-branch.h> #include <asm/virtext.h> #include "trace.h"
@@ -4964,6 +4965,25 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)"mov %%r13, %c[r13](%[svm]) \n\t" "mov %%r14, %c[r14](%[svm]) \n\t" "mov %%r15, %c[r15](%[svm]) \n\t" +#endif +/* +* Clear host registers marked as clobbered to prevent +* speculative use. +*/ +"xor %%" _ASM_BX", %%" _ASM_BX" \n\t" +"xor %%" _ASM_CX", %%" _ASM_CX" \n\t" +"xor %%" _ASM_DX", %%" _ASM_DX" \n\t" +"xor %%" _ASM_SI", %%" _ASM_SI" \n\t" +"xor %%" _ASM_DI", %%" _ASM_DI" \n\t" +#ifdef CONFIG_X86_64 +"xor %%r8, %%r8 \n\t" +"xor %%r9, %%r9 \n\t" +"xor %%r10, %%r10 \n\t" +"xor %%r11, %%r11 \n\t" +"xor %%r12, %%r12 \n\t" +"xor %%r13, %%r13 \n\t" +"xor %%r14, %%r14 \n\t" +"xor %%r15, %%r15 \n\t" #endif "pop %%" _ASM_BP :
@@ -4994,6 +5014,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)#endif ); +/* Eliminate branch target predictions from guest mode */ +vmexit_fill_RSB (); +#ifdef CONFIG_X86_64 wrmsrl (MSR_GS_BASE , svm->host.gs_base);#else
arch/x86/kvm/vmx.c +27 -3
@@ -50,6 +50,7 @@#include <asm/apic.h> #include <asm/irq_remapping.h> #include <asm/mmu_context.h> +#include <asm/nospec-branch.h> #include "trace.h" #include "pmu.h"
@@ -888,8 +889,16 @@ static inline short vmcs_field_to_offset(unsigned long field) {BUILD_BUG_ON (ARRAY_SIZE (vmcs_field_to_offset_table) >SHRT_MAX ); -if (field >=ARRAY_SIZE (vmcs_field_to_offset_table) || - vmcs_field_to_offset_table[field] ==0 ) +if (field >=ARRAY_SIZE (vmcs_field_to_offset_table)) +return -ENOENT ; + +/* +* FIXME: Mitigation for CVE-2017-5753. To be replaced with a +* generic mechanism. +*/ + asm("lfence" ); + +if (vmcs_field_to_offset_table[field] ==0 )return -ENOENT ;return vmcs_field_to_offset_table[field];
@@ -9405,6 +9414,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)/* Save guest registers, load host registers, keep flags */ "mov %0, %c[wordsize](%%" _ASM_SP") \n\t" "pop %0 \n\t" +"setbe %c[fail](%0)\n\t" "mov %%" _ASM_AX", %c[rax](%0) \n\t" "mov %%" _ASM_BX", %c[rbx](%0) \n\t" __ASM_SIZE(pop) " %c[rcx](%0) \n\t"
@@ -9421,12 +9431,23 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)"mov %%r13, %c[r13](%0) \n\t" "mov %%r14, %c[r14](%0) \n\t" "mov %%r15, %c[r15](%0) \n\t" +"xor %%r8d, %%r8d \n\t" +"xor %%r9d, %%r9d \n\t" +"xor %%r10d, %%r10d \n\t" +"xor %%r11d, %%r11d \n\t" +"xor %%r12d, %%r12d \n\t" +"xor %%r13d, %%r13d \n\t" +"xor %%r14d, %%r14d \n\t" + "xor %%r15d, %%r15d \n\t"#endif "mov %%cr2, %%" _ASM_AX" \n\t" "mov %%" _ASM_AX", %c[cr2](%0) \n\t" +"xor %%eax, %%eax \n\t" +"xor %%ebx, %%ebx \n\t" +"xor %%esi, %%esi \n\t" +"xor %%edi, %%edi \n\t" "pop %%" _ASM_BP"; pop %%" _ASM_DX" \n\t" -"setbe %c[fail](%0) \n\t" ".pushsection .rodata \n\t" ".global vmx_return \n\t" "vmx_return: " _ASM_PTR" 2b \n\t"
@@ -9463,6 +9484,9 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)#endif ); +/* Eliminate branch target predictions from guest mode */ +vmexit_fill_RSB (); +/* MSR_IA32_DEBUGCTLMSR is zeroed on vmexit. Restore it if needed */ if (debugctlmsr)update_debugctlmsr (debugctlmsr);
arch/x86/kvm/x86.c +4 -4
@@ -4362,7 +4362,7 @@ static int vcpu_mmio_read(struct kvm_vcpu *vcpu, gpa_t addr, int len, void *v) addr, n, v)) && kvm_io_bus_read(vcpu, KVM_MMIO_BUS, addr, n, v))break ; -trace_kvm_mmio (KVM_TRACE_MMIO_READ , n, addr, *(u64 *)v); +trace_kvm_mmio (KVM_TRACE_MMIO_READ , n, addr, v); handled += n; addr += n; len -= n;
@@ -4621,7 +4621,7 @@ static int read_prepare(struct kvm_vcpu *vcpu, void *val, int bytes) {if (vcpu->mmio_read_completed) {trace_kvm_mmio (KVM_TRACE_MMIO_READ , bytes, - vcpu->mmio_fragments[0 ].gpa, *(u64 *)val); + vcpu->mmio_fragments[0 ].gpa, val); vcpu->mmio_read_completed =0 ;return 1 ; }
@@ -4643,14 +4643,14 @@ static int write_emulate(struct kvm_vcpu *vcpu, gpa_t gpa,static int write_mmio (struct kvm_vcpu *vcpu,gpa_t gpa,int bytes,void *val) { -trace_kvm_mmio (KVM_TRACE_MMIO_WRITE , bytes, gpa, *(u64 *)val); +trace_kvm_mmio (KVM_TRACE_MMIO_WRITE , bytes, gpa, val);return vcpu_mmio_write (vcpu, gpa, bytes, val); }static int read_exit_mmio (struct kvm_vcpu *vcpu,gpa_t gpa,void *val,int bytes) { -trace_kvm_mmio (KVM_TRACE_MMIO_READ_UNSATISFIED , bytes, gpa,0 ); +trace_kvm_mmio (KVM_TRACE_MMIO_READ_UNSATISFIED , bytes, gpa,NULL );return X86EMUL_IO_NEEDED ; }
arch/x86/lib/Makefile +1 -0
@@ -26,6 +26,7 @@ lib-y += memcpy_$(BITS).o lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o +lib-$(CONFIG_RETPOLINE) += retpoline.o obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
arch/x86/lib/checksum_32.S +4 -3
@@ -29,7 +29,8 @@ #include <asm/errno.h> #include <asm/asm.h> #include <asm/export.h> - +#include <asm/nospec-branch.h> + /* * computes a partial checksum, e.g. for TCP/UDP fragments */
@@ -156,7 +157,7 @@ ENTRY(csum_partial) negl %ebx lea 45f(%ebx,%ebx,2), %ebx testl %esi, %esi - jmp *%ebx + JMP_NOSPEC %ebx # Handle 2-byte-aligned regions 20: addw (%esi), %ax
@@ -439,7 +440,7 @@ ENTRY(csum_partial_copy_generic) andl $-32,%edx lea 3f(%ebx,%ebx), %ebx testl %esi, %esi - jmp *%ebx + JMP_NOSPEC %ebx 1: addl $64,%esi addl $64,%edi SRC(movb -32(%edx),%bl) ; SRC(movb (%edx),%bl)
arch/x86/lib/retpoline.S new file +48 -0
48 lines not on this page · raw message
arch/x86/mm/pti.c +6 -26
@@ -149,7 +149,7 @@ pgd_t __pti_set_user_pgd(pgd_t *pgdp, pgd_t pgd)* * Returns a pointer to a P4D on success, or NULL on failure. */ -static p4d_t *pti_user_pagetable_walk_p4d (unsigned long address) +static __init p4d_t *pti_user_pagetable_walk_p4d (unsigned long address) {pgd_t *pgd =kernel_to_user_pgdp (pgd_offset_k (address));gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);
@@ -164,12 +164,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)if (!new_p4d_page)return NULL ; -if (pgd_none (*pgd)) { -set_pgd (pgd,__pgd (_KERNPG_TABLE |__pa (new_p4d_page))); - new_p4d_page =0 ; - } -if (new_p4d_page) -free_page (new_p4d_page); +set_pgd (pgd,__pgd (_KERNPG_TABLE |__pa (new_p4d_page))); }BUILD_BUG_ON (pgd_large (*pgd) !=0 );
@@ -182,7 +177,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)* * Returns a pointer to a PMD on success, or NULL on failure. */ -static pmd_t *pti_user_pagetable_walk_pmd (unsigned long address) +static __init pmd_t *pti_user_pagetable_walk_pmd (unsigned long address) {gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);p4d_t *p4d =pti_user_pagetable_walk_p4d (address);
@@ -194,12 +189,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)if (!new_pud_page)return NULL ; -if (p4d_none (*p4d)) { -set_p4d (p4d,__p4d (_KERNPG_TABLE |__pa (new_pud_page))); - new_pud_page =0 ; - } -if (new_pud_page) -free_page (new_pud_page); +set_p4d (p4d,__p4d (_KERNPG_TABLE |__pa (new_pud_page))); } pud =pud_offset (p4d, address);
@@ -213,12 +203,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)if (!new_pmd_page)return NULL ; -if (pud_none (*pud)) { -set_pud (pud,__pud (_KERNPG_TABLE |__pa (new_pmd_page))); - new_pmd_page =0 ; - } -if (new_pmd_page) -free_page (new_pmd_page); +set_pud (pud,__pud (_KERNPG_TABLE |__pa (new_pmd_page))); }return pmd_offset (pud, address);
@@ -251,12 +236,7 @@ static __init pte_t *pti_user_pagetable_walk_pte(unsigned long address)if (!new_pte_page)return NULL ; -if (pmd_none (*pmd)) { -set_pmd (pmd,__pmd (_KERNPG_TABLE |__pa (new_pte_page))); - new_pte_page =0 ; - } -if (new_pte_page) -free_page (new_pte_page); +set_pmd (pmd,__pmd (_KERNPG_TABLE |__pa (new_pte_page))); } pte =pte_offset_kernel (pmd, address);
arch/x86/platform/efi/efi_64.c +2 -0
@@ -134,7 +134,9 @@ pgd_t * __init efi_call_phys_prolog(void) pud[j] = *pud_offset (p4d_k, vaddr); } } +pgd_offset_k (pgd *PGDIR_SIZE )->pgd &= ~_PAGE_NX; } + out:__flush_tlb_all ();
crypto/algapi.c +12 -0
@@ -167,6 +167,18 @@ void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list, spawn->alg =NULL ; spawns = &inst->alg.cra_users; + +/* +* We may encounter an unregistered instance here, since +* an instance's spawns are set up prior to the instance +* being registered. An unregistered instance will have +* NULL ->cra_users.next, since ->cra_users isn't +* properly initialized until registration. But an +* unregistered instance cannot have any users, so treat +* it the same as ->cra_users being empty. +*/ +if (spawns->next ==NULL ) +break ; } }while ((spawns =crypto_more_spawns (alg, &stack, &top, &secondary_spawns)));
drivers/base/Kconfig +3 -0
@@ -236,6 +236,9 @@ config GENERIC_CPU_DEVICES config GENERIC_CPU_AUTOPROBE bool +config GENERIC_CPU_VULNERABILITIES + bool + config SOC_BUS bool select GLOB
drivers/base/cpu.c +48 -0
58 lines not on this page · raw message
drivers/block/rbd.c +12 -6
@@ -3074,13 +3074,21 @@ static void format_lock_cookie(struct rbd_device *rbd_dev, char *buf)mutex_unlock (&rbd_dev->watch_mutex); } +static void __rbd_lock (struct rbd_device *rbd_dev,const char *cookie) +{ +struct rbd_client_id cid =rbd_get_cid (rbd_dev); + +strcpy (rbd_dev->lock_cookie, cookie); +rbd_set_owner_cid (rbd_dev, &cid); +queue_work (rbd_dev->task_wq, &rbd_dev->acquired_lock_work); +} +/* * lock_rwsem must be held for write */ static int rbd_lock (struct rbd_device *rbd_dev) {struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; -struct rbd_client_id cid =rbd_get_cid (rbd_dev);char cookie[32 ];int ret;
@@ -3095,9 +3103,7 @@ static int rbd_lock(struct rbd_device *rbd_dev)return ret; rbd_dev->lock_state =RBD_LOCK_STATE_LOCKED ; -strcpy (rbd_dev->lock_cookie, cookie); -rbd_set_owner_cid (rbd_dev, &cid); -queue_work (rbd_dev->task_wq, &rbd_dev->acquired_lock_work); +__rbd_lock (rbd_dev, cookie);return 0 ; }
@@ -3883,7 +3889,7 @@ static void rbd_reacquire_lock(struct rbd_device *rbd_dev)queue_delayed_work (rbd_dev->task_wq, &rbd_dev->lock_dwork,0 ); }else { -strcpy (rbd_dev->lock_cookie, cookie); +__rbd_lock (rbd_dev, cookie); } }
@@ -4415,7 +4421,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE ); q->limits.max_sectors =queue_max_hw_sectors (q); -blk_queue_max_segments (q, segment_size /SECTOR_SIZE ); +blk_queue_max_segments (q,USHRT_MAX );blk_queue_max_segment_size (q, segment_size);blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);
drivers/gpu/drm/i915/gvt/gtt.c +4 -1
@@ -1359,12 +1359,15 @@ static int ppgtt_handle_guest_write_page_table_bytes(void *gp,return ret; }else {if (!test_bit (index, spt->post_shadow_bitmap)) { +int type = spt->shadow_page.type; +ppgtt_get_shadow_entry (spt, &se, index); ret =ppgtt_handle_guest_entry_removal (gpt, &se, index);if (ret)return ret; + ops->set_pfn (&se, vgpu->gtt.scratch_pt[type].page_mfn); +ppgtt_set_shadow_entry (spt, &se, index); } -ppgtt_set_post_shadow (spt, index); }
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -1693,6 +1693,7 @@ static int i915_drm_resume(struct drm_device *dev)intel_guc_resume (dev_priv);intel_modeset_init_hw (dev); +intel_init_clock_gating (dev_priv);spin_lock_irq (&dev_priv->irq_lock);if (dev_priv->display.hpd_irq_setup)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -6987,6 +6987,8 @@ enum {#define GEN9_SLICE_COMMON_ECO_CHICKEN0 _MMIO(0x7308)#define DISABLE_PIXEL_MASK_CAMMING (1<<14) +#define GEN9_SLICE_COMMON_ECO_CHICKEN1 _MMIO(0x731c) +#define GEN7_L3SQCREG1 _MMIO(0xB010)#define VLV_B0_WA_L3SQCREG1_VALUE 0x00D30000
drivers/gpu/drm/i915/intel_display.c +12 -2
@@ -3800,6 +3800,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)intel_pps_unlock_regs_wa (dev_priv);intel_modeset_init_hw (dev); +intel_init_clock_gating (dev_priv);spin_lock_irq (&dev_priv->irq_lock);if (dev_priv->display.hpd_irq_setup)
@@ -14406,8 +14407,6 @@ void intel_modeset_init_hw(struct drm_device *dev)intel_update_cdclk (dev_priv); dev_priv->cdclk.logical = dev_priv->cdclk.actual = dev_priv->cdclk.hw; - -intel_init_clock_gating (dev_priv); }/*
@@ -15124,6 +15123,15 @@ intel_modeset_setup_hw_state(struct drm_device *dev,struct intel_encoder *encoder;int i; +if (IS_HASWELL (dev_priv)) { +/* +* WaRsPkgCStateDisplayPMReq:hsw +* System hang if this isn't done before disabling all planes! +*/ +I915_WRITE (CHICKEN_PAR1_1 , +I915_READ (CHICKEN_PAR1_1 ) |FORCE_ARB_IDLE_PLANES ); + } +intel_modeset_readout_hw_state (dev);/* HW state is read out, now we need to sanitize this mess. */
@@ -15220,6 +15228,8 @@ void intel_modeset_gem_init(struct drm_device *dev)intel_init_gt_powersave (dev_priv); +intel_init_clock_gating (dev_priv); +intel_setup_overlay (dev_priv); }
drivers/gpu/drm/i915/intel_engine_cs.c +5 -0
@@ -1125,6 +1125,11 @@ static int glk_init_workarounds(struct intel_engine_cs *engine)if (ret)return ret; +/* WA #0862: Userspace has to set "Barrier Mode" to avoid hangs. */ + ret =wa_ring_whitelist_reg (engine,GEN9_SLICE_COMMON_ECO_CHICKEN1 ); +if (ret) +return ret; +/* WaToEnableHwFixForPushConstHWBug:glk */ WA_SET_BIT_MASKED (COMMON_SLICE_CHICKEN2 ,GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION );
drivers/gpu/drm/i915/intel_pm.c +18 -26
98 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -0
@@ -2731,6 +2731,8 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv, } view_type =vmw_view_cmd_to_type (header->id); +if (view_type == vmw_view_max) +return -EINVAL ; cmd =container_of (header,typeof (*cmd), header); ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, user_surface_converter,
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +0 -6
@@ -697,7 +697,6 @@ vmw_du_plane_duplicate_state(struct drm_plane *plane) vps->pinned =0 ;/* Mapping is managed by prepare_fb/cleanup_fb */ -memset (&vps->guest_map,0 ,sizeof (vps->guest_map));memset (&vps->host_map,0 ,sizeof (vps->host_map)); vps->cpp =0 ;
@@ -760,11 +759,6 @@ vmw_du_plane_destroy_state(struct drm_plane *plane,/* Should have been freed by cleanup_fb */ -if (vps->guest_map.virtual) { -DRM_ERROR ("Guest mapping not freed\n" ); -ttm_bo_kunmap (&vps->guest_map); - } -if (vps->host_map.virtual) {DRM_ERROR ("Host mapping not freed\n" );ttm_bo_kunmap (&vps->host_map);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +1 -1
@@ -175,7 +175,7 @@ struct vmw_plane_state {int pinned;/* For CPU Blit */ -struct ttm_bo_kmap_obj host_map, guest_map; +struct ttm_bo_kmap_obj host_map;unsigned int cpp; };
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +12 -29
94 lines not on this page · raw message
drivers/infiniband/hw/cxgb4/cq.c +2 -5
@@ -410,7 +410,7 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)static int cqe_completes_wr (struct t4_cqe *cqe,struct t4_wq *wq) { -if (CQE_OPCODE (cqe) ==C4IW_DRAIN_OPCODE ) { +if (DRAIN_CQE (cqe)) {WARN_ONCE (1 ,"Unexpected DRAIN CQE qp id %u!\n" , wq->sq.qid);return 0 ; }
@@ -509,7 +509,7 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,/* * Special cqe for drain WR completions... */ -if (CQE_OPCODE (hw_cqe) ==C4IW_DRAIN_OPCODE ) { +if (DRAIN_CQE (hw_cqe)) { *cookie =CQE_DRAIN_COOKIE (hw_cqe); *cqe = *hw_cqe; goto skip_cqe;
@@ -766,9 +766,6 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)c4iw_invalidate_mr (qhp->rhp,CQE_WRID_FR_STAG (&cqe));break ; -case C4IW_DRAIN_OPCODE : - wc->opcode =IB_WC_SEND ; -break ;default :pr_err ("Unexpected opcode %d in the CQE received for QPID=0x%0x\n" ,CQE_OPCODE (&cqe),CQE_QPID (&cqe));
drivers/infiniband/hw/cxgb4/ev.c +5 -3
@@ -109,9 +109,11 @@ static void post_qp_event(struct c4iw_dev *dev, struct c4iw_cq *chp,if (qhp->ibqp.event_handler) (*qhp->ibqp.event_handler)(&event, qhp->ibqp.qp_context); -spin_lock_irqsave (&chp->comp_handler_lock, flag); - (*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context); -spin_unlock_irqrestore (&chp->comp_handler_lock, flag); +if (t4_clear_cq_armed (&chp->cq)) { +spin_lock_irqsave (&chp->comp_handler_lock, flag); + (*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context); +spin_unlock_irqrestore (&chp->comp_handler_lock, flag); + } }void c4iw_ev_dispatch (struct c4iw_dev *dev,struct t4_cqe *err_cqe)
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +0 -2
@@ -631,8 +631,6 @@ static inline int to_ib_qp_state(int c4iw_qp_state)return IB_QPS_ERR ; } -#define C4IW_DRAIN_OPCODE FW_RI_SGE_EC_CR_RETURN -static inline u32 c4iw_ib_to_tpt_access (int a) { return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) |
drivers/infiniband/hw/cxgb4/qp.c +94 -25
214 lines not on this page · raw message
drivers/infiniband/hw/cxgb4/t4.h +6 -0
@@ -197,6 +197,11 @@ struct t4_cqe {#define CQE_SWCQE_G (x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M)#define CQE_SWCQE_V (x) ((x)<<CQE_SWCQE_S) +#define CQE_DRAIN_S 10 +#define CQE_DRAIN_M 0x1 +#define CQE_DRAIN_G (x) ((((x) >> CQE_DRAIN_S)) & CQE_DRAIN_M) +#define CQE_DRAIN_V (x) ((x)<<CQE_DRAIN_S) +#define CQE_STATUS_S 5#define CQE_STATUS_M 0x1F#define CQE_STATUS_G (x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M)
@@ -213,6 +218,7 @@ struct t4_cqe {#define CQE_OPCODE_V (x) ((x)<<CQE_OPCODE_S)#define SW_CQE (x) (CQE_SWCQE_G(be32_to_cpu((x)->header))) +#define DRAIN_CQE (x) (CQE_DRAIN_G(be32_to_cpu((x)->header)))#define CQE_QPID (x) (CQE_QPID_G(be32_to_cpu((x)->header)))#define CQE_TYPE (x) (CQE_TYPE_G(be32_to_cpu((x)->header)))#define SQ_TYPE (x) (CQE_TYPE((x)))
drivers/infiniband/ulp/srpt/ib_srpt.c +2 -3
@@ -1000,8 +1000,7 @@ static int srpt_init_ch_qp(struct srpt_rdma_ch *ch, struct ib_qp *qp)return -ENOMEM ; attr->qp_state =IB_QPS_INIT ; - attr->qp_access_flags =IB_ACCESS_LOCAL_WRITE |IB_ACCESS_REMOTE_READ | -IB_ACCESS_REMOTE_WRITE ; + attr->qp_access_flags =IB_ACCESS_LOCAL_WRITE ; attr->port_num = ch->sport->port; attr->pkey_index =0 ;
@@ -1992,7 +1991,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, goto destroy_ib; } - guid = (__be16 *)¶m->primary_path->sgid.global.interface_id; + guid = (__be16 *)¶m->primary_path->dgid.global.interface_id;snprintf (ch->ini_guid,sizeof (ch->ini_guid),"%04x:%04x:%04x:%04x" ,be16_to_cpu (guid[0 ]),be16_to_cpu (guid[1 ]),be16_to_cpu (guid[2 ]),be16_to_cpu (guid[3 ]));
drivers/md/dm-bufio.c +6 -2
@@ -1611,7 +1611,8 @@ static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan,int l;struct dm_buffer *b, *tmp;unsigned long freed =0 ; -unsigned long count = nr_to_scan; +unsigned long count = c->n_buffers[LIST_CLEAN ] + + c->n_buffers[LIST_DIRTY ];unsigned long retain_target =get_retain_buffers (c);for (l =0 ; l <LIST_SIZE ; l++) {
@@ -1647,8 +1648,11 @@ static unsigned long dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { struct dm_bufio_client *c = container_of(shrink, struct dm_bufio_client, shrinker); +unsigned long count =ACCESS_ONCE (c->n_buffers[LIST_CLEAN ]) + +ACCESS_ONCE (c->n_buffers[LIST_DIRTY ]); +unsigned long retain_target =get_retain_buffers (c); -return ACCESS_ONCE (c->n_buffers[LIST_CLEAN ]) +ACCESS_ONCE (c->n_buffers[LIST_DIRTY ]); +return (count < retain_target) ?0 : (count - retain_target); }/*
drivers/mmc/host/renesas_sdhi_core.c +3 -0
@@ -24,6 +24,7 @@#include <linux/kernel.h> #include <linux/clk.h> #include <linux/slab.h> +#include <linux/module.h> #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/mmc/host.h>
@@ -667,3 +668,5 @@ int renesas_sdhi_remove(struct platform_device *pdev)return 0 ; }EXPORT_SYMBOL_GPL (renesas_sdhi_remove); + +MODULE_LICENSE ("GPL v2" );
drivers/mux/core.c +3 -1
@@ -413,6 +413,7 @@ static int of_dev_node_match(struct device *dev, const void *data)return dev->of_node == data; } +/* Note this function returns a reference to the mux_chip dev. */ static struct mux_chip *of_find_mux_chip_by_node (struct device_node *np) {struct device *dev;
@@ -466,6 +467,7 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name) (!args.args_count && (mux_chip->controllers > 1))) {dev_err (dev,"%pOF: wrong #mux-control-cells for %pOF\n" , np, args.np); +put_device (&mux_chip->dev);return ERR_PTR (-EINVAL ); }
@@ -476,10 +478,10 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)if (controller >= mux_chip->controllers) {dev_err (dev,"%pOF: bad mux controller %u specified in %pOF\n" , np, controller, args.np); +put_device (&mux_chip->dev);return ERR_PTR (-EINVAL ); } -get_device (&mux_chip->dev);return &mux_chip->mux[controller]; }EXPORT_SYMBOL_GPL (mux_control_get);
drivers/net/can/usb/gs_usb.c +1 -1
@@ -449,7 +449,7 @@ static int gs_usb_set_bittiming(struct net_device *netdev)dev_err (netdev->dev.parent,"Couldn't set bittimings (err=%d)" , rc); -return rc; +return (rc >0 ) ?0 : rc; }static void gs_usb_xmit_callback (struct urb *urb)
drivers/net/can/vxcan.c +1 -1
@@ -194,7 +194,7 @@ static int vxcan_newlink(struct net *net, struct net_device *dev, tbp = peer_tb; } -if (tbp[IFLA_IFNAME ]) { +if (ifmp && tbp[IFLA_IFNAME ]) {nla_strlcpy (ifname, tbp[IFLA_IFNAME ],IFNAMSIZ ); name_assign_type =NET_NAME_USER ; }else {
drivers/net/ethernet/freescale/fec_main.c +6 -1
@@ -3458,6 +3458,10 @@ fec_probe(struct platform_device *pdev) goto failed_regulator; } }else { +if (PTR_ERR (fep->reg_phy) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto failed_regulator; + } fep->reg_phy =NULL ; }
@@ -3539,8 +3543,9 @@ fec_probe(struct platform_device *pdev) failed_clk:if (of_phy_is_fixed_link (np))of_phy_deregister_fixed_link (np); -failed_phy:of_node_put (phy_node); +failed_phy: + dev_id--; failed_ioremap:free_netdev (ndev);
drivers/net/ethernet/intel/e1000e/ich8lan.c +8 -3
@@ -1367,6 +1367,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)* Checks to see of the link status of the hardware has changed. If a * change in link status has been detected, then we read the PHY registers * to get the current speed/duplex if link exists. +* +* Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link +* up). **/ static s32 e1000_check_for_copper_link_ich8lan (struct e1000_hw *hw) {
@@ -1382,7 +1385,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)* Change or Rx Sequence Error interrupt. */ if (!mac->get_link_status) -return 0 ; +return 1 ;/* First we want to see if the MII Status Register reports * link. If so, then we want to get the current speed/duplex
@@ -1613,10 +1616,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)* different link partner. */ ret_val =e1000e_config_fc_after_link_up (hw); -if (ret_val) +if (ret_val) {e_dbg ("Error configuring flow control\n" ); +return ret_val; + } -return ret_val; +return 1 ; }static s32 e1000_get_variants_ich8lan (struct e1000_adapter *adapter)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +9 -2
@@ -4235,7 +4235,10 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,return -EINVAL ;if (!info->linking)break ; -if (netdev_has_any_upper_dev (upper_dev)) +if (netdev_has_any_upper_dev (upper_dev) && + (!netif_is_bridge_master (upper_dev) || + !mlxsw_sp_bridge_device_is_offloaded (mlxsw_sp, + upper_dev)))return -EINVAL ;if (netif_is_lag_master (upper_dev) && !mlxsw_sp_master_lag_check(mlxsw_sp, upper_dev,
@@ -4347,6 +4350,7 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev, u16 vid) {struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (dev); +struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;struct netdev_notifier_changeupper_info *info = ptr;struct net_device *upper_dev;int err =0 ;
@@ -4358,7 +4362,10 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev,return -EINVAL ;if (!info->linking)break ; -if (netdev_has_any_upper_dev (upper_dev)) +if (netdev_has_any_upper_dev (upper_dev) && + (!netif_is_bridge_master (upper_dev) || + !mlxsw_sp_bridge_device_is_offloaded (mlxsw_sp, + upper_dev)))return -EINVAL ;break ;case NETDEV_CHANGEUPPER :
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +2 -0
@@ -326,6 +326,8 @@ int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port,void mlxsw_sp_port_bridge_leave (struct mlxsw_sp_port *mlxsw_sp_port,struct net_device *brport_dev,struct net_device *br_dev); +bool mlxsw_sp_bridge_device_is_offloaded (const struct mlxsw_sp *mlxsw_sp, +const struct net_device *br_dev);/* spectrum.c */ int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port,
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -1
@@ -2536,7 +2536,7 @@ static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh, {if (!removing) nh->should_offload =1 ; -else if (nh->offloaded) +else nh->should_offload =0 ; nh->update =1 ; }
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +6 -0
@@ -134,6 +134,12 @@ mlxsw_sp_bridge_device_find(const struct mlxsw_sp_bridge *bridge,return NULL ; } +bool mlxsw_sp_bridge_device_is_offloaded (const struct mlxsw_sp *mlxsw_sp, +const struct net_device *br_dev) +{ +return !!mlxsw_sp_bridge_device_find (mlxsw_sp->bridge, br_dev); +} +static struct mlxsw_sp_bridge_device * mlxsw_sp_bridge_device_create(struct mlxsw_sp_bridge *bridge,
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -0
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/pcie/internal.h +7 -3
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +3 -8
Lines of this file are not shown. View the raw message.
drivers/net/wireless/intel/iwlwifi/pcie/tx.c +4 -4
Lines of this file are not shown. View the raw message.
kernel/bpf/arraymap.c +49 -12
61 lines not on this page · raw message
kernel/bpf/verifier.c +41 -0
41 lines not on this page · raw message
security/apparmor/ipc.c +32 -21
53 lines not on this page · raw message
sound/core/oss/pcm_oss.c +27 -14
41 lines not on this page · raw message
sound/drivers/aloop.c +50 -48
98 lines not on this page · raw message
tools/objtool/check.c +63 -6
69 lines not on this page · raw message
tools/testing/selftests/bpf/test_verifier.c +40 -0
Lines of this file are not shown. View the raw message.
tools/testing/selftests/x86/test_vsyscall.c new file +500 -0
500 lines not on this page · 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.