Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f80dad3c authored by Ivaylo Georgiev's avatar Ivaylo Georgiev
Browse files

Merge android-4.19-q.65 (03d5ba40) into msm-4.19



* refs/heads/tmp-03d5ba40:
  Linux 4.19.65
  Documentation: Add swapgs description to the Spectre v1 documentation
  x86/speculation/swapgs: Exclude ATOMs from speculation through SWAPGS
  x86/entry/64: Use JMP instead of JMPQ
  x86/speculation: Enable Spectre v1 swapgs mitigations
  x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations
  x86/cpufeatures: Combine word 11 and 12 into a new scattered features word
  x86/cpufeatures: Carve out CQM features retrieval
  scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA
  x86/vdso: Prevent segfaults due to hoisted vclock reads
  gcc-9: properly declare the {pv,hv}clock_page storage
  objtool: Support GCC 9 cold subfunction naming scheme
  ARC: enable uboot support unconditionally
  eeprom: at24: make spd world-readable again
  drm/i915/gvt: fix incorrect cache entry for guest page mapping
  IB/hfi1: Check for error on call to alloc_rsm_map_table
  IB/mlx5: Fix RSS Toeplitz setup to be aligned with the HW specification
  IB/mlx5: Fix clean_mr() to work in the expected order
  IB/mlx5: Move MRs to a kernel PD when freeing them to the MR cache
  IB/mlx5: Use direct mkey destroy command upon UMR unreg failure
  IB/mlx5: Fix unreg_umr to ignore the mkey state
  xen/swiotlb: fix condition for calling xen_destroy_contiguous_region()
  nbd: replace kill_bdev() with __invalidate_device() again
  arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}
  arm64: compat: Allow single-byte watchpoints on all addresses
  drivers/perf: arm_pmu: Fix failure path in PM notifier
  parisc: Fix build of compressed kernel even with debug enabled
  cgroup: kselftest: relax fs_spec checks
  s390/dasd: fix endless loop after read unit address configuration
  mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
  ALSA: hda: Fix 1-minute detection delay when i915 module is not available
  selinux: fix memory leak in policydb_init()
  mtd: rawnand: micron: handle on-die "ECC-off" devices correctly
  IB/hfi1: Fix Spectre v1 vulnerability
  gpiolib: fix incorrect IRQ requesting of an active-low lineevent
  mmc: meson-mx-sdio: Fix misuse of GENMASK macro
  mmc: dw_mmc: Fix occasional hang after tuning on eMMC
  Btrfs: fix race leading to fs corruption after transaction abort
  Btrfs: fix incremental send failure after deduplication
  kbuild: initialize CLANG_FLAGS correctly in the top Makefile
  kconfig: Clear "written" flag to avoid data loss
  drm/nouveau: fix memory leak in nouveau_conn_reset()
  x86, boot: Remove multiple copy of static function sanitize_boot_params()
  x86/paravirt: Fix callee-saved function ELF sizes
  x86/kvm: Don't call kvm_spurious_fault() from .fixup
  xen/pv: Fix a boot up hang revealed by int3 self test
  mlxsw: spectrum_dcb: Configure DSCP map as the last rule is removed
  ipc/mqueue.c: only perform resource calculation if user valid
  drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings
  uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers
  coda: fix build using bare-metal toolchain
  coda: add error handling for fget
  lib/test_string.c: avoid masking memset16/32/64 failures
  lib/test_overflow.c: avoid tainting the kernel and fix wrap size
  mm/cma.c: fail if fixed declaration can't be honored
  x86: math-emu: Hide clang warnings for 16-bit overflow
  x86/apic: Silence -Wtype-limits compiler warnings
  be2net: Signal that the device cannot transmit during reconfiguration
  ACPI: fix false-positive -Wuninitialized warning
  x86: kvm: avoid constant-conversion warning
  perf version: Fix segfault due to missing OPT_END()
  scsi: zfcp: fix GCC compiler warning emitted with -Wmaybe-uninitialized
  ACPI: blacklist: fix clang warning for unused DMI table
  ceph: return -ERANGE if virtual xattr value didn't fit in buffer
  ceph: fix improper use of smp_mb__before_atomic()
  cifs: Fix a race condition with cifs_echo_request
  btrfs: qgroup: Don't hold qgroup_ioctl_lock in btrfs_qgroup_inherit()
  btrfs: fix minimum number of chunk errors for DUP
  clk: sprd: Add check for return value of sprd_clk_regmap_init()
  fs/adfs: super: fix use-after-free bug
  clk: tegra210: fix PLLU and PLLU_OUT1
  dmaengine: rcar-dmac: Reject zero-length slave DMA requests
  MIPS: lantiq: Fix bitfield masking
  firmware/psci: psci_checker: Park kthreads before stopping them
  kernel/module.c: Only return -EEXIST for modules that have finished loading
  arm64: dts: rockchip: fix isp iommu clocks and power domain
  dmaengine: tegra-apb: Error out if DMA_PREP_INTERRUPT flag is unset
  ftrace: Enable trampoline when rec count returns back to one
  ARM: dts: rockchip: Mark that the rk3288 timer might stop in suspend
  ARM: dts: rockchip: Make rk3288-veyron-mickey's emmc work again
  ARM: dts: rockchip: Make rk3288-veyron-minnie run at hs200
  ARM: riscpc: fix DMA
  UPSTREAM: net-ipv6-ndisc: add support for RFC7710 RA Captive Portal Identifier

