====================================================== WARNING: possible circular locking dependency detected 4.14.175-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor401/6353 is trying to acquire lock: (sb_writers#8){.+.+}, at: [] file_start_write include/linux/fs.h:2708 [inline] (sb_writers#8){.+.+}, at: [] vfs_fallocate+0x5c1/0x790 fs/open.c:318 but task is already holding lock: (ashmem_mutex){+.+.}, at: [] ashmem_shrink_scan+0x53/0x430 drivers/staging/android/ashmem.c:482 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (ashmem_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893 ashmem_mmap+0x50/0x570 drivers/staging/android/ashmem.c:384 call_mmap include/linux/fs.h:1783 [inline] mmap_region+0x869/0x1030 mm/mmap.c:1717 do_mmap+0x5c1/0xcf0 mm/mmap.c:1495 do_mmap_pgoff include/linux/mm.h:2173 [inline] vm_mmap_pgoff+0x14e/0x1a0 mm/util.c:333 SYSC_mmap_pgoff mm/mmap.c:1545 [inline] SyS_mmap_pgoff+0x3d2/0x520 mm/mmap.c:1503 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #1 (&mm->mmap_sem){++++}: __might_fault mm/memory.c:4584 [inline] __might_fault+0x137/0x1b0 mm/memory.c:4569 _copy_from_user+0x27/0x100 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] setxattr+0x136/0x300 fs/xattr.c:438 path_setxattr+0x118/0x130 fs/xattr.c:472 SYSC_lsetxattr fs/xattr.c:494 [inline] SyS_lsetxattr+0x33/0x40 fs/xattr.c:490 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (sb_writers#8){.+.+}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] percpu_down_read include/linux/percpu-rwsem.h:59 [inline] __sb_start_write+0x1a1/0x2e0 fs/super.c:1363 file_start_write include/linux/fs.h:2708 [inline] vfs_fallocate+0x5c1/0x790 fs/open.c:318 ashmem_shrink_scan drivers/staging/android/ashmem.c:489 [inline] ashmem_shrink_scan+0x181/0x430 drivers/staging/android/ashmem.c:473 ashmem_ioctl+0x28a/0xe50 drivers/staging/android/ashmem.c:831 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 other info that might help us debug this: Chain exists of: sb_writers#8 --> &mm->mmap_sem --> ashmem_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(sb_writers#8); *** DEADLOCK *** 1 lock held by syz-executor401/6353: #0: (ashmem_mutex){+.+.}, at: [] ashmem_shrink_scan+0x53/0x430 drivers/staging/android/ashmem.c:482 stack backtrace: CPU: 0 PID: 6353 Comm: syz-executor401 Not tainted 4.14.175-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x13e/0x194 lib/dump_stack.c:58 print_circular_bug.isra.0.cold+0x1c4/0x282 kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1901 [inline] check_prevs_add kernel/locking/lockdep.c:2018 [inline] validate_chain kernel/locking/lockdep.c:2460 [inline] __lock_acquire+0x2cb3/0x4620 kernel/locking/lockdep.c:3487 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] percpu_down_read include/linux/percpu-rwsem.h:59 [inline] __sb_start_write+0x1a1/0x2e0 fs/super.c:1363 file_start_write include/linux/fs.h:2708 [inline] vfs_fallocate+0x5c1/0x790 fs/open.c:318 ashmem_shrink_scan drivers/staging/android/ashmem.c:489 [inline] ashmem_shrink_scan+0x181/0x430 drivers/staging/android/ashmem.c:473 ashmem_ioctl+0x28a/0xe50 drivers/staging/android/ashmem.c:831 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x4401c9 RSP: 002b:000