7 Commits

Author SHA1 Message Date
Nathan Chancellor
4747b04527 Merge 4.9.209 into android-msm-bluecross-4.9
Changes in 4.9.209: (90 commits)
        PM / devfreq: Don't fail devfreq_dev_release if not in list
        RDMA/cma: add missed unregister_pernet_subsys in init failure
        scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
        scsi: qla2xxx: Don't call qlt_async_event twice
        scsi: iscsi: qla4xxx: fix double free in probe
        scsi: libsas: stop discovering if oob mode is disconnected
        usb: gadget: fix wrong endpoint desc
        md: raid1: check rdev before reference in raid1_sync_request func
        s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
        s390/cpum_sf: Avoid SBD overflow condition in irq handler
        IB/mlx4: Follow mirror sequence of device add during device removal
        xen-blkback: prevent premature module unload
        xen/balloon: fix ballooned page accounting without hotplug enabled
        PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
        xfs: fix mount failure crash on invalid iclog memory access
        taskstats: fix data-race
        drm: limit to INT_MAX in create_blob ioctl
        Revert "perf report: Add warning when libunwind not compiled in"
        ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
        MIPS: Avoid VDSO ABI breakage due to global register variable
        mm/zsmalloc.c: fix the migrated zspage statistics.
        memcg: account security cred as well to kmemcg
        locks: print unsigned ino in /proc/locks
        dmaengine: Fix access to uninitialized dma_slave_caps
        compat_ioctl: block: handle Persistent Reservations
        ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
        ata: ahci_brcm: Allow optional reset controller to be used
        ata: ahci_brcm: Fix AHCI resources management
        gpiolib: fix up emulated open drain outputs
        tracing: Have the histogram compare functions convert to u64 first
        ALSA: cs4236: fix error return comparison of an unsigned integer
        ftrace: Avoid potential division by zero in function profiler
        arm64: Revert support for execute-only user mappings
        PM / devfreq: Check NULL governor in available_governors_show
        nfsd4: fix up replay_matches_cache()
        xfs: don't check for AG deadlock for realtime files in bunmapi
        Bluetooth: btusb: fix PM leak in error case of setup
        Bluetooth: delete a stray unlock
        Bluetooth: Fix memory leak in hci_connect_le_scan
        media: flexcop-usb: ensure -EIO is returned on error condition
        regulator: ab8500: Remove AB8505 USB regulator
        media: usb: fix memory leak in af9005_identify_state
        tty: serial: msm_serial: Fix lockup for sysrq and oops
        fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
        drm/mst: Fix MST sideband up-reply failure handling
        powerpc/pseries/hvconsole: Fix stack overread via udbg
        rxrpc: Fix possible NULL pointer access in ICMP handling
        ath9k_htc: Modify byte order for an error message
        ath9k_htc: Discard undersized packets
        net: add annotations on hh->hh_len lockless accesses
        s390/smp: fix physical to logical CPU map for SMT
        xen/blkback: Avoid unmapping unmapped grant pages
        locking/x86: Remove the unused atomic_inc_short() methd
        pstore/ram: Write new dumps to start of recycled zones
        locking/spinlock/debug: Fix various data races
        netfilter: ctnetlink: netns exit must wait for callbacks
        efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs
        efi/gop: Return EFI_SUCCESS if a usable GOP was found
        efi/gop: Fix memory leak in __gop_query32/64()
        ARM: vexpress: Set-up shared OPP table instead of individual for each CPU
        netfilter: uapi: Avoid undefined left-shift in xt_sctp.h
        spi: spi-cavium-thunderx: Add missing pci_release_regions()
        ARM: dts: am437x-gp/epos-evm: fix panel compatible
        samples: bpf: Replace symbol compare of trace_event
        powerpc: Ensure that swiotlb buffer is allocated from low memory
        bnx2x: Do not handle requests from VFs after parity
        bnx2x: Fix logic to get total no. of PFs per engine
        net: usb: lan78xx: Fix error message format specifier
        rfkill: Fix incorrect check to avoid NULL pointer dereference
        ASoC: wm8962: fix lambda value
        regulator: rn5t618: fix module aliases
        kconfig: don't crash on NULL expressions in expr_eq()
        perf/x86/intel: Fix PT PMI handling
        net: stmmac: RX buffer size must be 16 byte aligned
        block: fix memleak when __blk_rq_map_user_iov() is failed
        parisc: Fix compiler warnings in debug_core.c
        llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)
        macvlan: do not assume mac_header is set in macvlan_broadcast()
        net: stmmac: dwmac-sunxi: Allow all RGMII modes
        net: usb: lan78xx: fix possible skb leak
        pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
        sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY
        tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK
        vxlan: fix tos value before xmit
        vlan: vlan_changelink() should propagate errors
        net: sch_prio: When ungrafting, replace with FIFO
        vlan: fix memory leak in vlan_dev_set_egress_priority
        USB: core: fix check for duplicate endpoints
        USB: serial: option: add Telit ME910G1 0x110a composition
        Linux 4.9.209

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Conflicts:
	arch/arm64/mm/fault.c
	drivers/gpu/drm/drm_property.c
	kernel/locking/spinlock_debug.c
