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

Commit 0f3194a0 authored by Ivaylo Georgiev's avatar Ivaylo Georgiev
Browse files

Merge android-4.19.45 (50f91435) into msm-4.19



* refs/heads/tmp-50f91435:
  Linux 4.19.45
  ext4: don't update s_rev_level if not required
  ext4: fix compile error when using BUFFER_TRACE
  pstore: Refactor compression initialization
  pstore: Allocate compression during late_initcall()
  pstore: Centralize init/exit routines
  iov_iter: optimize page_copy_sane()
  libnvdimm/namespace: Fix label tracking error
  xen/pvh: set xen_domain_type to HVM in xen_pvh_init
  kbuild: turn auto.conf.cmd into a mandatory include file
  KVM: lapic: Busy wait for timer to expire when using hv_timer
  KVM: x86: Skip EFER vs. guest CPUID checks for host-initiated writes
  jbd2: fix potential double free
  ALSA: hda/realtek - Fix for Lenovo B50-70 inverted internal microphone bug
  ALSA: hda/realtek - Fixup headphone noise via runtime suspend
  ALSA: hda/realtek - Corrected fixup for System76 Gazelle (gaze14)
  ext4: avoid panic during forced reboot due to aborted journal
  ext4: fix use-after-free in dx_release()
  ext4: fix data corruption caused by overlapping unaligned and aligned IO
  ext4: zero out the unused memory region in the extent tree block
  tty: Don't force RISCV SBI console as preferred console
  fs/writeback.c: use rcu_barrier() to wait for inflight wb switches going into workqueue when umount
  crypto: ccm - fix incompatibility between "ccm" and "ccm_base"
  ipmi:ssif: compare block number correctly for multi-part return messages
  bcache: never set KEY_PTRS of journal key to 0 in journal_reclaim()
  bcache: fix a race between cache register and cacheset unregister
  Btrfs: do not start a transaction at iterate_extent_inodes()
  Btrfs: do not start a transaction during fiemap
  Btrfs: send, flush dellaloc in order to avoid data loss
  btrfs: Honour FITRIM range constraints during free space trim
  btrfs: Correctly free extent buffer in case btree_read_extent_buffer_pages fails
  btrfs: Check the first key and level for cached extent buffer
  ext4: fix ext4_show_options for file systems w/o journal
  ext4: actually request zeroing of inode table after grow
  ext4: fix use-after-free race with debug_want_extra_isize
  ext4: avoid drop reference to iloc.bh twice
  ext4: ignore e_value_offs for xattrs with value-in-ea-inode
  ext4: make sanity check in mballoc more strict
  jbd2: check superblock mapped prior to committing
  tty/vt: fix write/write race in ioctl(KDSKBSENT) handler
  tty: vt.c: Fix TIOCL_BLANKSCREEN console blanking if blankinterval == 0
  mtd: spi-nor: intel-spi: Avoid crossing 4K address boundary on read/write
  mfd: max77620: Fix swapped FPS_PERIOD_MAX_US values
  mfd: da9063: Fix OTP control register names to match datasheets for DA9063/63L
  ACPI: PM: Set enable_for_wake for wakeup GPEs during suspend-to-idle
  userfaultfd: use RCU to free the task struct when fork fails
  ocfs2: fix ocfs2 read inode data panic in ocfs2_iget
  hugetlb: use same fault hash key for shared and private mappings
  mm/hugetlb.c: don't put_page in lock of hugetlb_lock
  mm/huge_memory: fix vmf_insert_pfn_{pmd, pud}() crash, handle unaligned addresses
  mm/mincore.c: make mincore() more conservative
  crypto: ccree - handle tee fips error during power management resume
  crypto: ccree - add function to handle cryptocell tee fips error
  crypto: ccree - HOST_POWER_DOWN_EN should be the last CC access during suspend
  crypto: ccree - pm resume first enable the source clk
  crypto: ccree - don't map AEAD key and IV on stack
  crypto: ccree - use correct internal state sizes for export
  crypto: ccree - don't map MAC key on stack
  crypto: ccree - fix mem leak on error path
  crypto: ccree - remove special handling of chained sg
  bpf, arm64: remove prefetch insn in xadd mapping
  ASoC: codec: hdac_hdmi add device_link to card device
  ASoC: fsl_esai: Fix missing break in switch statement
  ASoC: RT5677-SPI: Disable 16Bit SPI Transfers
  ASoC: max98090: Fix restore of DAPM Muxes
  ALSA: hdea/realtek - Headset fixup for System76 Gazelle (gaze14)
  ALSA: hda/realtek - EAPD turn on later
  ALSA: hda/hdmi - Consider eld_valid when reporting jack event
  ALSA: hda/hdmi - Read the pin sense from register when repolling
  ALSA: usb-audio: Fix a memory leak bug
  ALSA: line6: toneport: Fix broken usage of timer for delayed execution
  mmc: core: Fix tag set memory leak
  crypto: arm64/aes-neonbs - don't access already-freed walk.iv
  crypto: arm/aes-neonbs - don't access already-freed walk.iv
  crypto: rockchip - update IV buffer to contain the next IV
  crypto: gcm - fix incompatibility between "gcm" and "gcm_base"
  crypto: arm64/gcm-aes-ce - fix no-NEON fallback code
  crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest()
  crypto: crct10dif-generic - fix use via crypto_shash_digest()
  crypto: skcipher - don't WARN on unprocessed data after slow walk step
  crypto: vmx - fix copy-paste error in CTR mode
  crypto: ccp - Do not free psp_master when PLATFORM_INIT fails
  crypto: chacha20poly1305 - set cra_name correctly
  crypto: salsa20 - don't access already-freed walk.iv
  crypto: crypto4xx - fix cfb and ofb "overran dst buffer" issues
  crypto: crypto4xx - fix ctr-aes missing output IV
  sched/x86: Save [ER]FLAGS on context switch
  arm64: Save and restore OSDLR_EL1 across suspend/resume
  arm64: Clear OSDLR_EL1 on CPU boot
  arm64: compat: Reduce address limit
  arm64: arch_timer: Ensure counter register reads occur with seqlock held
  arm64: mmap: Ensure file offset is treated as unsigned
  power: supply: axp288_fuel_gauge: Add ACEPC T8 and T11 mini PCs to the blacklist
  power: supply: axp288_charger: Fix unchecked return value
  ARM: exynos: Fix a leaked reference by adding missing of_node_put
  mmc: sdhci-of-arasan: Add DTS property to disable DCMDs.
  ARM: dts: exynos: Fix audio (microphone) routing on Odroid XU3
  ARM: dts: exynos: Fix interrupt for shared EINTs on Exynos5260
  arm64: dts: rockchip: Disable DCMDs on RK3399's eMMC controller.
  objtool: Fix function fallthrough detection
  x86/speculation/mds: Improve CPU buffer clear documentation
  x86/speculation/mds: Revert CPU buffer clear on double fault exit
  locking/rwsem: Prevent decrement of reader count before increment
  fs: sdcardfs: Add missing option to show_options
  BACKPORT: drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines
  ANDROID: x86: use the correct function type for sys_ni_syscall
  ANDROID: x86: use the correct function type for sys32_(rt_)sigreturn
  ANDROID: x86: use the correct function type for native_set_fixmap
  ANDROID: x86: use the correct function type in SYSCALL_DEFINE0
  ANDROID: x86: add support for CONFIG_LTO_CLANG
  ANDROID: x86: disable STACK_VALIDATION with LTO_CLANG
  ANDROID: x86: disable HAVE_ARCH_PREL32_RELOCATIONS with LTO_CLANG
  ANDROID: x86/vdso: disable LTO only for VDSO
  ANDROID: x86/cpu/vmware: use the full form of inl in VMWARE_PORT
  UPSTREAM: x86/build: Keep local relocations with ld.lld
  ANDROID: crypto: arm64/ghash: fix CFI for GHASH CE
  ANDROID: crypto: arm64/sha: fix CFI in SHA CE
  ANDROID: arm64: kvm: disable CFI
  ANDROID: arm64: mark kpti_install_ng_mappings as __nocfi
  ANDROID: arm64: disable CFI for cpu_replace_ttbr1
  FROMLIST: arm64: use the correct function type for __arm64_sys_ni_syscall
  FROMLIST: arm64: use the correct function type in SYSCALL_DEFINE0
  FROMLIST: arm64: fix syscall_fn_t type
  ANDROID: modpost: add an exception for CFI stubs
  ANDROID: ftrace: fix function type mismatches
  FROMLIST: 9p: pass the correct prototype to read_cache_page
  FROMLIST: jffs2: pass the correct prototype to read_cache_page
  UPSTREAM: nfs: pass the correct prototype to read_cache_page
  FROMLIST: mm: don't cast ->readpage to filler_t for do_read_cache_page
  UPSTREAM: netfilter: xt_IDLETIMER: fix sysfs callback function type
  ANDROID: kallsyms: strip the .cfi postfix from symbols with CONFIG_CFI_CLANG
  ANDROID: add support for clang Control Flow Integrity (CFI)
  FROMLIST: arm64: select ARCH_SUPPORTS_LTO_CLANG
  ANDROID: arm64: disable HAVE_ARCH_PREL32_RELOCATIONS with LTO_CLANG
  ANDROID: arm64: add atomic_ll_sc.o to obj-y if using lld
  ANDROID: arm64: lse: fix LSE atomics with LTO
  ANDROID: arm64: vdso: disable LTO
  FROMLIST: arm64: kvm: use -fno-jump-tables with clang
  BACKPORT: arm64: sysreg: Make mrs_s and msr_s macros work with Clang and LTO
  ANDROID: init: ensure initcall ordering with LTO
  ANDROID: drivers/misc: disable LTO for lkdtm_rodata.o
  FROMLIST: efi/libstub: disable LTO
  FROMLIST: scripts/mod: disable LTO for empty.c
  ANDROID: kbuild: disable LTO_CLANG with KASAN
  FROMLIST: kbuild: fix dynamic ftrace with clang LTO
  ANDROID: kbuild: add support for clang LTO
  ANDROID: kbuild: add CONFIG_LD_IS_LLD
  UPSTREAM: gcov: clang support
  UPSTREAM: gcov: docs: add a note on GCC vs Clang differences
  UPSTREAM: gcov: clang: move common GCC code into gcc_base.c
  UPSTREAM: module: add stubs for within_module functions
  UPSTREAM: bpf: relax inode permission check for retrieving bpf program

