13 Commits

Author SHA1 Message Date
Blagovest Kolenichev
dd6ae3b853 Merge android-4.14.118 (db39369) into msm-4.14
* refs/heads/tmp-db39369:
  Linux 4.14.118
  arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP
  locking/futex: Allow low-level atomic operations to return -EAGAIN
  ASoC: Intel: avoid Oops if DMA setup fails
  UAS: fix alignment of scatter/gather segments
  Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
  Bluetooth: hidp: fix buffer overflow
  scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
  intel_th: pci: Add Comet Lake support
  usb-storage: Set virt_boundary_mask to avoid SG overflows
  USB: cdc-acm: fix unthrottle races
  USB: serial: f81232: fix interrupt worker not stop
  usb: dwc3: Fix default lpm_nyet_threshold value
  genirq: Prevent use-after-free and work list corruption
  iommu/amd: Set exclusion range correctly
  platform/x86: pmc_atom: Drop __initconst on dmi table
  virtio-blk: limit number of hw queues by nr_cpu_ids
  ASoC: Intel: kbl: fix wrong number of channels
  drm/mediatek: fix possible object reference leak
  scsi: csiostor: fix missing data copy in csio_scsi_err_handler()
  RDMA/vmw_pvrdma: Fix memory leak on pvrdma_pci_remove
  virtio_pci: fix a NULL pointer reference in vp_del_vqs
  slab: fix a crash by reading /proc/slab_allocators
  ASoC: rockchip: pdm: fix regmap_ops hang issue
  linux/kernel.h: Use parentheses around argument in u64_to_user_ptr()
  perf/x86/intel: Initialize TFA MSR
  perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS
  drm/mediatek: Fix an error code in mtk_hdmi_dt_parse_pdata()
  ASoC: tlv320aic32x4: Fix Common Pins
  MIPS: KGDB: fix kgdb support for SMP platforms.
  IB/hfi1: Eliminate opcode tests on mr deref
  ASoC: cs4270: Set auto-increment bit for register writes
  ASoC: wm_adsp: Add locking to wm_adsp2_bus_error
  ASoC: samsung: odroid: Fix clock configuration for 44100 sample rate
  ASoC: nau8810: fix the issue of widget with prefixed name
  ASoC: nau8824: fix the issue of the widget with prefix name
  ASoC:soc-pcm:fix a codec fixup issue in TDM case
  ASoC: hdmi-codec: fix S/PDIF DAI
  staging: greybus: power_supply: fix prop-descriptor request size
  ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings
  Drivers: hv: vmbus: Remove the undesired put_cpu_ptr() in hv_synic_cleanup()
  scsi: libsas: fix a race condition when smp task timeout
  ANDROID: block/cfq-iosched: make group_idle per io cgroup tunable
  ANDROID: cuttlefish_defconfig: Enable CONFIG_CPUSETS and CONFIG_CGROUP_SCHEDTUNE
  fscrypt: remove filesystem specific build config option
  f2fs: use IS_ENCRYPTED() to check encryption status
  ext4: use IS_ENCRYPTED() to check encryption status
  fscrypt: return -EXDEV for incompatible rename or link into encrypted dir
  fscrypt: remove CRYPTO_CTR dependency
  fscrypt: add Adiantum support / removed speck
  ext4: switch to fscrypt_prepare_setattr()
  ext4: switch to fscrypt_prepare_rename()
  ext4: switch to fscrypt_prepare_link()
  ext4: switch to fscrypt_file_open()
  ext4, dax: set ext4_dax_aops for dax files

Conflicts:
	fs/crypto/fscrypt_private.h
	fs/ext4/inode.c
	fs/ext4/move_extent.c
	include/linux/fscrypt_supp.h
	kernel/irq/manage.c

Change-Id: I71237103050ab644a1e4a14eeb64a5b6e992629c
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2019-07-23 10:53:47 -07:00
Andrey Ryabinin
4b2bff7b81 ubsan: Fix nasty -Wbuiltin-declaration-mismatch GCC-9 warnings
commit f0996bc2978e02d2ea898101462b960f6119b18f upstream.