2020-01-12 11:10:25 -07:00
Marco Elver
3106fb78d3 locking/spinlock/debug: Fix various data races
[ Upstream commit 1a365e822372ba24c9da0822bc583894f6f3d821 ]

This fixes various data races in spinlock_debug. By testing with KCSAN,
it is observable that the console gets spammed with data races reports,
suggesting these are extremely frequent.

Example data race report:

  read to 0xffff8ab24f403c48 of 4 bytes by task 221 on cpu 2:
   debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline]
   do_raw_spin_lock+0x9b/0x210 kernel/locking/spinlock_debug.c:112
   __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
   _raw_spin_lock+0x39/0x40 kernel/locking/spinlock.c:151
   spin_lock include/linux/spinlock.h:338 [inline]
   get_partial_node.isra.0.part.0+0x32/0x2f0 mm/slub.c:1873
   get_partial_node mm/slub.c:1870 [inline]
  <snip>

  write to 0xffff8ab24f403c48 of 4 bytes by task 167 on cpu 3:
   debug_spin_unlock kernel/locking/spinlock_debug.c:103 [inline]
   do_raw_spin_unlock+0xc9/0x1a0 kernel/locking/spinlock_debug.c:138
   __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:159 [inline]
   _raw_spin_unlock_irqrestore+0x2d/0x50 kernel/locking/spinlock.c:191
   spin_unlock_irqrestore include/linux/spinlock.h:393 [inline]
   free_debug_processing+0x1b3/0x210 mm/slub.c:1214
   __slab_free+0x292/0x400 mm/slub.c:2864
  <snip>

As a side-effect, with KCSAN, this eventually locks up the console, most
likely due to deadlock, e.g. .. -> printk lock -> spinlock_debug ->
KCSAN detects data race -> kcsan_print_report() -> printk lock ->
deadlock.

This fix will 1) avoid the data races, and 2) allow using lock debugging
together with KCSAN.

Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Marco Elver <elver@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Link: https://lkml.kernel.org/r/20191120155715.28089-1-elver@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 11:22:46 +01:00
Prasad Sodagudi
805c18d71c lib: spinlock: Trigger a watchdog bite on spin_dump for rwlock
Currently dump_stack is printed once a spin_bug is detected for rwlock.
So provide an options to trigger a panic or watchdog bite for debugging
rwlock magic corruptions and lockups.

Change-Id: I20807e8eceb8b81635e58701d1f9f9bd36ab5877
[abhimany: replace msm with qcom]
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-03-22 11:16:32 -07:00
Rohit Vaswani
77d758e283 lib: spinlock: Cause a watchdog bite on spin_dump
Currently we cause a BUG_ON once a spin_bug is detected, but
that causes a whole lot of processing and the other CPUs would
have proceeded to perform other actions and the state of the system
is moved by the time we can analyze it.
Provide an option to trigger  a watchdog bite instead so that we
can get the traces as close to the issue as possible.

Change-Id: Ic8d692ebd02c6940a3b4e5798463744db20b0026
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2016-03-22 11:16:31 -07:00
Rohit Vaswani
a543061653 lib: spinlock_debug: Prevent continuous spin dump logs on panic
Once a spinlock lockup is detected on a CPU, we invoke a Kernel Panic.
During the panic handling, we might see more instances of spinlock
lockup from other CPUs. This causes the dmesg to be cluttered and makes
it cumbersome to detect what exactly happened.
Call spin_bug instead of calling spin_dump directly.

Change-Id: I57857a991345a8dac3cd952463d05129145867a8
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2016-03-22 11:16:30 -07:00
Syed Rameez Mustafa
e2cddd1040 kernel/lib: add additional debug capabilites for data corruption
Data corruptions in the kernel often end up in system crashes that
are easier to debug closer to the time of detection. Specifically,
if we do not panic immediately after lock or list corruptions have been
detected, the problem context is lost in the ensuing system mayhem.
Add support for allowing system crash immediately after such corruptions
are detected. The CONFIG option controls the enabling/disabling of the
feature.

Change-Id: I9b2eb62da506a13007acff63e85e9515145909ff
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
[abhimany: minor merge conflict resolution]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2016-03-22 11:16:29 -07:00
Peter Zijlstra
60fc28746a locking: Move the spinlock code to kernel/locking/
Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-b81ol0z3mon45m51o131yc9j@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-11-06 07:55:21 +01:00