Change-Id: I8be34f8ee12a7ddc6b14a0d121f53c4b4315c377
Signed-off-by: default avatarIvaylo Georgiev <irgeorgiev@codeaurora.org>
parents 420c83c0 03d5ba40
Loading
Loading
Loading
Loading
+80 −8
Original line number Diff line number Diff line
@@ -41,10 +41,11 @@ Related CVEs

The following CVE entries describe Spectre variants:

   =============   =======================  =================
   =============   =======================  ==========================
   CVE-2017-5753   Bounds check bypass      Spectre variant 1
   CVE-2017-5715   Branch target injection  Spectre variant 2
   =============   =======================  =================
   CVE-2019-1125   Spectre v1 swapgs        Spectre variant 1 (swapgs)
   =============   =======================  ==========================

Problem
-------
@@ -78,6 +79,13 @@ There are some extensions of Spectre variant 1 attacks for reading data
over the network, see :ref:`[12] <spec_ref12>`. However such attacks
are difficult, low bandwidth, fragile, and are considered low risk.

Note that, despite "Bounds Check Bypass" name, Spectre variant 1 is not
only about user-controlled array bounds checks.  It can affect any
conditional checks.  The kernel entry code interrupt, exception, and NMI
handlers all have conditional swapgs checks.  Those may be problematic
in the context of Spectre v1, as kernel code can speculatively run with
a user GS.

Spectre variant 2 (Branch Target Injection)
-------------------------------------------

@@ -132,6 +140,9 @@ not cover all possible attack vectors.
1. A user process attacking the kernel
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Spectre variant 1
~~~~~~~~~~~~~~~~~

   The attacker passes a parameter to the kernel via a register or
   via a known address in memory during a syscall. Such parameter may
   be used later by the kernel as an index to an array or to derive
@@ -144,7 +155,40 @@ not cover all possible attack vectors.
   potentially be influenced for Spectre attacks, new "nospec" accessor
   macros are used to prevent speculative loading of data.

   Spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch
Spectre variant 1 (swapgs)
~~~~~~~~~~~~~~~~~~~~~~~~~~

   An attacker can train the branch predictor to speculatively skip the
   swapgs path for an interrupt or exception.  If they initialize
   the GS register to a user-space value, if the swapgs is speculatively
   skipped, subsequent GS-related percpu accesses in the speculation
   window will be done with the attacker-controlled GS value.  This
   could cause privileged memory to be accessed and leaked.

   For example:

   ::

     if (coming from user space)
         swapgs
     mov %gs:<percpu_offset>, %reg
     mov (%reg), %reg1

   When coming from user space, the CPU can speculatively skip the
   swapgs, and then do a speculative percpu load using the user GS
   value.  So the user can speculatively force a read of any kernel
   value.  If a gadget exists which uses the percpu value as an address
   in another load/store, then the contents of the kernel value may
   become visible via an L1 side channel attack.

   A similar attack exists when coming from kernel space.  The CPU can
   speculatively do the swapgs, causing the user GS to get used for the
   rest of the speculative window.

Spectre variant 2
~~~~~~~~~~~~~~~~~

   A spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch
   target buffer (BTB) before issuing syscall to launch an attack.
   After entering the kernel, the kernel could use the poisoned branch
   target buffer on indirect jump and jump to gadget code in speculative
@@ -280,11 +324,18 @@ The sysfs file showing Spectre variant 1 mitigation status is:

The possible values in this file are:

  =======================================  =================================
  'Mitigation: __user pointer sanitation'  Protection in kernel on a case by
                                           case base with explicit pointer
                                           sanitation.
  =======================================  =================================
  .. list-table::

     * - 'Not affected'
       - The processor is not vulnerable.
     * - 'Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers'
       - The swapgs protections are disabled; otherwise it has
         protection in the kernel on a case by case base with explicit
         pointer sanitation and usercopy LFENCE barriers.
     * - 'Mitigation: usercopy/swapgs barriers and __user pointer sanitization'
       - Protection in the kernel on a case by case base with explicit
         pointer sanitation, usercopy LFENCE barriers, and swapgs LFENCE
         barriers.