Building lib/ubsan.c with gcc-9 results in a ton of nasty warnings like
this one:

    lib/ubsan.c warning: conflicting types for built-in function
         ‘__ubsan_handle_negate_overflow’; expected ‘void(void *, void *)’ [-Wbuiltin-declaration-mismatch]

The kernel's declarations of __ubsan_handle_*() often uses 'unsigned
long' types in parameters while GCC these parameters as 'void *' types,
hence the mismatch.

Fix this by using 'void *' to match GCC's declarations.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Fixes: c6d308534aef ("UBSAN: run-time undefined behavior sanity checker")
Cc: <stable@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-10 17:53:08 +02:00
Blagovest Kolenichev
6e592c7b95 Merge android-4.14-p.82 (82609b3) into msm-4.14
* remotes/origin/tmp-82609b3:
  Linux 4.14.82
  gpio: brcmstb: release the bgpio lock during irq handlers
  nvme-loop: fix kernel oops in case of unhandled command
  printk: Never set console_may_schedule in console_trylock()
  ovl: check whiteout in ovl_create_over_whiteout()
  CONFIG_XEN_PV breaks xen_create_contiguous_region on ARM
  drm/i915/execlists: Force write serialisation into context image vs execution
  drm/i915: Mark pin flags as u64
  drm/i915: Don't oops during modeset shutdown after lpe audio deinit
  drm/i915/hdmi: Add HDMI 2.0 audio clock recovery N values
  drm/i915: Large page offsets for pread/pwrite
  drm/i915: Skip vcpi allocation for MSTB ports that are gone
  drm/i915: Don't unset intel_connector->mst_port
  drm/i915: Restore vblank interrupts earlier
  drm/dp_mst: Check if primary mstb is null
  drm/nouveau: Check backlight IDs are >= 0, not > 0
  drm/amdgpu: add missing CHIP_HAINAN in amdgpu_ucode_get_load_type
  drm/rockchip: Allow driver to be shutdown on reboot/kexec
  efi/arm/libstub: Pack FDT after populating it
  mm/swapfile.c: use kvzalloc for swap_info_struct allocation
  hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444!
  lib/ubsan.c: don't mark __ubsan_handle_builtin_unreachable as noreturn
  crypto: user - fix leaking uninitialized memory to userspace
  gfs2: Put bitmap buffers in put_super
  configfs: replace strncpy with memcpy
  fuse: fix leaked notify reply
  fuse: fix use-after-free in fuse_direct_IO()
  rtc: hctosys: Add missing range error reporting
  nfsd: COPY and CLONE operations require the saved filehandle to be set
  sunrpc: correct the computation for page_ptr when truncating
  kdb: print real address of pointers instead of hashed addresses
  kdb: use correct pointer when 'btc' calls 'btt'
  mount: Prevent MNT_DETACH from disconnecting locked mounts
  mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
  mount: Retest MNT_LOCKED in do_umount
  ext4: fix buffer leak in __ext4_read_dirblock() on error path
  ext4: fix buffer leak in ext4_expand_extra_isize_ea() on error path
  ext4: fix buffer leak in ext4_xattr_move_to_block() on error path
  ext4: release bs.bh before re-using in ext4_xattr_block_find()
  ext4: fix buffer leak in ext4_xattr_get_block() on error path
  ext4: fix possible leak of s_journal_flag_rwsem in error path
  ext4: fix possible leak of sbi->s_group_desc_leak in error path
  ext4: avoid possible double brelse() in add_new_gdb() on error path
  ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing
  ext4: avoid buffer leak in ext4_orphan_add() after prior errors
  ext4: avoid buffer leak on shutdown in ext4_mark_iloc_dirty()
  ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
  ext4: missing !bh check in ext4_xattr_inode_write()
  ext4: avoid potential extra brelse in setup_new_flex_group_blocks()
  ext4: add missing brelse() add_new_gdb_meta_bg()'s error path
  ext4: add missing brelse() in set_flexbg_block_bitmap()'s error path
  ext4: add missing brelse() update_backups()'s error path
  clockevents/drivers/i8253: Add support for PIT shutdown quirk
  Btrfs: fix data corruption due to cloning of eof block
  Btrfs: fix infinite loop on inode eviction after deduplication of eof block
  Btrfs: fix cur_offset in the error case for nocow
  btrfs: fix pinned underflow after transaction aborted
  watchdog/core: Add missing prototypes for weak functions
  arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
  termios, tty/tty_baudrate.c: fix buffer overrun
  x86/hyper-v: Enable PIT shutdown quirk
  x86/cpu/vmware: Do not trace vmware_sched_clock()
  of, numa: Validate some distance map rules
  mtd: docg3: don't set conflicting BCH_CONST_PARAMS option
  ARM: 8809/1: proc-v7: fix Thumb annotation of cpu_v7_hvc_switch_mm
  netfilter: conntrack: fix calculation of next bucket number in early_drop
  mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings
  ocfs2: free up write context when direct IO failed
  ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
  soc: ti: QMSS: Fix usage of irq_set_affinity_hint
  SCSI: fix queue cleanup race before queue initialization is done
  scsi: qla2xxx: Initialize port speed to avoid setting lower speed
  vhost/scsi: truncate T10 PI iov_iter to prot_bytes
  reset: hisilicon: fix potential NULL pointer dereference
  mach64: fix image corruption due to reading accelerator registers
  mach64: fix display corruption on big endian machines
  thermal: enable broadcom menu for arm64 bcm2835
  Revert "ceph: fix dentry leak in splice_dentry()"
  libceph: bump CEPH_MSG_MAX_DATA_LEN
  media: ov7670: make "xclk" clock optional
  clk: mvebu: use correct bit for 98DX3236 NAND
  clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call
  clk: at91: Fix division by zero in PLL recalc_rate()
  clk: s2mps11: Fix matching when built as module and DT node contains compatible
  um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP
  xtensa: fix boot parameters address translation
  xtensa: make sure bFLT stack is 16 byte aligned
  xtensa: add NOTES section to the linker script
  MIPS: Loongson-3: Fix BRIDGE irq delivery problem
  MIPS: Loongson-3: Fix CPU UART irq delivery problem
  ovl: fix recursive oi->lock in ovl_link()
  fuse: set FR_SENT while locked
  fuse: fix blocked_waitq wakeup
  fuse: Fix use-after-free in fuse_dev_do_write()
  fuse: Fix use-after-free in fuse_dev_do_read()
  scsi: qla2xxx: Fix re-using LoopID when handle is in use
  scsi: qla2xxx: shutdown chip if reset fail
  scsi: qla2xxx: Remove stale debug trace message from tcm_qla2xxx
  scsi: qla2xxx: Fix process response queue for ISP26XX and above
  scsi: qla2xxx: Fix incorrect port speed being set for FC adapters
  ovl: fix error handling in ovl_verify_set_fh()
  cdrom: fix improper type cast, which can leat to information leak.
  9p: clear dangling pointers in p9stat_free
  9p locks: fix glock.client_id leak in do_lock
  staging:iio:ad7606: fix voltage scales
  powerpc/selftests: Wait all threads to join
  media: tvp5150: fix width alignment during set_selection()
  sc16is7xx: Fix for multi-channel stall
  MIPS/PCI: Call pcie_bus_configure_settings() to set MPS/MRRS
  powerpc/memtrace: Remove memory in chunks
  powerpc/boot: Ensure _zimage_start is a weak symbol
  MIPS: kexec: Mark CPU offline before disabling local IRQ
  media: coda: don't overwrite h.264 profile_idc on decoder instance
  media: pci: cx23885: handle adding to list failure
  drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer pointer
  drm/omap: fix memory barrier bug in DMM driver
  powerpc/mm: Don't report hugepage tables as memory leaks when using kmemleak
  powerpc/nohash: fix undefined behaviour when testing page size support
  ARM: imx_v6_v7_defconfig: Select CONFIG_TMPFS_POSIX_ACL
  tty: check name length in tty_find_polling_driver()
  powerpc/eeh: Fix possible null deref in eeh_dump_dev_log()
  powerpc/mm: Fix page table dump to work on Radix
  powerpc/64/module: REL32 relocation range check
  powerpc/traps: restore recoverability of machine_check interrupts

