[ INFO: possible circular locking dependency detected ] 4.9.202+ #0 Not tainted ------------------------------------------------------- syz-executor.3/32525 is trying to acquire lock: (&mm->mmap_sem){++++++}, at: [<00000000c533fd78>] __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337 but task is already holding lock: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<000000003c2364e5>] inode_lock include/linux/fs.h:771 [inline] (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<000000003c2364e5>] generic_file_write_iter+0x9a/0x630 mm/filemap.c:3090 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sb->s_type->i_mutex_key#10){+.+.+.}: 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 -> #1 (ashmem_mutex){+.+.+.}: 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 -> #0 (&mm->mmap_sem){++++++}: 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_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 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_pwrite64 fs/read_write.c:649 [inline] SyS_pwrite64+0x13f/0x170 fs/read_write.c:636 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: &mm->mmap_sem --> ashmem_mutex --> &sb->s_type->i_mutex_key#10 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#10); lock(ashmem_mutex); lock(&sb->s_type->i_mutex_key#10); lock(&mm->mmap_sem); *** DEADLOCK *** 2 locks held by syz-executor.3/32525: #0: (sb_writers#6){.+.+.+}, at: [<00000000f001684a>] file_start_write include/linux/fs.h:2645 [inline] #0: (sb_writers#6){.+.+.+}, at: [<00000000f001684a>] vfs_write+0x3e9/0x520 fs/read_write.c:558 #1: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<000000003c2364e5>] inode_lock include/linux/fs.h:771 [inline] #1: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<000000003c2364e5>] generic_file_write_iter+0x9a/0x630 mm/filemap.c:3090 stack backtrace: CPU: 0 PID: 32525 Comm: syz-executor.3 Not tainted 4.9.202+ #0 ffff8801c4a275e8 ffffffff81b55d2b ffffffff83cae9d0 ffffffff83cb7e50 ffffffff83cf32b0 ffffffff8424ff40 ffff8801cde4df00 ffff8801c4a27640 ffffffff81406d6a ffff8801c67c4740 ffffffff84081940 ffff8801cde4e800 Call Trace: [<00000000093c280b>] __dump_stack lib/dump_stack.c:15 [inline] [<00000000093c280b>] dump_stack+0xcb/0x130 lib/dump_stack.c:56 [<0000000043116e57>] print_circular_bug.cold+0x2f6/0x454 kernel/locking/lockdep.c:1202 [<000000003e0cfd00>] check_prev_add kernel/locking/lockdep.c:1828 [inline] [<000000003e0cfd00>] check_prevs_add kernel/locking/lockdep.c:1938 [inline] [<000000003e0cfd00>] validate_chain kernel/locking/lockdep.c:2265 [inline] [<000000003e0cfd00>] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345 [<000000006386f0a3>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 [<000000007995f1d4>] down_read+0x44/0xb0 kernel/locking/rwsem.c:22 [<00000000c533fd78>] __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337 [<00000000db9a5a1d>] do_page_fault+0x28/0x30 arch/x86/mm/fault.c:1464 [<00000000a209f16a>] page_fault+0x25/0x30 arch/x86/entry/entry_64.S:956 [<00000000bd8cc9d1>] generic_perform_write+0x1b6/0x500 mm/filemap.c:2930 [<00000000e0fcc623>] __generic_file_write_iter+0x340/0x530 mm/filemap.c:3065 [<000000006745b409>] generic_file_write_iter+0x38a/0x630 mm/filemap.c:3093 [<00000000b571239e>] new_sync_write fs/read_write.c:498 [inline] [<00000000b571239e>] __vfs_write+0x3c1/0x560 fs/read_write.c:511 [<00000000481bbef2>] vfs_write+0x185/0x520 fs/read_write.c:559 [<000000003e13d5bc>] SYSC_pwrite64 fs/read_write.c:649 [inline] [<000000003e13d5bc>] SyS_pwrite64+0x13f/0x170 fs/read_write.c:636 [<00000000224b4e20>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 [<00000000245f8c38>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb input input1064: cannot allocate more than FF_MAX_EFFECTS effects input input1065: cannot allocate more than FF_MAX_EFFECTS effects input input1067: cannot allocate more than FF_MAX_EFFECTS effects input input1068: cannot allocate more than FF_MAX_EFFECTS effects input input1071: cannot allocate more than FF_MAX_EFFECTS effects input input1072: cannot allocate more than FF_MAX_EFFECTS effects uinput: write device info first input input1076: cannot allocate more than FF_MAX_EFFECTS effects input input1077: cannot allocate more than FF_MAX_EFFECTS effects input input1078: cannot allocate more than FF_MAX_EFFECTS effects audit_printk_skb: 6 callbacks suppressed audit: type=1400 audit(1574474697.019:1790): avc: denied { create } for pid=32703 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=netlink_generic_socket permissive=1 audit: type=1400 audit(1574474697.139:1791): avc: denied { write } for pid=32703 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=netlink_generic_socket permissive=1 input input1079: cannot allocate more than FF_MAX_EFFECTS effects audit: type=1400 audit(1574474697.349:1792): avc: denied { read } for pid=32703 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=netlink_generic_socket permissive=1 audit: type=1400 audit(1574474697.469:1793): avc: denied { create } for pid=32703 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=netlink_generic_socket permissive=1 input input1080: cannot allocate more than FF_MAX_EFFECTS effects input input1081: cannot allocate more than FF_MAX_EFFECTS effects input input1083: cannot allocate more than FF_MAX_EFFECTS effects uinput: write device info first input input1085: cannot allocate more than FF_MAX_EFFECTS effects input input1087: cannot allocate more than FF_MAX_EFFECTS effects input input1089: cannot allocate more than FF_MAX_EFFECTS effects audit: type=1400 audit(1574474698.979:1794): avc: denied { create } for pid=368 comm="syz-executor.1" 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(1574474699.129:1795): avc: denied { write } for pid=368 comm="syz-executor.1" 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 input input1090: cannot allocate more than FF_MAX_EFFECTS effects audit: type=1400 audit(1574474699.329:1796): avc: denied { create } for pid=386 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(1574474699.329:1797): avc: denied { write } for pid=386 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(1574474699.459:1798): avc: denied { read } for pid=386 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(1574474699.629:1799): avc: denied { read } for pid=368 comm="syz-executor.1" 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 input input1091: cannot allocate more than FF_MAX_EFFECTS effects input input1092: cannot allocate more than FF_MAX_EFFECTS effects input input1094: cannot allocate more than FF_MAX_EFFECTS effects input input1093: cannot allocate more than FF_MAX_EFFECTS effects input input1096: cannot allocate more than FF_MAX_EFFECTS effects input input1098: cannot allocate more than FF_MAX_EFFECTS effects input input1099: cannot allocate more than FF_MAX_EFFECTS effects