Commit graph

14 commits

Author SHA1 Message Date
Greg Kroah-Hartman
27c2fe3fe6 This is the 4.9.154 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlxSn+YACgkQONu9yGCS
 aT6Y+RAAobwupy1ILjnakYdilDMDYPY5KgvpVLIIdAWKzackhemjZwbqQU2E6TYP
 T7YblQ9PZpoFfLYzQIzLI12a7F+YfxEKL3Z44R0BHw/q/nXqyz9T/adrmLaVWQVf
 Ue7+HJDfSjZV7bz2fwj1Sy3ioSsqrpEYrek5RZbK/QmoDgzoyfWUqZtyaIlnAR3n
 yQeHX8xZFzmnPOr+0SWjGtVLMOIyb/Sg2awOc4Q5rSyFM+FbB01P2rXfT92eIi0U
 FaJp/CZmdQq0t6oHZps/8sJQYjqC30zeuzHzXMpG/YnXxR2RNyclqeCmHp5K6l8S
 2pJzQddY+pgReWXnqwM+PvsTKcPF1kFx0v2X77QjjnZvRANIiTJKhoLJTGv+5aqj
 n+l/z1Mz2o99gl16lRRwOurxHL+PzyGlEQiNJPAFScdKACX+0UYFMlcnXLG3EEwH
 n55Z1VnUAZW9Q7z5gfoEEKFTn1EFcFrDdZAsxA9VB3Q4hQUCSf0XqrIs3BVKL8e0
 H6NE4LMvA3MXf8/yLocHDkknVGV6LuCG9LDWGVG5vgxTcl6/borPojd0pMuqXbQR
 DfUc9OHW9t4Y+jxvUuF9TMoS3uyPD9ozIqUg0XK8qvYEi5pjvbmQTEJ4jA4Ct+Wr
 plkNirjfh/DsVR1iaJL0vLu45uub4/RCtZ8+BpJtFYpvA7H03M8=
 =XVWw
 -----END PGP SIGNATURE-----

Merge 4.9.154 into android-4.9

Changes in 4.9.154
	net: bridge: Fix ethernet header pointer before check skb forwardable
	net: Fix usage of pskb_trim_rcsum
	openvswitch: Avoid OOB read when parsing flow nlattrs
	vhost: log dirty page correctly
	net: ipv4: Fix memory leak in network namespace dismantle
	net_sched: refetch skb protocol for each filter
	ipfrag: really prevent allocation on netns exit
	USB: serial: simple: add Motorola Tetra TPG2200 device id
	USB: serial: pl2303: add new PID to support PL2303TB
	ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages
	ASoC: rt5514-spi: Fix potential NULL pointer dereference
	ARCv2: lib: memeset: fix doing prefetchw outside of buffer
	ARC: perf: map generic branches to correct hardware condition
	s390/early: improve machine detection
	s390/smp: fix CPU hotplug deadlock with CPU rescan
	char/mwave: fix potential Spectre v1 vulnerability
	staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1
	tty: Handle problem if line discipline does not have receive_buf
	uart: Fix crash in uart_write and uart_put_char
	tty/n_hdlc: fix __might_sleep warning
	CIFS: Fix possible hang during async MTU reads and writes
	Input: xpad - add support for SteelSeries Stratus Duo
	compiler.h: enable builtin overflow checkers and add fallback code
	Input: uinput - fix undefined behavior in uinput_validate_absinfo()
	acpi/nfit: Block function zero DSMs
	acpi/nfit: Fix command-supported detection
	dm thin: fix passdown_double_checking_shared_status()
	KVM: x86: Fix single-step debugging
	x86/selftests/pkeys: Fork() to check for state being preserved
	x86/kaslr: Fix incorrect i8254 outb() parameters
	can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
	can: bcm: check timer values before ktime conversion
	vt: invoke notifier on screen size change
	perf unwind: Unwind with libdw doesn't take symfs into account
	perf unwind: Take pgoff into account when reporting elf to libdwfl
	irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size
	s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU
	nvmet-rdma: Add unlikely for response allocated check
	nvmet-rdma: fix null dereference under heavy load
	f2fs: read page index before freeing
	btrfs: fix error handling in btrfs_dev_replace_start
	btrfs: dev-replace: go back to suspended state if target device is missing
	Linux 4.9.154

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-01-31 08:36:51 +01:00
Rasmus Villemoes
1777fa9611 compiler.h: enable builtin overflow checkers and add fallback code
commit f0907827a8a9152aedac2833ed1b674a7b2a44f2 upstream.