Change-Id: Ic57d67a5d6d5d8873abb56a093fe5fd5255a9fb7
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2018-12-17 10:56:34 -08:00
Arnd Bergmann
efcbe502dd lib/ubsan.c: don't mark __ubsan_handle_builtin_unreachable as noreturn
commit 1c23b4108d716cc848b38532063a8aca4f86add8 upstream.

gcc-8 complains about the prototype for this function:

  lib/ubsan.c:432:1: error: ignoring attribute 'noreturn' in declaration of a built-in function '__ubsan_handle_builtin_unreachable' because it conflicts with attribute 'const' [-Werror=attributes]

This is actually a GCC's bug. In GCC internals
__ubsan_handle_builtin_unreachable() declared with both 'noreturn' and
'const' attributes instead of only 'noreturn':

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84210

Workaround this by removing the noreturn attribute.

[aryabinin: add information about GCC bug in changelog]
Link: http://lkml.kernel.org/r/20181107144516.4587-1-aryabinin@virtuozzo.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Olof Johansson <olof@lixom.net>
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-11-21 09:24:15 +01:00
Isaac J. Manjarres
a7ea4f03e5 lib: ubsan: Fix compilation issues for ubsan
Currently, multiple declarations of data structures and
functions exist, as well as dead code that was meant to be
removed earlier. Remove dead code and multiple declarations
for ubsan.

