BTRFS error (device loop0): superblock checksum mismatch BTRFS error (device loop0): open_ctree failed ====================================================== WARNING: possible circular locking dependency detected 5.0.0-rc7+ #79 Not tainted ------------------------------------------------------ syz-executor.3/20422 is trying to acquire lock: 00000000e3816351 (&sb->s_type->i_mutex_key#11){+.+.}, at: inode_lock include/linux/fs.h:757 [inline] 00000000e3816351 (&sb->s_type->i_mutex_key#11){+.+.}, at: shmem_fallocate+0x15a/0xc60 mm/shmem.c:2633 but task is already holding lock: 000000003b246b17 (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_pwrite64+0x183/0x1c0 fs/read_write.c:652 __do_sys_pwrite64 fs/read_write.c:662 [inline] __se_sys_pwrite64 fs/read_write.c:659 [inline] __x64_sys_pwrite64+0x97/0xf0 fs/read_write.c:659 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#11){+.+.}: 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#11 --> &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#11); *** DEADLOCK *** 1 lock held by syz-executor.3/20422: ------------[ cut here ]------------ #0: 000000003b246b17 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0x66/0x4f0 drivers/staging/android/ashmem.c:448 downgrading a read lock WARNING: CPU: 1 PID: 20424 at kernel/locking/lockdep.c:3553 __lock_downgrade kernel/locking/lockdep.c:3553 [inline] WARNING: CPU: 1 PID: 20424 at kernel/locking/lockdep.c:3553 lock_downgrade+0x478/0x810 kernel/locking/lockdep.c:3816 stack backtrace: