audit: type=1400 audit(1569798755.443:36): avc: denied { map } for pid=6835 comm="syz-executor165" path="/root/syz-executor165292514" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(1569798755.443:37): avc: denied { map } for pid=6835 comm="syz-executor165" path="/dev/ashmem" dev="devtmpfs" ino=14795 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=1 ====================================================== WARNING: possible circular locking dependency detected 4.14.146 #0 Not tainted ------------------------------------------------------ syz-executor165/6835 is trying to acquire lock: (sb_writers#6){.+.+}, at: [] file_start_write include/linux/fs.h:2707 [inline] (sb_writers#6){.+.+}, at: [] vfs_fallocate+0x5d1/0x7a0 fs/open.c:318 but task is already holding lock: (ashmem_mutex){+.+.}, at: [] ashmem_shrink_scan+0x56/0x420 drivers/staging/android/ashmem.c:454 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (ashmem_mutex){+.+.}: lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3991 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 ashmem_mmap+0x55/0x490 drivers/staging/android/ashmem.c:369 call_mmap include/linux/fs.h:1782 [inline] mmap_region+0x852/0x1030 mm/mmap.c:1723 do_mmap+0x5b8/0xcd0 mm/mmap.c:1501 do_mmap_pgoff include/linux/mm.h:2178 [inline] vm_mmap_pgoff+0x17a/0x1d0 mm/util.c:333 SYSC_mmap_pgoff mm/mmap.c:1551 [inline] SyS_mmap_pgoff+0x3ca/0x520 mm/mmap.c:1509 SYSC_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #1 (&mm->mmap_sem){++++}: lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3991 __might_fault mm/memory.c:4584 [inline] __might_fault+0x143/0x1d0 mm/memory.c:4569 _copy_from_user+0x2c/0x110 lib/usercopy.c:10 copy_from_user include/linux/uaccess.h:147 [inline] setxattr+0x153/0x350 fs/xattr.c:438 path_setxattr+0x11f/0x140 fs/xattr.c:472 SYSC_lsetxattr fs/xattr.c:494 [inline] SyS_lsetxattr+0x38/0x50 fs/xattr.c:490 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (sb_writers#6){.+.+}: 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+0x16f/0x430 kernel/locking/lockdep.c:3991 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+0x1ae/0x2f0 fs/super.c:1363 file_start_write include/linux/fs.h:2707 [inline] vfs_fallocate+0x5d1/0x7a0 fs/open.c:318 ashmem_shrink_scan drivers/staging/android/ashmem.c:461 [inline] ashmem_shrink_scan+0x181/0x420 drivers/staging/android/ashmem.c:445 ashmem_ioctl+0x28f/0xf10 drivers/staging/android/ashmem.c:803 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 do_syscall_64+0x1e8/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#6 --> &mm->mmap_sem --> ashmem_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(sb_writers#6); *** DEADLOCK *** 1 lock held by syz-executor165/6835: #0: (ashmem_mutex){+.+.}, at: [] ashmem_shrink_scan+0x56/0x420 drivers/staging/android/ashmem.c:454 stack backtrace: CPU: 1 PID: 6835 Comm: syz-executor165 Not tainted 4.14.146 #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+0x138/0x197 lib/dump_stack.c:53 print_circular_bug.isra.0.cold+0x1cc/0x28f 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+0x16f/0x430 kernel/locking/lockdep.c:3991 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+0x1ae/0x2f0 fs/super.c:1363 file_start_write include/linux/fs.h:2707 [inline] vfs_fallocate+0x5d1/0x7a0 fs/open.c:318 ashmem_shrink_scan drivers/staging/android/ashmem.c:461 [inline] ashmem_shrink_scan+0x181/0x420 drivers/staging/android/ashmem.c:445 ashmem_ioctl+0x28f/0xf10 drivers/staging/android/ashmem.c:803 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x4401d9 RSP: 002b:00007ffd3a633e48 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401d9 RDX: 0000000000000000 RSI: 0000000000007