Change-Id: I2b1d27ab2edc9852a3cd286c70fe8990aa0e0754
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2018-03-09 11:30:09 -08:00
Isaac J. Manjarres
2ba985d87a Merge remote-tracking branch 'remotes/origin/tmp-0a91e84' into msm-4.14
* remotes/origin/tmp-0a91e84:
  Linux 4.14.20
  scsi: cxlflash: Reset command ioasc
  scsi: lpfc: Fix crash after bad bar setup on driver attachment
  rcu: Export init_rcu_head() and destroy_rcu_head() to GPL modules
  scsi: core: Ensure that the SCSI error handler gets woken up
  ftrace: Remove incorrect setting of glob search field
  devpts: fix error handling in devpts_mntget()
  mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy
  ovl: take mnt_want_write() for removing impure xattr
  ovl: fix failure to fsync lower dir
  acpi, nfit: fix register dimm error handling
  ACPI: sbshc: remove raw pointer from printk() message
  drm/i915: Avoid PPS HW/SW state mismatch due to rounding
  arm64: dts: marvell: add Ethernet aliases
  objtool: Fix switch-table detection
  btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker
  lib/ubsan: add type mismatch handler for new GCC/Clang
  lib/ubsan.c: s/missaligned/misaligned/
  clocksource/drivers/stm32: Fix kernel panic with multiple timers
  blk-mq: quiesce queue before freeing queue
  pktcdvd: Fix a recently introduced NULL pointer dereference
  pktcdvd: Fix pkt_setup_dev() error path
  pinctrl: sx150x: Add a static gpio/pinctrl pin range mapping
  pinctrl: sx150x: Register pinctrl before adding the gpiochip
  pinctrl: sx150x: Unregister the pinctrl on release
  pinctrl: mcp23s08: fix irq setup order
  pinctrl: intel: Initialize GPIO properly when used through irqchip
  EDAC, octeon: Fix an uninitialized variable warning
  xtensa: fix futex_atomic_cmpxchg_inatomic
  alpha: fix formating of stack content
  alpha: fix reboot on Avanti platform
  alpha: Fix mixed up args in EXC macro in futex operations
  alpha: osf_sys.c: fix put_tv32 regression
  alpha: fix crash if pthread_create races with signal delivery
  signal/sh: Ensure si_signo is initialized in do_divide_error
  signal/openrisc: Fix do_unaligned_access to send the proper signal
  ipmi: use dynamic memory for DMI driver override
  Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version
  Revert "Bluetooth: btusb: fix QCA Rome suspend/resume"
  Bluetooth: btsdio: Do not bind to non-removable BCM43341
  HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working
  pipe: fix off-by-one error when checking buffer limits
  pipe: actually allow root to exceed the pipe buffer limits
  kernel/relay.c: revert "kernel/relay.c: fix potential memory leak"
  kernel/async.c: revert "async: simplify lowest_in_progress()"
  fs/proc/kcore.c: use probe_kernel_read() instead of memcpy()
  media: cxusb, dib0700: ignore XC2028_I2C_FLUSH
  media: ts2020: avoid integer overflows on 32 bit machines
  media: dvb-frontends: fix i2c access helpers for KASAN
  kasan: rework Kconfig settings
  kasan: don't emit builtin calls when sanitization is off
  Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all
  watchdog: imx2_wdt: restore previous timeout after suspend+resume
  ASoC: skl: Fix kernel warning due to zero NHTL entry
  ASoC: rockchip: i2s: fix playback after runtime resume
  KVM: PPC: Book3S PR: Fix broken select due to misspelling
  KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED
  KVM: PPC: Book3S HV: Drop locks before reading guest memory
  KVM: PPC: Book3S HV: Make sure we don't re-enter guest without XIVE loaded
  KVM: nVMX: Fix bug of injecting L2 exception into L1
  KVM: nVMX: Fix races when sending nested PI while dest enters/leaves L2
  arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
  crypto: sha512-mb - initialize pending lengths correctly
  crypto: caam - fix endless loop when DECO acquire fails
  media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs
  media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic
  media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors
  media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type
  media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32
  media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer
  media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32
  media: v4l2-compat-ioctl32.c: avoid sizeof(type)
  media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32
  media: v4l2-compat-ioctl32.c: fix the indentation
  media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF
  media: v4l2-ioctl.c: don't copy back the result for -ENOTTY
  media: v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt
  crypto: hash - prevent using keyed hashes without setting key
  crypto: hash - annotate algorithms taking optional key
  crypto: poly1305 - remove ->setkey() method
  crypto: mcryptd - pass through absence of ->setkey()
  crypto: cryptd - pass through absence of ->setkey()
  crypto: hash - introduce crypto_hash_alg_has_setkey()
  ahci: Add Intel Cannon Lake PCH-H PCI ID
  ahci: Add PCI ids for Intel Bay Trail, Cherry Trail and Apollo Lake AHCI
  ahci: Annotate PCI ids for mobile Intel chipsets as such
  kernfs: fix regression in kernfs_fop_write caused by wrong type
  NFS: Fix a race between mmap() and O_DIRECT
  NFS: reject request for id_legacy key without auxdata
  NFS: commit direct writes even if they fail partially
  NFS: Fix nfsstat breakage due to LOOKUPP
  NFS: Add a cond_resched() to nfs_commit_release_pages()
  nfs41: do not return ENOMEM on LAYOUTUNAVAILABLE
  nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds
  ubifs: free the encrypted symlink target
  ubi: block: Fix locking for idr_alloc/idr_remove
  ubi: fastmap: Erase outdated anchor PEBs during attach
  ubi: Fix race condition between ubi volume creation and udev
  mtd: nand: sunxi: Fix ECC strength choice
  mtd: nand: Fix nand_do_read_oob() return value
  mtd: nand: brcmnand: Disable prefetch by default
  mtd: cfi: convert inline functions to macros
  arm64: Kill PSCI_GET_VERSION as a variant-2 workaround
  arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support
  arm/arm64: smccc: Implement SMCCC v1.1 inline primitive
  arm/arm64: smccc: Make function identifiers an unsigned quantity
  firmware/psci: Expose SMCCC version through psci_ops
  firmware/psci: Expose PSCI conduit
  arm64: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling
  arm64: KVM: Report SMCCC_ARCH_WORKAROUND_1 BP hardening support
  arm/arm64: KVM: Turn kvm_psci_version into a static inline
  arm64: KVM: Make PSCI_VERSION a fast path
  arm/arm64: KVM: Advertise SMCCC v1.1
  arm/arm64: KVM: Implement PSCI 1.0 support
  arm/arm64: KVM: Add smccc accessors to PSCI code
  arm/arm64: KVM: Add PSCI_VERSION helper
  arm/arm64: KVM: Consolidate the PSCI include files
  arm64: KVM: Increment PC after handling an SMC trap
  arm64: Branch predictor hardening for Cavium ThunderX2
  arm64: Implement branch predictor hardening for Falkor
  arm64: Implement branch predictor hardening for affected Cortex-A CPUs
  arm64: cputype: Add missing MIDR values for Cortex-A72 and Cortex-A75
  arm64: entry: Apply BP hardening for suspicious interrupts from EL0
  arm64: entry: Apply BP hardening for high-priority synchronous exceptions
  arm64: KVM: Use per-CPU vector when BP hardening is enabled
  arm64: Move BP hardening to check_and_switch_context
  arm64: Add skeleton to harden the branch predictor against aliasing attacks
  arm64: Move post_ttbr_update_workaround to C code
  drivers/firmware: Expose psci_get_version through psci_ops structure
  arm64: cpufeature: Pass capability structure to ->enable callback
  arm64: Run enable method for errata work arounds on late CPUs
  arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early
  arm64: futex: Mask __user pointers prior to dereference
  arm64: uaccess: Mask __user pointers for __arch_{clear, copy_*}_user
  arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user
  arm64: uaccess: Prevent speculative use of the current addr_limit
  arm64: entry: Ensure branch through syscall table is bounded under speculation
  arm64: Use pointer masking to limit uaccess speculation
  arm64: Make USER_DS an inclusive limit
  arm64: Implement array_index_mask_nospec()
  arm64: barrier: Add CSDB macros to control data-value prediction
  arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives
  arm64: entry: Reword comment about post_ttbr_update_workaround
  arm64: Force KPTI to be disabled on Cavium ThunderX
  arm64: kpti: Add ->enable callback to remap swapper using nG mappings
  arm64: mm: Permit transitioning from Global to Non-Global without BBM
  arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0()
  arm64: Turn on KPTI only on CPUs that need it
  arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs
  arm64: kpti: Fix the interaction between ASID switching and software PAN
  arm64: mm: Introduce TTBR_ASID_MASK for getting at the ASID in the TTBR
  arm64: capabilities: Handle duplicate entries for a capability
  arm64: Take into account ID_AA64PFR0_EL1.CSV3
  arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry
  arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0
  arm64: use RET instruction for exiting the trampoline
  arm64: kaslr: Put kernel vectors address in separate data page
  arm64: entry: Add fake CPU feature for unmapping the kernel at EL0
  arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks
  arm64: cpu_errata: Add Kryo to Falkor 1003 errata
  arm64: erratum: Work around Falkor erratum #E1003 in trampoline code
  arm64: entry: Hook up entry trampoline to exception vectors
  arm64: entry: Explicitly pass exception level to kernel_ventry macro
  arm64: mm: Map entry trampoline into trampoline and kernel page tables
  arm64: entry: Add exception trampoline page for exceptions from EL0
  arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI
  arm64: mm: Add arm64_kernel_unmapped_at_el0 helper
  arm64: mm: Allocate ASIDs in pairs
  arm64: mm: Fix and re-enable ARM64_SW_TTBR0_PAN
  arm64: mm: Rename post_ttbr0_update_workaround
  arm64: mm: Remove pre_ttbr0_update_workaround for Falkor erratum #E1003
  arm64: mm: Move ASID from TTBR0 to TTBR1
  arm64: mm: Temporarily disable ARM64_SW_TTBR0_PAN
  arm64: mm: Use non-global mappings for kernel space
  arm64: move TASK_* definitions to <asm/processor.h>
  media: hdpvr: Fix an error handling path in hdpvr_probe()
  media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner
  media: dvb-usb-v2: lmedm04: Improve logic checking of warm start
  dccp: CVE-2017-8824: use-after-free in DCCP code
  drm/i915: Fix deadlock in i830_disable_pipe()
  drm/i915: Redo plane sanitation during readout
  drm/i915: Add .get_hw_state() method for planes
  sched/rt: Up the root domain ref count when passing it around via IPIs
  sched/rt: Use container_of() to get root domain in rto_push_irq_work_func()
  KVM MMU: check pending exception before injecting APF
  arm64: Add software workaround for Falkor erratum 1041
  arm64: Define cputype macros for Falkor CPU
  watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop
  sched/wait: Fix add_wait_queue() behavioral change
  dmaengine: dmatest: fix container_of member in dmatest_callback
  cpufreq: mediatek: add mediatek related projects into blacklist
  CIFS: zero sensitive data when freeing
  cifs: Fix autonegotiate security settings mismatch
  cifs: Fix missing put_xid in cifs_file_strict_mmap
  powerpc/pseries: include linux/types.h in asm/hvcall.h
  watchdog: indydog: Add dependency on SGI_HAS_INDYDOG
  ANDROID: Fixup 64/32-bit divide confusion for WALT configs

