====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.877/12575 is trying to acquire lock: ffff8880331137b0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601 but task is already holding lock: ffff88804d171c78 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: iterate_dir+0x29e/0x580 fs/readdir.c:101 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (&type->i_mutex_dir_key#5){++++}-{4:4}: down_read+0x97/0x200 kernel/locking/rwsem.c:1537 inode_lock_shared include/linux/fs.h:1043 [inline] lookup_slow+0x46/0x70 fs/namei.c:1932 walk_component fs/namei.c:2279 [inline] lookup_last fs/namei.c:2786 [inline] path_lookupat+0x3f5/0x8c0 fs/namei.c:2810 filename_lookup+0x256/0x5d0 fs/namei.c:2839 kern_path+0x3d/0x150 fs/namei.c:3046 is_same_device fs/btrfs/volumes.c:763 [inline] device_list_add+0xfd1/0x2280 fs/btrfs/volumes.c:897 btrfs_scan_one_device+0x3ef/0x680 fs/btrfs/volumes.c:1498 btrfs_get_tree_super fs/btrfs/super.c:1858 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x4ab/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #5 (&fs_devs->device_list_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 btrfs_run_dev_stats+0xfa/0x10f0 fs/btrfs/volumes.c:8081 commit_cowonly_roots+0x1b8/0x860 fs/btrfs/transaction.c:1359 btrfs_commit_transaction+0x1057/0x31a0 fs/btrfs/transaction.c:2502 btrfs_rebuild_free_space_tree+0x291/0x6e0 fs/btrfs/free-space-tree.c:1380 btrfs_start_pre_rw_mount+0x1529/0x1f20 fs/btrfs/disk-io.c:3071 open_ctree+0x2e07/0x4220 fs/btrfs/disk-io.c:3668 btrfs_fill_super fs/btrfs/super.c:981 [inline] btrfs_get_tree_super fs/btrfs/super.c:1944 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x1061/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&fs_info->reloc_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 btrfs_commit_transaction+0xf68/0x31a0 fs/btrfs/transaction.c:2448 btrfs_rebuild_free_space_tree+0x291/0x6e0 fs/btrfs/free-space-tree.c:1380 btrfs_start_pre_rw_mount+0x1529/0x1f20 fs/btrfs/disk-io.c:3071 open_ctree+0x2e07/0x4220 fs/btrfs/disk-io.c:3668 btrfs_fill_super fs/btrfs/super.c:981 [inline] btrfs_get_tree_super fs/btrfs/super.c:1944 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2087 [inline] btrfs_get_tree+0x1061/0x1930 fs/btrfs/super.c:2121 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (btrfs_trans_unblocked){++++}-{0:0}: wait_current_trans+0x269/0x590 fs/btrfs/transaction.c:534 start_transaction+0x6a7/0x1650 fs/btrfs/transaction.c:705 __unlink_start_trans fs/btrfs/inode.c:4531 [inline] btrfs_unlink+0x141/0x370 fs/btrfs/inode.c:4548 vfs_unlink+0x272/0x6d0 fs/namei.c:5476 ovl_do_unlink fs/overlayfs/overlayfs.h:224 [inline] ovl_cleanup_locked fs/overlayfs/dir.c:36 [inline] ovl_cleanup+0x120/0x230 fs/overlayfs/dir.c:54 ovl_check_rename_whiteout fs/overlayfs/super.c:620 [inline] ovl_make_workdir fs/overlayfs/super.c:717 [inline] ovl_get_workdir fs/overlayfs/super.c:840 [inline] ovl_fill_super_creds fs/overlayfs/super.c:1453 [inline] ovl_fill_super+0x49bb/0x5e40 fs/overlayfs/super.c:1564 vfs_get_super fs/super.c:1327 [inline] get_tree_nodev+0xbb/0x150 fs/super.c:1346 vfs_get_tree+0x92/0x2a0 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3763 [inline] do_new_mount+0x341/0xd30 fs/namespace.c:3839 do_mount fs/namespace.c:4172 [inline] __do_sys_mount fs/namespace.c:4361 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4338 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (sb_internal#2){.+.+}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_intwrite include/linux/fs/super.h:177 [inline] start_transaction+0x56e/0x1650 fs/btrfs/transaction.c:702 btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6443 file_update_time_flags+0x2d5/0x4b0 fs/inode.c:2426 btrfs_page_mkwrite+0x5df/0x1b10 fs/btrfs/file.c:1914 do_page_mkwrite+0x150/0x310 mm/memory.c:3589 wp_page_shared mm/memory.c:3990 [inline] do_wp_page+0x203b/0x49d0 mm/memory.c:4209 handle_pte_fault mm/memory.c:6333 [inline] __handle_mm_fault mm/memory.c:6455 [inline] handle_mm_fault+0x9f5/0x13c0 mm/memory.c:6624 do_user_addr_fault+0xa73/0x1340 arch/x86/mm/fault.c:1334 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 -> #1 (sb_pagefaults#2){.+.+}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_pagefault include/linux/fs/super.h:159 [inline] btrfs_page_mkwrite+0x329/0x1b10 fs/btrfs/file.c:1873 do_page_mkwrite+0x150/0x310 mm/memory.c:3589 do_shared_fault mm/memory.c:5875 [inline] do_fault mm/memory.c:5937 [inline] do_pte_missing+0x711/0x29e0 mm/memory.c:4477 handle_pte_fault mm/memory.c:6317 [inline] __handle_mm_fault mm/memory.c:6455 [inline] handle_mm_fault+0xd0a/0x13c0 mm/memory.c:6624 do_user_addr_fault+0x75b/0x1340 arch/x86/mm/fault.c:1385 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 -> #0 (&mm->mmap_lock){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868 down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d7/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x330/0x1340 arch/x86/mm/fault.c:1357 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 filldir64+0x2c0/0x670 fs/readdir.c:-1 dir_emit include/linux/fs.h:3566 [inline] offset_dir_emit fs/libfs.c:500 [inline] offset_iterate_dir fs/libfs.c:516 [inline] offset_readdir+0x3fc/0x530 fs/libfs.c:565 iterate_dir+0x3a5/0x580 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:412 [inline] __se_sys_getdents64+0xf1/0x280 fs/readdir.c:397 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &fs_devs->device_list_mutex --> &type->i_mutex_dir_key#5 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(&type->i_mutex_dir_key#5); lock(&fs_devs->device_list_mutex); lock(&type->i_mutex_dir_key#5); rlock(&mm->mmap_lock); *** DEADLOCK *** 2 locks held by syz.3.877/12575: #0: ffff888031500b28 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x252/0x320 fs/file.c:1261 #1: ffff88804d171c78 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: iterate_dir+0x29e/0x580 fs/readdir.c:101 stack backtrace: CPU: 1 UID: 0 PID: 12575 Comm: syz.3.877 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/18/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868 down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d7/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x330/0x1340 arch/x86/mm/fault.c:1357 handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 RIP: 0010:filldir64+0x2c0/0x670 fs/readdir.c:380 Code: e8 48 8b 44 24 50 49 89 44 24 08 48 8b 4c 24 08 48 8b 44 24 58 48 89 01 48 8b 04 24 8b 54 24 14 49 bc 00 00 00 00 00 fc ff df <66> 89 41 10 80 e2 0f 88 51 12 49 63 ee c6 44 29 13 00 4c 8d 79 13 RSP: 0018:ffffc9000520fc70 EFLAGS: 00050283 RAX: 0000000000000020 RBX: ffffc9000520fe38 RCX: 0000200000000ff0 RDX: 000000000000000a RSI: 0000200000000fd0 RDI: 0000200000001010 RBP: 00007ffffffff000 R08: 0000000000000000 R09: 0000000000000000 R10: dffffc0000000000 R11: ffffed1007501001 R12: dffffc0000000000 R13: ffff8880401ce598 R14: 000000000000000a R15: 0000200000001010 dir_emit include/linux/fs.h:3566 [inline] offset_dir_emit fs/libfs.c:500 [inline] offset_iterate_dir fs/libfs.c:516 [inline] offset_readdir+0x3fc/0x530 fs/libfs.c:565 iterate_dir+0x3a5/0x580 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:412 [inline] __se_sys_getdents64+0xf1/0x280 fs/readdir.c:397 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb89553c819 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb88b354028 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007fb8957b6180 RCX: 00007fb89553c819 RDX: 0000000000001000 RSI: 0000200000000f80 RDI: 0000000000000004 RBP: 00007fb8955d2c91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fb8957b6218 R14: 00007fb8957b6180 R15: 00007fff835a7a28 ---------------- Code disassembly (best guess): 0: e8 48 8b 44 24 call 0x24448b4d 5: 50 push %rax 6: 49 89 44 24 08 mov %rax,0x8(%r12) b: 48 8b 4c 24 08 mov 0x8(%rsp),%rcx 10: 48 8b 44 24 58 mov 0x58(%rsp),%rax 15: 48 89 01 mov %rax,(%rcx) 18: 48 8b 04 24 mov (%rsp),%rax 1c: 8b 54 24 14 mov 0x14(%rsp),%edx 20: 49 bc 00 00 00 00 00 movabs $0xdffffc0000000000,%r12 27: fc ff df * 2a: 66 89 41 10 mov %ax,0x10(%rcx) <-- trapping instruction 2e: 80 e2 0f and $0xf,%dl 31: 88 51 12 mov %dl,0x12(%rcx) 34: 49 63 ee movslq %r14d,%rbp 37: c6 44 29 13 00 movb $0x0,0x13(%rcx,%rbp,1) 3c: 4c 8d 79 13 lea 0x13(%rcx),%r15