This adds wrappers for the __builtin overflow checkers present in gcc
5.1+ as well as fallback implementations for earlier compilers. It's not
that easy to implement the fully generic __builtin_X_overflow(T1 a, T2
b, T3 *d) in macros, so the fallback code assumes that T1, T2 and T3 are
the same. We obviously don't want the wrappers to have different
semantics depending on $GCC_VERSION, so we also insist on that even when
using the builtins.

There are a few problems with the 'a+b < a' idiom for checking for
overflow: For signed types, it relies on undefined behaviour and is
not actually complete (it doesn't check underflow;
e.g. INT_MIN+INT_MIN == 0 isn't caught). Due to type promotion it
is wrong for all types (signed and unsigned) narrower than
int. Similarly, when a and b does not have the same type, there are
subtle cases like

  u32 a;

  if (a + sizeof(foo) < a)
    return -EOVERFLOW;
  a += sizeof(foo);

where the test is always false on 64 bit platforms. Add to that that it
is not always possible to determine the types involved at a glance.

The new overflow.h is somewhat bulky, but that's mostly a result of
trying to be type-generic, complete (e.g. catching not only overflow
but also signed underflow) and not relying on undefined behaviour.

Linus is of course right [1] that for unsigned subtraction a-b, the
right way to check for overflow (underflow) is "b > a" and not
"__builtin_sub_overflow(a, b, &d)", but that's just one out of six cases
covered here, and included mostly for completeness.

So is it worth it? I think it is, if nothing else for the documentation
value of seeing

  if (check_add_overflow(a, b, &d))
    return -EGOAWAY;
  do_stuff_with(d);

instead of the open-coded (and possibly wrong and/or incomplete and/or
UBsan-tickling)

  if (a+b < a)
    return -EGOAWAY;
  do_stuff_with(a+b);

While gcc does recognize the 'a+b < a' idiom for testing unsigned add
overflow, it doesn't do nearly as good for unsigned multiplication
(there's also no single well-established idiom). So using
check_mul_overflow in kcalloc and friends may also make gcc generate
slightly better code.

[1] https://lkml.org/lkml/2015/11/2/658

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-31 08:12:35 +01:00
Greg Kroah-Hartman
f85543ba3c This is the 4.9.120 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlt0UY8ACgkQONu9yGCS
 aT7S6hAAlsHMdJgnhCQ06Ec1ld1b3Q7tehn+xVFgWAPyHm/L3koM/78IMjo7ZYCV
 IxiIQyQ+JCn9DXQb2nqeEFgo8DYo83KvBkIgI+GQZHuVp+Dp9AvQLV8Bm3CQwiCY
 LPlP1sWs0xRZxovazMJ5MLsAOf9hZVkpwWoQHrEQMlUHpKYwf6GRBteZ6C3evZ4G
 lPo5N986h2YDYA3FLA2h5EeFS2H39bgbnepJ6/4/cYBpDy443X3TrV6UZjDDhHST
 6XYPuqoApz+QIk2x2FfhVbZUb8WtPJNg/6IunOhlaUH/WCEN05lQ2x0jXAA4jOV/
 Z2QyGnqsD8hMleDeakzo+yggaECkK2n+b6SicmomXWj7ILmBCrAIG0dOtPksmAaw
 JP9mOKz5b87N2GOShSvj9LXuFOIO7TVvwFZCo4oYxkaW6ROxSO7Ffkiv8I6imMn5
 zPGSBG4Pr9eQfeO+IK2JAxrULICcFbh57XXEP5x7MH78yRw4hG++BtWg62pI7TQl
 l3zZ/eY8wKjTlNQbFkSAPenMypPic6w5NRA9tHST5XrwZkF0nzMWDz/1mAgOH5jx
 XVTK3kZabKAf3YQ2/2nAnUvDM4BsM1SwUxTfc1CNQHIl24G7Y3Z4Vxlfj5orNEQ+
 Y5OPKDatNi8gWBecDLNITih7h+WlRn1UKR/v4f8TPV0gyGhn2Vc=
 =peDG
 -----END PGP SIGNATURE-----

Merge 4.9.120 into android-4.9

Changes in 4.9.120
	ext4: fix check to prevent initializing reserved inodes
	tpm: fix race condition in tpm_common_write()
	parisc: Enable CONFIG_MLONGCALLS by default
	parisc: Define mb() and add memory barriers to assembler unlock sequences
	kasan: add no_sanitize attribute for clang builds
	Mark HI and TASKLET softirq synchronous
	xen/netfront: don't cache skb_shinfo()
	ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices
	scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
	init: rename and re-order boot_cpu_state_init()
	root dentries need RCU-delayed freeing
	make sure that __dentry_kill() always invalidates d_seq, unhashed or not
	fix mntput/mntput race
	fix __legitimize_mnt()/mntput() race
	proc/sysctl: prune stale dentries during unregistering
	proc/sysctl: Don't grab i_lock under sysctl_lock.
	proc: Fix proc_sys_prune_dcache to hold a sb reference
	IB/core: Make testing MR flags for writability a static inline function
	IB/mlx4: Mark user MR as writable if actual virtual memory is writable
	mtd: nand: qcom: Add a NULL check for devm_kasprintf()
	IB/ocrdma: fix out of bounds access to local buffer
	ARM: dts: imx6sx: fix irq for pcie bridge
	x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
	x86/speculation: Protect against userspace-userspace spectreRSB
	kprobes/x86: Fix %p uses in error messages
	x86/irqflags: Provide a declaration for native_save_fl
	x86/speculation/l1tf: Increase 32bit PAE __PHYSICAL_PAGE_SHIFT
	mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1
	x86/speculation/l1tf: Change order of offset/type in swap entry
	x86/speculation/l1tf: Protect swap entries against L1TF
	x86/speculation/l1tf: Protect PROT_NONE PTEs against speculation
	x86/speculation/l1tf: Make sure the first page is always reserved
	x86/speculation/l1tf: Add sysfs reporting for l1tf
	x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings
	x86/speculation/l1tf: Limit swap file size to MAX_PA/2
	x86/bugs: Move the l1tf function and define pr_fmt properly
	x86/smp: Provide topology_is_primary_thread()
	x86/topology: Provide topology_smt_supported()
	cpu/hotplug: Make bringup/teardown of smp threads symmetric
	cpu/hotplug: Split do_cpu_down()
	cpu/hotplug: Provide knobs to control SMT
	x86/cpu: Remove the pointless CPU printout
	x86/cpu/AMD: Remove the pointless detect_ht() call
	x86/cpu/common: Provide detect_ht_early()
	x86/cpu/topology: Provide detect_extended_topology_early()
	x86/cpu/intel: Evaluate smp_num_siblings early
	x86/CPU/AMD: Do not check CPUID max ext level before parsing SMP info
	x86/cpu/AMD: Evaluate smp_num_siblings early
	x86/apic: Ignore secondary threads if nosmt=force
	x86/speculation/l1tf: Extend 64bit swap file size limit
	x86/cpufeatures: Add detection of L1D cache flush support.
	x86/CPU/AMD: Move TOPOEXT reenablement before reading smp_num_siblings
	x86/speculation/l1tf: Protect PAE swap entries against L1TF
	x86/speculation/l1tf: Fix up pte->pfn conversion for PAE
	Revert "x86/apic: Ignore secondary threads if nosmt=force"
	cpu/hotplug: Boot HT siblings at least once
	x86/KVM: Warn user if KVM is loaded SMT and L1TF CPU bug being present
	x86/KVM/VMX: Add module argument for L1TF mitigation
	x86/KVM/VMX: Add L1D flush algorithm
	x86/KVM/VMX: Add L1D MSR based flush
	x86/KVM/VMX: Add L1D flush logic
	kvm: nVMX: Update MSR load counts on a VMCS switch
	x86/KVM/VMX: Split the VMX MSR LOAD structures to have an host/guest numbers
	x86/KVM/VMX: Add find_msr() helper function
	x86/KVM/VMX: Separate the VMX AUTOLOAD guest/host number accounting
	x86/KVM/VMX: Extend add_atomic_switch_msr() to allow VMENTER only MSRs
	x86/KVM/VMX: Use MSR save list for IA32_FLUSH_CMD if required
	cpu/hotplug: Online siblings when SMT control is turned on
	x86/litf: Introduce vmx status variable
	x86/kvm: Drop L1TF MSR list approach
	x86/l1tf: Handle EPT disabled state proper
	x86/kvm: Move l1tf setup function
	x86/kvm: Add static key for flush always
	x86/kvm: Serialize L1D flush parameter setter
	x86/kvm: Allow runtime control of L1D flush
	cpu/hotplug: Expose SMT control init function
	cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early
	x86/bugs, kvm: Introduce boot-time control of L1TF mitigations
	Documentation: Add section about CPU vulnerabilities
	x86/KVM/VMX: Initialize the vmx_l1d_flush_pages' content
	Documentation/l1tf: Fix typos
	cpu/hotplug: detect SMT disabled by BIOS
	x86/KVM/VMX: Don't set l1tf_flush_l1d to true from vmx_l1d_flush()
	x86/KVM/VMX: Replace 'vmx_l1d_flush_always' with 'vmx_l1d_flush_cond'
	x86/KVM/VMX: Move the l1tf_flush_l1d test to vmx_l1d_flush()
	x86/irq: Demote irq_cpustat_t::__softirq_pending to u16
	x86/KVM/VMX: Introduce per-host-cpu analogue of l1tf_flush_l1d
	x86: Don't include linux/irq.h from asm/hardirq.h
	x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d
	x86/KVM/VMX: Don't set l1tf_flush_l1d from vmx_handle_external_intr()
	Documentation/l1tf: Remove Yonah processors from not vulnerable list
	KVM: x86: Add a framework for supporting MSR-based features
	KVM: SVM: Add MSR-based feature support for serializing LFENCE
	KVM: X86: Introduce kvm_get_msr_feature()
	KVM: X86: Allow userspace to define the microcode version
	KVM: VMX: support MSR_IA32_ARCH_CAPABILITIES as a feature MSR
	x86/speculation: Simplify sysfs report of VMX L1TF vulnerability
	x86/speculation: Use ARCH_CAPABILITIES to skip L1D flush on vmentry
	KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry
	cpu/hotplug: Fix SMT supported evaluation
	x86/speculation/l1tf: Invert all not present mappings
	x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert
	x86/mm/pat: Make set_memory_np() L1TF safe
	x86/mm/kmmio: Make the tracer robust against L1TF
	tools headers: Synchronise x86 cpufeatures.h for L1TF additions
	x86/microcode: Do not upload microcode if CPUs are offline
	x86/microcode: Allow late microcode loading with SMT disabled
	x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread
	cpu/hotplug: Non-SMP machines do not make use of booted_once
	x86/init: fix build with CONFIG_SWAP=n
	x86/speculation/l1tf: Unbreak !__HAVE_ARCH_PFN_MODIFY_ALLOWED architectures
	x86/cpu/amd: Limit cpu_core_id fixup to families older than F17h
	x86/CPU/AMD: Have smp_num_siblings and cpu_llc_id always be present
	Linux 4.9.120

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2018-08-15 18:30:15 +02:00
Andrey Konovalov
50bed434ad kasan: add no_sanitize attribute for clang builds
commit 12c8f25a016dff69ee284aa3338bebfd2cfcba33 upstream.

KASAN uses the __no_sanitize_address macro to disable instrumentation of
particular functions.  Right now it's defined only for GCC build, which
causes false positives when clang is used.

This patch adds a definition for clang.

Note, that clang's revision 329612 or higher is required.

[andreyknvl@google.com: remove redundant #ifdef CONFIG_KASAN check]
  Link: http://lkml.kernel.org/r/c79aa31a2a2790f6131ed607c58b0dd45dd62a6c.1523967959.git.andreyknvl@google.com
Link: http://lkml.kernel.org/r/4ad725cc903f8534f8c8a60f0daade5e3d674f8d.1523554166.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Paul Lawrence <paullawrence@google.com>
Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sodagudi Prasad <psodagud@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-15 18:14:42 +02:00
David Rientjes
29524a9d42 compiler, clang: always inline when CONFIG_OPTIMIZE_INLINING is disabled
commit 9a04dbcfb33b4012d0ce8c0282f1e3ca694675b1 upstream.

The motivation for commit abb2ea7dfd82 ("compiler, clang: suppress
warning for unused static inline functions") was to suppress clang's
warnings about unused static inline functions.

For configs without CONFIG_OPTIMIZE_INLINING enabled, such as any non-x86
architecture, `inline' in the kernel implies that
__attribute__((always_inline)) is used.

Some code depends on that behavior, see
  https://lkml.org/lkml/2017/6/13/918:

  net/built-in.o: In function `__xchg_mb':
  arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99'
  arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99

The full fix would be to identify these breakages and annotate the
functions with __always_inline instead of `inline'.  But since we are
late in the 4.12-rc cycle, simply carry forward the forced inlining
behavior and work toward moving arm64, and other architectures, toward
CONFIG_OPTIMIZE_INLINING behavior.

Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1706261552200.1075@chino.kir.corp.google.com
Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Sodagudi Prasad <psodagud@codeaurora.org>
Tested-by: Sodagudi Prasad <psodagud@codeaurora.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-22 14:27:35 +02:00
Linus Torvalds
f276b50c3a compiler, clang: properly override 'inline' for clang
commit 6d53cefb18e4646fb4bf62ccb6098fb3808486df upstream.

Commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused
static inline functions") just caused more warnings due to re-defining
the 'inline' macro.

So undef it before re-defining it, and also add the 'notrace' attribute
like the gcc version that this is overriding does.

Maybe this makes clang happier.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-22 14:27:35 +02:00
David Rientjes
94cc698fda compiler, clang: suppress warning for unused static inline functions
commit abb2ea7dfd82451d85ce669b811310c05ab5ca46 upstream.

GCC explicitly does not warn for unused static inline functions for
-Wunused-function.  The manual states:

	Warn whenever a static function is declared but not defined or
	a non-inline static function is unused.

Clang does warn for static inline functions that are unused.

It turns out that suppressing the warnings avoids potentially complex
#ifdef directives, which also reduces LOC.

Suppress the warning for clang.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-22 14:27:35 +02:00
Greg Kroah-Hartman
bb52bba67e This is the 4.9.88 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlquPRAACgkQONu9yGCS
 aT6gpA/9GRBca/4SKY1Bdsqtw12mVa2iy/xl4tBhzZAxxMiEjam9vDFNd9Gw0r/J
 iNGUFiZgWkN/dVMLnadPdtKbsg/MmD2CvXPtZY5LywgNyvTY6zZxMXExzjjI3h8n
 bdC68g+qcolPsqwZHJL/wScSZH8Q2UZKwugRCoGkzt6dZmLoiVWMmb9RXc36hPek
 cPyGne/uQMlanMOQYAVe2enJoC18JWeeOuPLzSvs3y8Rj1ZlzWM3aaAaTdKfiMWc
 ewK/DDIu9a/pt5xmi2RgCuMZeU84qCvZMAt+v2e56LmAMqZ5MQHUcXscUDofyvrt
 X3jSaXV5gvKGSGY+/U4JzDX+/B37z6mKUZF7b7ZTpdTfR6cgHFW7TGPkCkNQplfK
 aVF1cCIy65Gjp62LZXSQI5rSAB5C72ryk4resFVZ+QcLRzPhYSS1H6aD5UzfdhkC
 QhfKJU+6HfpGEWtjL5pUkNFOprP8f2mfFNNuzmo9Ev5f+qvyT35WCyWzSOz0a/E6
 dQNhHCpUzykLI4YuUFIUaieNLIshhrGnNxo32CKzLqup8NMtyXsyyzGciSWSWNyw
 f9tbULluWlimDx+hukrrnD8Hw5jzN0D7JlSy9WVjYNvBV6CLGz6ZalzhY0uUAjoT
 IsgiN76klZ77fOr6FhnU+mErPBexuYgScWJW8TeqqmK+0gX4i0Y=
 =X9zL
 -----END PGP SIGNATURE-----

Merge 4.9.88 into android-4.9

Changes in 4.9.88
	RDMA/ucma: Limit possible option size
	RDMA/ucma: Check that user doesn't overflow QP state
	RDMA/mlx5: Fix integer overflow while resizing CQ
	drm/i915: Try EDID bitbanging on HDMI after failed read
	scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
	drm/i915: Always call to intel_display_set_init_power() in resume_early.
	workqueue: Allow retrieval of current task's work struct
	drm: Allow determining if current task is output poll worker
	drm/nouveau: Fix deadlock on runtime suspend
	drm/radeon: Fix deadlock on runtime suspend
	drm/amdgpu: Fix deadlock on runtime suspend
	drm/amdgpu: Notify sbios device ready before send request
	drm/radeon: fix KV harvesting
	drm/amdgpu: fix KV harvesting
	drm/amdgpu:Correct max uvd handles
	drm/amdgpu:Always save uvd vcpu_bo in VM Mode
	MIPS: BMIPS: Do not mask IPIs during suspend
	MIPS: ath25: Check for kzalloc allocation failure
	MIPS: OCTEON: irq: Check for null return on kzalloc allocation
	Input: matrix_keypad - fix race when disabling interrupts
	loop: Fix lost writes caused by missing flag
	virtio_ring: fix num_free handling in error case
	KVM: s390: fix memory overwrites when not using SCA entries
	kbuild: Handle builtin dtb file names containing hyphens
	IB/mlx5: Fix incorrect size of klms in the memory region
	bcache: fix crashes in duplicate cache device register
	bcache: don't attach backing with duplicate UUID
	x86/MCE: Serialize sysfs changes
	perf tools: Fix trigger class trigger_on()
	x86/spectre_v2: Don't check microcode versions when running under hypervisors
	ALSA: hda/realtek: Limit mic boost on T480
	ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520
	ALSA: hda/realtek - Make dock sound work on ThinkPad L570
	ALSA: seq: Don't allow resizing pool in use
	ALSA: seq: More protection for concurrent write and ioctl races
	ALSA: hda: add dock and led support for HP EliteBook 820 G3
	ALSA: hda: add dock and led support for HP ProBook 640 G2
	nospec: Kill array_index_nospec_mask_check()
	nospec: Include <asm/barrier.h> dependency
	Revert "x86/retpoline: Simplify vmexit_fill_RSB()"
	x86/speculation: Use IBRS if available before calling into firmware
	x86/retpoline: Support retpoline builds with Clang
	x86/speculation, objtool: Annotate indirect calls/jumps for objtool
	x86/boot, objtool: Annotate indirect jump in secondary_startup_64()
	x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
	x86/paravirt, objtool: Annotate indirect calls
	watchdog: hpwdt: SMBIOS check
	watchdog: hpwdt: Check source of NMI
	watchdog: hpwdt: fix unused variable warning
	watchdog: hpwdt: Remove legacy NMI sourcing.
	ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
	Input: tca8418_keypad - remove double read of key event register
	tc358743: fix register i2c_rd/wr function fix
	netfilter: add back stackpointer size checks
	netfilter: x_tables: fix missing timer initialization in xt_LED
	netfilter: nat: cope with negative port range
	netfilter: IDLETIMER: be syzkaller friendly
	netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
	netfilter: bridge: ebt_among: add missing match size checks
	netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt
	netfilter: x_tables: pass xt_counters struct instead of packet counter
	netfilter: x_tables: pass xt_counters struct to counter allocator
	netfilter: x_tables: pack percpu counter allocations
	ext4: inplace xattr block update fails to deduplicate blocks
	ubi: Fix race condition between ubi volume creation and udev
	scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
	NFS: Fix an incorrect type in struct nfs_direct_req
	NFS: Fix unstable write completion
	x86/module: Detect and skip invalid relocations
	x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
	ASoC: sgtl5000: Fix suspend/resume
	ASoC: rt5651: Fix regcache sync errors on resume
	serial: sh-sci: prevent lockup on full TTY buffers
	tty/serial: atmel: add new version check for usart
	uas: fix comparison for error code
	staging: comedi: fix comedi_nsamples_left.
	staging: android: ashmem: Fix lockdep issue during llseek
	USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h
	usbip: vudc: fix null pointer dereference on udc->lock
	usb: quirks: add control message delay for 1b1c:1b20
	usb: usbmon: Read text within supplied buffer size
	usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb()
	serial: 8250_pci: Add Brainboxes UC-260 4 port serial device
	serial: core: mark port as initialized in autoconfig
	earlycon: add reg-offset to physical address before mapping
	PCI: dwc: Fix enumeration end when reaching root subordinate
	Linux 4.9.88

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2018-03-18 12:07:50 +01:00
David Woodhouse
6123a6becd x86/retpoline: Support retpoline builds with Clang
commit 87358710c1fb4f1bf96bbe2349975ff9953fc9b2 upstream.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: arjan.van.de.ven@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@intel.com
Cc: jmattson@google.com
Cc: karahmed@amazon.de
Cc: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Cc: rkrcmar@redhat.com
Link: http://lkml.kernel.org/r/1519037457-7643-5-git-send-email-dwmw@amazon.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-18 11:18:52 +01:00
Paul Lawrence
08da675c94 BACKPORT: kasan: add compiler support for clang
Patch series "kasan: support alloca, LLVM", v4.

This patch (of 5):

For now we can hard-code ASAN ABI level 5, since historical clang builds
can't build the kernel anyway.  We also need to emulate gcc's
__SANITIZE_ADDRESS__ flag, or memset() calls won't be instrumented.

Link: http://lkml.kernel.org/r/20171204191735.132544-2-paullawrence@google.com
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry-picked from 53a98ed73b848432a51631346b02049bb7fa039d)
Change-Id: I4f694d1c06ad286e165d68938ff0f4348dc5fedf
Signed-off-by: Paul Lawrence <paullawrence@google.com>
2018-03-15 08:28:36 -07:00
Sami Tolvanen
00a195e7c0 add support for clang Control Flow Integrity (CFI)
This change adds the CONFIG_CFI_CLANG option, CFI error handling,
and a faster look-up table for cross module CFI checks.

Bug: 67506682
Change-Id: Ic009f0a629b552a0eb16e6d89808c7029e91447d
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-02-28 15:09:58 -08:00
Sami Tolvanen
7bd125e57b FROMLIST: BACKPORT: kbuild: fix dynamic ftrace with clang LTO
With CONFIG_LTO_CLANG enabled, LLVM IR won't be compiled into object
files until modpost_link. This change postpones calls to recordmcount
until after this step.

In order to exclude ftrace_process_locs from inspection, we add a new
code section .text..ftrace, which we tell recordmcount to ignore, and
a __norecordmcount attribute for moving functions to this section.

Bug: 62093296
Bug: 67506682
Change-Id: Iba2c053968206acf533fadab1eb34a743b5088ee
(am from https://patchwork.kernel.org/patch/10060327/)
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-02-28 15:09:57 -08:00
Arnd Bergmann
b41c29b052 Kbuild: provide a __UNIQUE_ID for clang
The default __UNIQUE_ID macro in compiler.h fails to work for some drivers:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:615:1: error: redefinition of
      '__UNIQUE_ID_firmware615'
BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");

This adds a copy of the version we use for gcc-4.3 and higher, as the same
one works with all versions of clang that I could find in svn (2.6 and higher).

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Marek <mmarek@suse.com>
2016-02-08 19:04:55 +01:00
Mark Charlebois
565cbdc2fe LLVMLinux: Add support for clang to compiler.h and new compiler-clang.h
Add a compiler-clang.h file to add specific macros needed for compiling the
kernel with clang.

Initially the only override required is the macro for silencing the
compiler for a purposefully uninintialized variable.

Author: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
2014-04-09 13:44:35 -07:00