====================================================== [ INFO: possible circular locking dependency detected ] 4.9.203-syzkaller #0 Not tainted ------------------------------------------------------- syz-executor.4/11030 is trying to acquire lock: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<0000000057bb3979>] inode_lock include/linux/fs.h:771 [inline] (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<0000000057bb3979>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2683 but task is already holding lock: (ashmem_mutex){+.+.+.}, at: [<000000005cad8436>] ashmem_shrink_scan+0x56/0x4c0 drivers/staging/android/ashmem.c:455 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 __mutex_lock_common kernel/locking/mutex.c:521 [inline] mutex_lock_nested+0xc7/0x920 kernel/locking/mutex.c:621 ashmem_mmap+0x53/0x470 drivers/staging/android/ashmem.c:378 mmap_region+0x7e7/0xfa0 mm/mmap.c:1726 do_mmap+0x539/0xbc0 mm/mmap.c:1505 do_mmap_pgoff include/linux/mm.h:2066 [inline] vm_mmap_pgoff+0x179/0x1c0 mm/util.c:329 SYSC_mmap_pgoff mm/mmap.c:1555 [inline] SyS_mmap_pgoff+0xfa/0x1b0 mm/mmap.c:1513 SYSC_mmap arch/x86/kernel/sys_x86_64.c:96 [inline] SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:87 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 entry_SYSCALL_64_after_swapgs+0x5d/0xdb audit: type=1400 audit(1574772734.933:12213): avc: denied { set_context_mgr } for pid=11032 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 down_read+0x44/0xb0 kernel/locking/rwsem.c:22 __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337 do_page_fault+0x28/0x30 arch/x86/mm/fault.c:1464 page_fault+0x25/0x30 arch/x86/entry/entry_64.S:956 generic_perform_write+0x1b6/0x500 mm/filemap.c:2930 __generic_file_write_iter+0x340/0x530 mm/filemap.c:3065 generic_file_write_iter+0x38a/0x630 mm/filemap.c:3093 audit: type=1400 audit(1574772734.933:12214): avc: denied { call } for pid=11032 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder_alloc: 11032: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11032:11034 transaction failed 29201/-28, size 88-24 line 3284 new_sync_write fs/read_write.c:498 [inline] __vfs_write+0x3c1/0x560 fs/read_write.c:511 vfs_write+0x185/0x520 fs/read_write.c:559 SYSC_write fs/read_write.c:607 [inline] SyS_write+0x121/0x270 fs/read_write.c:599 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 entry_SYSCALL_64_after_swapgs+0x5d/0xdb check_prev_add kernel/locking/lockdep.c:1828 [inline] check_prevs_add kernel/locking/lockdep.c:1938 [inline] validate_chain kernel/locking/lockdep.c:2265 [inline] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345 lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 down_write+0x41/0xa0 kernel/locking/rwsem.c:52 inode_lock include/linux/fs.h:771 [inline] shmem_fallocate+0x143/0xab0 mm/shmem.c:2683 ashmem_shrink_scan drivers/staging/android/ashmem.c:462 [inline] ashmem_shrink_scan+0x1c3/0x4c0 drivers/staging/android/ashmem.c:446 ashmem_ioctl+0x29b/0xdd0 drivers/staging/android/ashmem.c:804 vfs_ioctl fs/ioctl.c:43 [inline] file_ioctl fs/ioctl.c:493 [inline] do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677 SYSC_ioctl fs/ioctl.c:694 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 entry_SYSCALL_64_after_swapgs+0x5d/0xdb other info that might help us debug this: Chain exists of: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ashmem_mutex); lock(&mm->mmap_sem); lock(ashmem_mutex); lock(&sb->s_type->i_mutex_key#10); *** DEADLOCK *** 1 lock held by syz-executor.4/11030: #0: (ashmem_mutex){+.+.+.}, at: [<000000005cad8436>] ashmem_shrink_scan+0x56/0x4c0 drivers/staging/android/ashmem.c:455 stack backtrace: CPU: 0 PID: 11030 Comm: syz-executor.4 Not tainted 4.9.203-syzkaller #0 ffff8801a4b7f6b8 ffffffff81b55f6b ffffffff83cb8000 ffffffff83ce1730 ffffffff83caf240 ffffffff8424ff40 ffff8801cf3297c0 ffff8801a4b7f710 ffffffff81406eaa ffff8801cf32a0b0 ffffffff8409d540 ffff8801cf32a098 Call Trace: [<000000005df2eb8c>] __dump_stack lib/dump_stack.c:15 [inline] [<000000005df2eb8c>] dump_stack+0xcb/0x130 lib/dump_stack.c:56 [<000000002cf0afe1>] print_circular_bug.cold+0x2f6/0x454 kernel/locking/lockdep.c:1202 [<00000000ec3029b5>] check_prev_add kernel/locking/lockdep.c:1828 [inline] [<00000000ec3029b5>] check_prevs_add kernel/locking/lockdep.c:1938 [inline] [<00000000ec3029b5>] validate_chain kernel/locking/lockdep.c:2265 [inline] [<00000000ec3029b5>] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345 [<000000003a537195>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 [<0000000097c96ae3>] down_write+0x41/0xa0 kernel/locking/rwsem.c:52 [<0000000057bb3979>] inode_lock include/linux/fs.h:771 [inline] [<0000000057bb3979>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2683 [<00000000e092ed0e>] ashmem_shrink_scan drivers/staging/android/ashmem.c:462 [inline] [<00000000e092ed0e>] ashmem_shrink_scan+0x1c3/0x4c0 drivers/staging/android/ashmem.c:446 [<00000000f918ed3d>] ashmem_ioctl+0x29b/0xdd0 drivers/staging/android/ashmem.c:804 [<000000004671ada3>] vfs_ioctl fs/ioctl.c:43 [inline] [<000000004671ada3>] file_ioctl fs/ioctl.c:493 [inline] [<000000004671ada3>] do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677 [<000000006b66ceaf>] SYSC_ioctl fs/ioctl.c:694 [inline] [<000000006b66ceaf>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 [<000000000cc584a6>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 [<0000000095e6e27f>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb binder: undelivered TRANSACTION_ERROR: 29201 binder: BINDER_SET_CONTEXT_MGR already set binder: 11032:11034 ioctl 40046207 0 returned -16 binder: 11043:11055 Acquire 1 refcount change on invalid ref 0 ret -22 binder: 11043:11055 transaction failed 29189/-22, size 88-24 line 3138 binder: 11042:11053 ioctl 40087602 200001c0 returned -22 audit: type=1400 audit(1574772736.253:12215): avc: denied { set_context_mgr } for pid=11064 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772736.393:12216): avc: denied { set_context_mgr } for pid=11072 comm="syz-executor.2" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772736.523:12217): avc: denied { set_context_mgr } for pid=11075 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder: undelivered TRANSACTION_ERROR: 29189 audit: type=1400 audit(1574772736.593:12218): avc: denied { set_context_mgr } for pid=11079 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder_alloc: 11079: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11079:11089 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 binder_alloc: 11091: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11091:11093 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 audit_printk_skb: 27 callbacks suppressed audit: type=1400 audit(1574772740.503:12228): avc: denied { create } for pid=11101 comm="syz-executor.0" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 audit: type=1400 audit(1574772740.533:12229): avc: denied { write } for pid=11101 comm="syz-executor.0" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 audit: type=1400 audit(1574772740.573:12230): avc: denied { read } for pid=11101 comm="syz-executor.0" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 audit: type=1400 audit(1574772742.973:12231): avc: denied { set_context_mgr } for pid=11347 comm="syz-executor.2" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772743.013:12233): avc: denied { set_context_mgr } for pid=11346 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772743.013:12232): avc: denied { set_context_mgr } for pid=11344 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772743.053:12234): avc: denied { call } for pid=11346 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder_alloc: 11346: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11346:11350 transaction failed 29201/-28, size 88-24 line 3284 audit: type=1400 audit(1574772743.073:12235): avc: denied { call } for pid=11344 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder_alloc: 11344: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11344:11352 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 binder: undelivered TRANSACTION_ERROR: 29201 audit: type=1400 audit(1574772743.433:12236): avc: denied { set_context_mgr } for pid=11371 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 audit: type=1400 audit(1574772743.503:12237): avc: denied { call } for pid=11371 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=1 binder_alloc: 11371: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11371:11375 transaction failed 29201/-28, size 88-24 line 3284 binder_alloc: 11378: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11378:11380 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 binder: undelivered TRANSACTION_ERROR: 29201 binder_alloc: 11388: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11388:11391 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 binder_alloc: 11405: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288) binder: 11405:11414 transaction failed 29201/-28, size 88-24 line 3284 binder: undelivered TRANSACTION_ERROR: 29201 binder_alloc: 11422: binder_alloc_buf size -1812758625678173936 failed, no address space binder_alloc: allocated: 0 (num: 0 largest: 0), free: 12288 (num: 1 largest: 12288)