====================================================== [ INFO: possible circular locking dependency detected ] 4.9.203-syzkaller #0 Not tainted ------------------------------------------------------- syz-executor.4/27491 is trying to acquire lock: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000df435f33>] inode_lock include/linux/fs.h:771 [inline] (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000df435f33>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2683 but task is already holding lock: (ashmem_mutex){+.+.+.}, at: [<000000006e77e448>] 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 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_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/27491: #0: (ashmem_mutex){+.+.+.}, at: [<000000006e77e448>] ashmem_shrink_scan+0x56/0x4c0 drivers/staging/android/ashmem.c:455 stack backtrace: CPU: 1 PID: 27491 Comm: syz-executor.4 Not tainted 4.9.203-syzkaller #0 ffff8801a05ef6b8 ffffffff81b55f6b ffffffff83cb8000 ffffffff83cf68b0 ffffffff83caeb80 ffffffff8424ff40 ffff8801c77f4740 ffff8801a05ef710 ffffffff81406eaa ffffffff81bbc5cc ffffffff84074bc0 ffff8801c77f5018 Call Trace: [<0000000095bba165>] __dump_stack lib/dump_stack.c:15 [inline] [<0000000095bba165>] dump_stack+0xcb/0x130 lib/dump_stack.c:56 [<00000000e0380681>] print_circular_bug.cold+0x2f6/0x454 kernel/locking/lockdep.c:1202 [<00000000bb39c3b0>] check_prev_add kernel/locking/lockdep.c:1828 [inline] [<00000000bb39c3b0>] check_prevs_add kernel/locking/lockdep.c:1938 [inline] [<00000000bb39c3b0>] validate_chain kernel/locking/lockdep.c:2265 [inline] [<00000000bb39c3b0>] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345 audit: type=1400 audit(791.637:2015): avc: denied { create } for pid=27499 comm="syz-executor.3" 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(791.637:2016): avc: denied { write } for pid=27499 comm="syz-executor.3" 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 [<00000000c71fba29>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3759 [<0000000021a09c35>] down_write+0x41/0xa0 kernel/locking/rwsem.c:52 [<00000000df435f33>] inode_lock include/linux/fs.h:771 [inline] [<00000000df435f33>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2683 [<000000001c4d2d5d>] ashmem_shrink_scan drivers/staging/android/ashmem.c:462 [inline] [<000000001c4d2d5d>] ashmem_shrink_scan+0x1c3/0x4c0 drivers/staging/android/ashmem.c:446 [<000000002dcaa20d>] ashmem_ioctl+0x29b/0xdd0 drivers/staging/android/ashmem.c:804 [<0000000069b9d1a5>] vfs_ioctl fs/ioctl.c:43 [inline] [<0000000069b9d1a5>] file_ioctl fs/ioctl.c:493 [inline] [<0000000069b9d1a5>] do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677 [<00000000dc0ea8f8>] SYSC_ioctl fs/ioctl.c:694 [inline] [<00000000dc0ea8f8>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 [<0000000098823676>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 [<00000000ed6002f5>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb audit: type=1400 audit(792.517:2017): avc: denied { read } for pid=27499 comm="syz-executor.3" 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(792.527:2018): avc: denied { create } for pid=27507 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(792.537:2019): avc: denied { write } for pid=27507 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_printk_skb: 15 callbacks suppressed audit: type=1400 audit(794.377:2025): avc: denied { create } for pid=27546 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(794.397:2026): avc: denied { create } for pid=27543 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=netlink_generic_socket permissive=1 audit: type=1400 audit(794.397:2027): avc: denied { write } for pid=27543 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=netlink_generic_socket permissive=1 audit: type=1400 audit(794.417:2028): avc: denied { create } for pid=27544 comm="syz-executor.3" 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(794.427:2029): avc: denied { write } for pid=27544 comm="syz-executor.3" 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 : renamed from ip_vti0 audit: type=1400 audit(794.677:2030): avc: denied { read } for pid=27543 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=netlink_generic_socket permissive=1 audit: type=1400 audit(794.687:2031): avc: denied { read } for pid=27544 comm="syz-executor.3" 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 netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'. audit: type=1400 audit(795.337:2032): avc: denied { create } for pid=27568 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=netlink_generic_socket permissive=1 audit: type=1400 audit(795.347:2033): avc: denied { write } for pid=27568 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=netlink_generic_socket permissive=1 audit: type=1400 audit(795.607:2034): avc: denied { read } for pid=27568 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=netlink_generic_socket permissive=1 : renamed from ip_vti0 audit_printk_skb: 96 callbacks suppressed audit: type=1400 audit(799.527:2067): avc: denied { create } for pid=27690 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=netlink_generic_socket permissive=1 audit: type=1400 audit(799.627:2068): avc: denied { write } for pid=27690 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=netlink_generic_socket permissive=1 audit: type=1400 audit(799.957:2069): avc: denied { create } for pid=27697 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(800.047:2070): avc: denied { read } for pid=27690 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=netlink_generic_socket permissive=1 audit: type=1400 audit(800.117:2071): avc: denied { create } for pid=27703 comm="syz-executor.3" 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(800.127:2072): avc: denied { write } for pid=27703 comm="syz-executor.3" 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 : renamed from ip_vti0 audit: type=1400 audit(800.347:2073): avc: denied { read } for pid=27703 comm="syz-executor.3" 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(800.667:2074): avc: denied { create } for pid=27713 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=netlink_generic_socket permissive=1 audit: type=1400 audit(800.707:2075): avc: denied { create } for pid=27715 comm="syz-executor.3" 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(800.707:2076): avc: denied { write } for pid=27715 comm="syz-executor.3" 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