====================================================== WARNING: possible circular locking dependency detected 5.0.0 #4 Not tainted ------------------------------------------------------ syz-executor.0/4768 is trying to acquire lock: 0000000021ad8d42 (&sb->s_type->i_mutex_key#12){+.+.}, at: inode_lock include/linux/fs.h:757 [inline] 0000000021ad8d42 (&sb->s_type->i_mutex_key#12){+.+.}, at: shmem_fallocate+0x15a/0xc60 mm/shmem.c:2633 but task is already holding lock: 00000000e0fc3765 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0x66/0x4f0 drivers/staging/android/ashmem.c:448 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:925 [inline] __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 ashmem_mmap+0x55/0x520 drivers/staging/android/ashmem.c:361 call_mmap include/linux/fs.h:1868 [inline] mmap_region+0xc37/0x1760 mm/mmap.c:1786 do_mmap+0x8e2/0x1080 mm/mmap.c:1559 do_mmap_pgoff include/linux/mm.h:2379 [inline] vm_mmap_pgoff+0x1c5/0x230 mm/util.c:350 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1609 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (&mm->mmap_sem){++++}: down_read+0x3b/0x90 kernel/locking/rwsem.c:24 do_user_addr_fault arch/x86/mm/fault.c:1426 [inline] __do_page_fault+0x9c2/0xd60 arch/x86/mm/fault.c:1541 do_page_fault+0x71/0x581 arch/x86/mm/fault.c:1572 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1143 fault_in_pages_readable include/linux/pagemap.h:603 [inline] iov_iter_fault_in_readable+0x1ba/0x450 lib/iov_iter.c:425 generic_perform_write+0x195/0x530 mm/filemap.c:3198 __generic_file_write_iter+0x25e/0x630 mm/filemap.c:3333 generic_file_write_iter+0x360/0x610 mm/filemap.c:3361 call_write_iter include/linux/fs.h:1863 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x613/0x8e0 fs/read_write.c:487 vfs_write+0x20c/0x580 fs/read_write.c:549 ksys_write+0xea/0x1f0 fs/read_write.c:598 __do_sys_write fs/read_write.c:610 [inline] __se_sys_write fs/read_write.c:607 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:607 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&sb->s_type->i_mutex_key#12){+.+.}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3841 down_write+0x38/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:757 [inline] shmem_fallocate+0x15a/0xc60 mm/shmem.c:2633 ashmem_shrink_scan drivers/staging/android/ashmem.c:455 [inline] ashmem_shrink_scan+0x1d7/0x4f0 drivers/staging/android/ashmem.c:439 ashmem_ioctl+0x2f0/0x11a0 drivers/staging/android/ashmem.c:797 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#12 --> &mm->mmap_sem --> ashmem_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(&sb->s_type->i_mutex_key#12); *** DEADLOCK *** 1 lock held by syz-executor.0/4768: #0: 00000000e0fc3765 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0x66/0x4f0 drivers/staging/android/ashmem.c:448 kobject: 'loop3' (0000000028ccd313): kobject_uevent_env stack backtrace: CPU: 0 PID: 4768 Comm: syz-executor.0 Not tainted 5.0.0 #4 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1224 kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2350 [inline] __lock_acquire+0x2f00/0x4700 kernel/locking/lockdep.c:3338 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3841 down_write+0x38/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:757 [inline] shmem_fallocate+0x15a/0xc60 mm/shmem.c:2633 ashmem_shrink_scan drivers/staging/android/ashmem.c:455 [inline] ashmem_shrink_scan+0x1d7/0x4f0 drivers/staging/android/ashmem.c:439 ashmem_ioctl+0x2f0/0x11a0 drivers/staging/android/ashmem.c:797 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x457e29 Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f849a1dac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457e29 RDX: 0000000000000000 RSI: 000000000000770a RDI: 0000000000000003 RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f849a1db6d4 R13: 00000000004bf0a2 R14: 00000000004d0a40 R15: 00000000ffffffff kobject: 'loop3' (0000000028ccd313): kobject_uevent_env kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' kobject: 'loop2' (00000000db9f4fc1): kobject_uevent_env kobject: 'loop2' (00000000db9f4fc1): fill_kobj_path: path = '/devices/virtual/block/loop2' kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' kobject: 'loop2' (00000000db9f4fc1): kobject_uevent_env kobject: 'loop2' (00000000db9f4fc1): fill_kobj_path: path = '/devices/virtual/block/loop2' kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kauditd_printk_skb: 257 callbacks suppressed audit: type=1400 audit(1551683862.950:16065): avc: denied { map } for pid=4842 comm="syz-executor.1" path="/dev/ashmem" dev="devtmpfs" ino=17311 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=1 kobject: 'loop3' (0000000028ccd313): kobject_uevent_env kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' audit: type=1400 audit(1551683863.180:16066): avc: denied { map } for pid=4849 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' audit: type=1400 audit(1551683863.180:16067): avc: denied { map } for pid=4849 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' audit: type=1400 audit(1551683863.180:16068): avc: denied { map } for pid=4849 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop2' (00000000db9f4fc1): kobject_uevent_env kobject: 'loop2' (00000000db9f4fc1): fill_kobj_path: path = '/devices/virtual/block/loop2' audit: type=1400 audit(1551683863.180:16069): avc: denied { map } for pid=4849 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' audit: type=1400 audit(1551683863.210:16070): avc: denied { map } for pid=4849 comm="blkid" path="/etc/ld.so.cache" dev="sda1" ino=2503 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' audit: type=1400 audit(1551683863.210:16071): avc: denied { map } for pid=4849 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(1551683863.210:16072): avc: denied { map } for pid=4849 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(1551683863.260:16073): avc: denied { map } for pid=4849 comm="blkid" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: audit_backlog=65 > audit_backlog_limit=64 kobject: 'loop3' (0000000028ccd313): kobject_uevent_env kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' kobject: 'loop2' (00000000db9f4fc1): kobject_uevent_env kobject: 'loop2' (00000000db9f4fc1): fill_kobj_path: path = '/devices/virtual/block/loop2' kobject: 'loop3' (0000000028ccd313): kobject_uevent_env kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' kobject: 'loop3' (0000000028ccd313): kobject_uevent_env kobject: 'loop3' (0000000028ccd313): fill_kobj_path: path = '/devices/virtual/block/loop3' kobject: 'loop2' (00000000db9f4fc1): kobject_uevent_env kobject: 'loop2' (00000000db9f4fc1): fill_kobj_path: path = '/devices/virtual/block/loop2' kobject: 'loop1' (00000000e41f0f5c): kobject_uevent_env kobject: 'loop1' (00000000e41f0f5c): fill_kobj_path: path = '/devices/virtual/block/loop1' kauditd_printk_skb: 216 callbacks suppressed audit: type=1400 audit(1551683867.980:16282): avc: denied { map } for pid=4969 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop0' (0000000025c404e4): kobject_uevent_env kobject: 'loop0' (0000000025c404e4): fill_kobj_path: path = '/devices/virtual/block/loop0' audit: type=1400 audit(1551683868.010:16283): avc: denied { map } for pid=4969 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop4' (00000000a798f1a6): kobject_uevent_env kobject: 'loop4' (00000000a798f1a6): fill_kobj_path: path = '/devices/virtual/block/loop4' audit: type=1400 audit(1551683868.010:16284): avc: denied { map } for pid=4969 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(1551683868.030:16285): avc: denied { map } for pid=4969 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(1551683868.080:16286): avc: denied { map } for pid=4969 comm="blkid" path="/etc/ld.so.cache" dev="sda1" ino=2503 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(1551683868.090:16287): avc: denied { map } for pid=4969 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 kobject: 'loop5' (000000001ae3b3c7): kobject_uevent_env kobject: 'loop5' (000000001ae3b3c7): fill_kobj_path: path = '/devices/virtual/block/loop5' audit: type=1400 audit(1551683868.090:16288): avc: denied { map } for pid=4969 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1