Conflicts:
	Makefile
	arch/Kconfig
	arch/arm64/kvm/hyp/Makefile
	arch/x86/include/asm/syscall_wrapper.h
	drivers/mmc/core/queue.c
	fs/nfs/dir.c
	fs/nfs/symlink.c
	include/asm-generic/vmlinux.lds.h
	include/linux/compiler-clang.h
	include/linux/pagemap.h
	kernel/cfi.c
	mm/filemap.c
	scripts/link-vmlinux.sh

Change-Id: I1e34675a86ecb60d7b8a87e16574ea8920f9cb12
Signed-off-by: default avatarIvaylo Georgiev <irgeorgiev@codeaurora.org>
parents d3d6e9be 50f91435
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -34,10 +34,6 @@ Configure the kernel with::
        CONFIG_DEBUG_FS=y
        CONFIG_GCOV_KERNEL=y

select the gcc's gcov format, default is autodetect based on gcc version::

        CONFIG_GCOV_FORMAT_AUTODETECT=y

and to get coverage data for the entire kernel::

        CONFIG_GCOV_PROFILE_ALL=y
@@ -169,6 +165,20 @@ b) gcov is run on the BUILD machine
      [user@build] gcov -o /tmp/coverage/tmp/out/init main.c


Note on compilers
-----------------