Conflicts:
	include/trace/events/sched.h
	kernel/sched/sched.h
	lib/ubsan.c
	lib/ubsan.h
	arch/arm64/configs/sdm855_defconfig
	arch/arm64/configs/sdm855-perf_defconfig

Change-Id: I034588046a45f3d8be0615bed40d2ddd334ebd74
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2018-02-21 16:33:21 -08:00
Andrey Ryabinin
2617e62c2f lib/ubsan: add type mismatch handler for new GCC/Clang
commit 42440c1f9911b4b7b8ba3dc4e90c1197bc561211 upstream.

UBSAN=y fails to build with new GCC/clang:

    arch/x86/kernel/head64.o: In function `sanitize_boot_params':
    arch/x86/include/asm/bootparam_utils.h:37: undefined reference to `__ubsan_handle_type_mismatch_v1'

because Clang and GCC 8 slightly changed ABI for 'type mismatch' errors.
Compiler now uses new __ubsan_handle_type_mismatch_v1() function with
slightly modified 'struct type_mismatch_data'.

Let's add new 'struct type_mismatch_data_common' which is independent from
compiler's layout of 'struct type_mismatch_data'.  And make
__ubsan_handle_type_mismatch[_v1]() functions transform compiler-dependent
type mismatch data to our internal representation.  This way, we can
support both old and new compilers with minimal amount of change.