However, the protections are put in place on a case by case basis,
and there is no guarantee that all possible attack vectors for Spectre
@@ -366,12 +417,27 @@ Turning on mitigation for Spectre variant 1 and Spectre variant 2
1. Kernel mitigation
^^^^^^^^^^^^^^^^^^^^

Spectre variant 1
~~~~~~~~~~~~~~~~~

   For the Spectre variant 1, vulnerable kernel code (as determined
   by code audit or scanning tools) is annotated on a case by case
   basis to use nospec accessor macros for bounds clipping :ref:`[2]
   <spec_ref2>` to avoid any usable disclosure gadgets. However, it may
   not cover all attack vectors for Spectre variant 1.

   Copy-from-user code has an LFENCE barrier to prevent the access_ok()
   check from being mis-speculated.  The barrier is done by the
   barrier_nospec() macro.

   For the swapgs variant of Spectre variant 1, LFENCE barriers are
   added to interrupt, exception and NMI entry where needed.  These
   barriers are done by the FENCE_SWAPGS_KERNEL_ENTRY and
   FENCE_SWAPGS_USER_ENTRY macros.

Spectre variant 2
~~~~~~~~~~~~~~~~~

   For Spectre variant 2 mitigation, the compiler turns indirect calls or
   jumps in the kernel into equivalent return trampolines (retpolines)
   :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` to go to the target
@@ -473,6 +539,12 @@ Mitigation control on the kernel command line
Spectre variant 2 mitigation can be disabled or force enabled at the
kernel command line.

	nospectre_v1

		[X86,PPC] Disable mitigations for Spectre Variant 1
		(bounds check bypass). With this option data leaks are
		possible in the system.

	nospectre_v2

		[X86] Disable all mitigations for the Spectre variant 2
+4 −3
Original line number Diff line number Diff line
@@ -2522,6 +2522,7 @@
				Equivalent to: nopti [X86,PPC]
					       nospectre_v1 [PPC]
					       nobp=0 [S390]
					       nospectre_v1 [X86]
					       nospectre_v2 [X86,PPC,S390]
					       spectre_v2_user=off [X86]
					       spec_store_bypass_disable=off [X86,PPC]
@@ -2868,9 +2869,9 @@
			nosmt=force: Force disable SMT, cannot be undone
				     via the sysfs control file.

	nospectre_v1	[PPC] Disable mitigations for Spectre Variant 1 (bounds
			check bypass). With this option data leaks are possible
			in the system.
	nospectre_v1	[X66, PPC] Disable mitigations for Spectre Variant 1
			(bounds check bypass). With this option data leaks
			are possible in the system.

	nospectre_v2	[X86,PPC_FSL_BOOK3E] Disable all mitigations for the Spectre variant 2
			(indirect branch prediction) vulnerability. System may
+3 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 19
SUBLEVEL = 64
SUBLEVEL = 65
EXTRAVERSION =
NAME = "People's Front"

@@ -434,6 +434,7 @@ KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
KBUILD_LDFLAGS :=
GCC_PLUGINS_CFLAGS :=
CLANG_FLAGS :=

export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
@@ -487,7 +488,7 @@ endif
ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),)
CLANG_TRIPLE	?= $(CROSS_COMPILE)
CLANG_FLAGS	:= --target=$(notdir $(CLANG_TRIPLE:%-=%))
CLANG_FLAGS	+= --target=$(notdir $(CLANG_TRIPLE:%-=%))
ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y)
$(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?")
endif
+0 −13
Original line number Diff line number Diff line
@@ -199,7 +199,6 @@ config NR_CPUS

config ARC_SMP_HALT_ON_RESET
	bool "Enable Halt-on-reset boot mode"
	default y if ARC_UBOOT_SUPPORT
	help
	  In SMP configuration cores can be configured as Halt-on-reset
	  or they could all start at same time. For Halt-on-reset, non
@@ -539,18 +538,6 @@ config ARC_DBG_TLB_PARANOIA

endif

config ARC_UBOOT_SUPPORT
	bool "Support uboot arg Handling"
	default n
	help
	  ARC Linux by default checks for uboot provided args as pointers to
	  external cmdline or DTB. This however breaks in absence of uboot,
	  when booting from Metaware debugger directly, as the registers are
	  not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus
	  registers look like uboot args to kernel which then chokes.
	  So only enable the uboot arg checking/processing if users are sure
	  of uboot being in play.

config ARC_BUILTIN_DTB_NAME
	string "Built in DTB"
	help
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ CONFIG_ARC_CACHE_LINE_SHIFT=5
# CONFIG_ARC_HAS_LLSC is not set
CONFIG_ARC_KVADDR_SIZE=402
CONFIG_ARC_EMUL_UNALIGNED=y
CONFIG_ARC_UBOOT_SUPPORT=y
CONFIG_PREEMPT=y
CONFIG_NET=y
CONFIG_UNIX=y
Loading