GCC and LLVM gcov tools are not necessarily compatible. Use gcov_ to work with
GCC-generated .gcno and .gcda files, and use llvm-cov_ for Clang.

.. _gcov: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
.. _llvm-cov: https://llvm.org/docs/CommandGuide/llvm-cov.html

Build differences between GCC and Clang gcov are handled by Kconfig. It
automatically selects the appropriate gcov format depending on the detected
toolchain.


Troubleshooting
---------------

+6 −38
Original line number Diff line number Diff line
@@ -142,45 +142,13 @@ Mitigation points
   mds_user_clear.

   The mitigation is invoked in prepare_exit_to_usermode() which covers
   most of the kernel to user space transitions. There are a few exceptions
   which are not invoking prepare_exit_to_usermode() on return to user
   space. These exceptions use the paranoid exit code.
   all but one of the kernel to user space transitions.  The exception
   is when we return from a Non Maskable Interrupt (NMI), which is
   handled directly in do_nmi().

   - Non Maskable Interrupt (NMI):

     Access to sensible data like keys, credentials in the NMI context is
     mostly theoretical: The CPU can do prefetching or execute a
     misspeculated code path and thereby fetching data which might end up
     leaking through a buffer.

     But for mounting other attacks the kernel stack address of the task is
     already valuable information. So in full mitigation mode, the NMI is
     mitigated on the return from do_nmi() to provide almost complete
     coverage.

   - Double fault (#DF):

     A double fault is usually fatal, but the ESPFIX workaround, which can
     be triggered from user space through modify_ldt(2) is a recoverable
     double fault. #DF uses the paranoid exit path, so explicit mitigation
     in the double fault handler is required.

   - Machine Check Exception (#MC):

     Another corner case is a #MC which hits between the CPU buffer clear
     invocation and the actual return to user. As this still is in kernel
     space it takes the paranoid exit path which does not clear the CPU
     buffers. So the #MC handler repopulates the buffers to some
     extent. Machine checks are not reliably controllable and the window is
     extremly small so mitigation would just tick a checkbox that this
     theoretical corner case is covered. To keep the amount of special
     cases small, ignore #MC.

   - Debug Exception (#DB):

     This takes the paranoid exit path only when the INT1 breakpoint is in
     kernel space. #DB on a user space address takes the regular exit path,
     so no extra mitigation required.
   (The reason that NMI is special is that prepare_exit_to_usermode() can
    enable IRQs.  In NMI context, NMIs are blocked, and we don't want to
    enable IRQs with NMIs blocked.)


2. C-State transition
+37 −8
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 19
SUBLEVEL = 44
SUBLEVEL = 45
EXTRAVERSION =
NAME = "People's Front"

@@ -612,6 +612,16 @@ ifdef CONFIG_FUNCTION_TRACER
  CC_FLAGS_FTRACE := -pg
endif

# Make toolchain changes before including arch/$(SRCARCH)/Makefile to ensure
# ar/cc/ld-* macros return correct values.
ifdef CONFIG_LTO_CLANG
# use llvm-ar for building symbol tables from IR files, and llvm-nm instead
# of objdump for processing symbol versions and exports
LLVM_AR		:= llvm-ar
LLVM_NM		:= llvm-nm
export LLVM_AR LLVM_NM
endif

# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
# values of the respective KBUILD_* variables
ARCH_CPPFLAGS :=
@@ -624,7 +634,7 @@ ifeq ($(may-sync-config),1)
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
# because some architectures define CROSS_COMPILE there.
-include include/config/auto.conf.cmd
include include/config/auto.conf.cmd

# To avoid any implicit rule to kick in, define an empty command
$(KCONFIG_CONFIG): ;
@@ -819,8 +829,24 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
LDFLAGS_vmlinux += --gc-sections
endif

ifdef CONFIG_LTO_CLANG
lto-clang-flags	:= -flto -fvisibility=hidden

# allow disabling only clang LTO where needed
DISABLE_LTO_CLANG := -fno-lto -fvisibility=default
export DISABLE_LTO_CLANG
endif

ifdef CONFIG_LTO
LTO_CFLAGS	:= $(lto-clang-flags)
KBUILD_CFLAGS	+= $(LTO_CFLAGS)

DISABLE_LTO	:= $(DISABLE_LTO_CLANG)
export LTO_CFLAGS DISABLE_LTO
endif

ifdef CONFIG_CFI_CLANG
cfi-clang-flags	+= -fsanitize=cfi
cfi-clang-flags	+= -fsanitize=cfi $(call cc-option, -fsplit-lto-unit)
DISABLE_CFI_CLANG := -fno-sanitize=cfi
ifdef CONFIG_MODULES
cfi-clang-flags	+= -fsanitize-cfi-cross-dso
@@ -830,17 +856,19 @@ ifdef CONFIG_CFI_PERMISSIVE
cfi-clang-flags	+= -fsanitize-recover=cfi -fno-sanitize-trap=cfi
endif

# also disable CFI when LTO is disabled
DISABLE_LTO_CLANG += $(DISABLE_CFI_CLANG)
# allow disabling only clang CFI where needed
export DISABLE_CFI_CLANG
endif

ifdef CONFIG_CFI
# cfi-flags are re-tested in prepare-compiler-check
cfi-flags	:= $(cfi-clang-flags)
KBUILD_CFLAGS	+= $(cfi-flags)
CFI_CFLAGS	:= $(cfi-clang-flags)
KBUILD_CFLAGS	+= $(CFI_CFLAGS)

DISABLE_CFI	:= $(DISABLE_CFI_CLANG)
export DISABLE_CFI
DISABLE_LTO	+= $(DISABLE_CFI)
export CFI_CFLAGS DISABLE_CFI
endif

# arch Makefile may override CC so keep this after arch Makefile is included
@@ -1639,7 +1667,8 @@ clean: $(clean-dirs)
		-o -name modules.builtin -o -name '.tmp_*.o.*' \
		-o -name '*.c.[012]*.*' \
		-o -name '*.ll' \
		-o -name '*.gcno' \) -type f -print | xargs rm -f
		-o -name '*.gcno' \
		-o -name '*.*.symversions' \) -type f -print | xargs rm -f

# Generate tags for editors
# ---------------------------------------------------------------------------
+39 −0
Original line number Diff line number Diff line
@@ -474,6 +474,45 @@ config STACKPROTECTOR_STRONG
	  about 20% of all kernel functions, which increases the kernel code
	  size by about 2%.

config LTO
	def_bool n

config ARCH_SUPPORTS_LTO_CLANG
	bool
	help
	  An architecture should select this option if it supports:
	  - compiling with clang,
	  - compiling inline assembly with clang's integrated assembler,
	  - and linking with LLD.

choice
	prompt "Link-Time Optimization (LTO) (EXPERIMENTAL)"
	default LTO_NONE
	help
	  This option turns on Link-Time Optimization (LTO).

config LTO_NONE
	bool "None"

config LTO_CLANG
	bool "Use clang Link Time Optimization (LTO) (EXPERIMENTAL)"
	depends on ARCH_SUPPORTS_LTO_CLANG
	depends on !FTRACE_MCOUNT_RECORD || HAVE_C_RECORDMCOUNT
	depends on !KASAN
	depends on CC_IS_CLANG && LD_IS_LLD
	select LTO
	help
          This option enables clang's Link Time Optimization (LTO), which allows
          the compiler to optimize the kernel globally at link time. If you
          enable this option, the compiler generates LLVM IR instead of object
          files, and the actual compilation from IR occurs at the LTO link step,
          which may take several minutes.

          If you select this option, you must compile the kernel with clang and
	  LLD.

endchoice

config CFI
	bool

+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@
			wakeup-interrupt-controller {
				compatible = "samsung,exynos4210-wakeup-eint";
				interrupt-parent = <&gic>;
				interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
				interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
			};
		};

Loading