====================================================== [ INFO: possible circular locking dependency detected ] 4.9.144+ #77 Not tainted ------------------------------------------------------- syz-executor286/2456 is trying to acquire lock: (&mm->mmap_sem){++++++}, at: [] __do_page_fault+0x7db/0xa60 arch/x86/mm/fault.c:1342 but task is already holding lock: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [] inode_lock include/linux/fs.h:768 [inline] (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [] generic_file_write_iter+0x9d/0x620 mm/filemap.c:2903 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756 down_write+0x41/0xa0 kernel/locking/rwsem.c:52 inode_lock include/linux/fs.h:768 [inline] shmem_fallocate+0x13c/0xb10 mm/shmem.c:2681 ashmem_shrink_scan+0x1b9/0x4c0 drivers/staging/android/ashmem.c:462 ashmem_ioctl+0x2c3/0xf00 drivers/staging/android/ashmem.c:804 vfs_ioctl fs/ioctl.c:43 [inline] file_ioctl fs/ioctl.c:493 [inline] do_vfs_ioctl+0x1ac/0x11a0 fs/ioctl.c:677 SYSC_ioctl fs/ioctl.c:694 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285 entry_SYSCALL_64_after_swapgs+0x5d/0xdb lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756 __mutex_lock_common kernel/locking/mutex.c:521 [inline] mutex_lock_nested+0xc0/0x900 kernel/locking/mutex.c:621 ashmem_mmap+0x55/0x480 drivers/staging/android/ashmem.c:378 mmap_region+0x80c/0xf90 mm/mmap.c:1726 do_mmap+0x53d/0xbb0 mm/mmap.c:1505 do_mmap_pgoff include/linux/mm.h:2032 [inline] vm_mmap_pgoff+0x168/0x1b0 mm/util.c:329 SYSC_mmap_pgoff mm/mmap.c:1555 [inline] SyS_mmap_pgoff+0xfe/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+0x19f/0x550 arch/x86/entry/common.c:285 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+0x3189/0x4a10 kernel/locking/lockdep.c:3345 lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756 down_read+0x44/0xb0 kernel/locking/rwsem.c:22 __do_page_fault+0x7db/0xa60 arch/x86/mm/fault.c:1342 do_page_fault+0x27/0x30 arch/x86/mm/fault.c:1469 page_fault+0x25/0x30 arch/x86/entry/entry_64.S:951 generic_perform_write+0x1c7/0x500 mm/filemap.c:2743 __generic_file_write_iter+0x352/0x540 mm/filemap.c:2878 generic_file_write_iter+0x37a/0x620 mm/filemap.c:2906 new_sync_write fs/read_write.c:496 [inline] __vfs_write+0x3d7/0x580 fs/read_write.c:509 vfs_write+0x187/0x520 fs/read_write.c:557 SYSC_write fs/read_write.c:604 [inline] SyS_write+0xd9/0x1c0 fs/read_write.c:596 do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285 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(&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-executor286/2456: #0: (sb_writers#6){.+.+.+}, at: [] file_start_write include/linux/fs.h:2642 [inline] #0: (sb_writers#6){.+.+.+}, at: [] vfs_write+0x3eb/0x520 fs/read_write.c:556 #1: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [] inode_lock include/linux/fs.h:768 [inline] #1: (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [] generic_file_write_iter+0x9d/0x620 mm/filemap.c:2903 stack backtrace: CPU: 1 PID: 2456 Comm: syz-executor286 Not tainted 4.9.144+ #77 ffff8801ce02f548 ffffffff81b43b89 ffffffff83cc3270 ffffffff83cae600 ffffffff83ca4e20 ffff8801c55288f8 ffff8801c5528000 ffff8801ce02f590 ffffffff813ff290 0000000000000002 00000000c55288d8 0000000000000002 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x128 lib/dump_stack.c:51 [] print_circular_bug.cold.36+0x2f7/0x432 kernel/locking/lockdep.c:1202 [] 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+0x3189/0x4a10 kernel/locking/lockdep.c:3345 [] lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756 [] down_read+0x44/0xb0 kernel/locking/rwsem.c:22 [] __do_page_fault+0x7db/0xa60 arch/x86/mm/fault.c:1342 [] do_page_fault+0x27/0x30 arch/x86/mm/fault.c:1469 [] page_fault+0x25/0x30 arch/x86/entry/entry_64.S:951 [] generic_perform_write+0x1c7/0x500 mm/filemap.c:2743 [] __generic_file_write_iter+0x352/0x540 mm/filemap.c:2878 [] generic_file_write_iter+0x37a/0x620 mm/filemap.c:2906 [] new_sync_write fs/read_write.c:496 [inline] [] __vfs_write+0x3d7/0x580 fs/read_write.c:509 [] vfs_write+0x187/0x520 fs/read_write.c:557 [] SYSC_write fs/read_write.c:604 [inline] [] SyS_write+0xd9/0x1c0 fs/read_write.c:596 [] do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285 [] entry_SYSCALL_64_after_swapgs+0x5d/0xdb