Link: http://lkml.kernel.org/r/20180119152853.16806-1-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Sodagudi Prasad <psodagud@codeaurora.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-02-16 20:23:09 +01:00
Andrew Morton
5a5df77710 lib/ubsan.c: s/missaligned/misaligned/
commit b8fe1120b4ba342b4f156d24e952d6e686b20298 upstream.

A vist from the spelling fairy.

Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
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-02-16 20:23:09 +01:00
Andrey Ryabinin
6ccc50118f lib/ubsan: remove returns-nonnull-attribute checks
Similarly to type mismatch checks, new GCC 8.x and Clang also changed for
ABI for returns_nonnull checks.  While we can update our code to conform
the new ABI it's more reasonable to just remove it.  Because it's just
dead code, we don't have any single user of returns_nonnull attribute in
the whole kernel.

And AFAIU the advantage that this attribute could bring would be mitigated
by -fno-delete-null-pointer-checks cflag that we use to build the kernel.
So it's unlikely we will have a lot of returns_nonnull attribute in
future.

So let's just remove the code, it has no use.

Change-Id: I479d6f1355781017abdee33f5adf8fd3fdbe4304
[aryabinin@virtuozzo.com: fix warning]
  Link: http://lkml.kernel.org/r/20180122165711.11510-1-aryabinin@virtuozzo.com
Link: http://lkml.kernel.org/r/20180119152853.16806-2-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Sodagudi Prasad <psodagud@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: bac7a1fff7926fb9891a18fe33650884b0e13e41
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2018-02-07 06:44:09 -08:00
Andrey Ryabinin
0eaa11b6be lib/ubsan: add type mismatch handler for new GCC/Clang
UBSAN=y fails to build with new GCC/clang:

    arch/x86/kernel/head64.o: In function `sanitize_boot_params':
    arch/x86/include/asm/bootparam_utils.h:37: undefined reference to `__ubsan_handle_type_mismatch_v1'

because Clang and GCC 8 slightly changed ABI for 'type mismatch' errors.
Compiler now uses new __ubsan_handle_type_mismatch_v1() function with
slightly modified 'struct type_mismatch_data'.

Let's add new 'struct type_mismatch_data_common' which is independent from
compiler's layout of 'struct type_mismatch_data'.  And make
__ubsan_handle_type_mismatch[_v1]() functions transform compiler-dependent
type mismatch data to our internal representation.  This way, we can
support both old and new compilers with minimal amount of change.

Change-Id: I94df3107b7b4434305f1188aeadfa40fd0e3d072
Link: http://lkml.kernel.org/r/20180119152853.16806-1-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Sodagudi Prasad <psodagud@codeaurora.org>
Cc: <stable@vger.kernel.org>	[4.5+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 42440c1f9911b4b7b8ba3dc4e90c1197bc561211
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2018-02-07 06:42:00 -08:00
Andrew Morton
db124a989c lib/ubsan.c: s/missaligned/misaligned/
A vist from the spelling fairy.

Change-Id: I53e7310d4b5cd86f911c054da381834b9b97b75e
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: b8fe1120b4ba342b4f156d24e952d6e686b20298
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2018-02-07 06:40:03 -08:00
Nicolas Iooss
901d805c33 UBSAN: fix typo in format string
handle_object_size_mismatch() used %pk to format a kernel pointer with
pr_err().  This seemed to be a misspelling for %pK, but using this to
format a kernel pointer does not make much sence here.

Therefore use %p instead, like in handle_missaligned_access().

Link: http://lkml.kernel.org/r/20160730083010.11569-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-02 17:31:41 -04:00
Andrey Ryabinin
c6d308534a UBSAN: run-time undefined behavior sanity checker
UBSAN uses compile-time instrumentation to catch undefined behavior
(UB).  Compiler inserts code that perform certain kinds of checks before
operations that could cause UB.  If check fails (i.e.  UB detected)
__ubsan_handle_* function called to print error message.

So the most of the work is done by compiler.  This patch just implements
ubsan handlers printing errors.

GCC has this capability since 4.9.x [1] (see -fsanitize=undefined
option and its suboptions).
However GCC 5.x has more checkers implemented [2].
Article [3] has a bit more details about UBSAN in the GCC.

[1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html
[2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
[3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/

Issues which UBSAN has found thus far are:

Found bugs:

 * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix
   insufficient validation in nfnetlink_bind")

undefined shifts:

 * d48458d4a768 ("jbd2: use a better hash function for the revoke
   table")

 * 10632008b9e1 ("clockevents: Prevent shift out of bounds")

 * 'x << -1' shift in ext4 -
   http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com>

 * undefined rol32(0) -
   http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com>

 * undefined dirty_ratelimit calculation -
   http://lkml.kernel.org/r/<566594E2.3050306@odin.com>

 * undefined roundown_pow_of_two(0) -
   http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com>

 * [WONTFIX] undefined shift in __bpf_prog_run -
   http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com>

   WONTFIX here because it should be fixed in bpf program, not in kernel.

signed overflows:

 * 32a8df4e0b33f ("sched: Fix odd values in effective_load()
   calculations")

 * mul overflow in ntp -
   http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com>

 * incorrect conversion into rtc_time in rtc_time64_to_tm() -
   http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com>

 * unvalidated timespec in io_getevents() -
   http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com>

 * [NOTABUG] signed overflow in ktime_add_safe() -
   http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com>

[akpm@linux-foundation.org: fix unused local warning]
[akpm@linux-foundation.org: fix __int128 build woes]
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yury Gribov <y.gribov@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-20 17:09:18 -08:00