====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.7.330/8659 is trying to acquire lock: ffff8880332a2cb0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:609 but task is already holding lock: ffff88813ff6d238 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_fop_readdir+0x270/0x960 fs/kernfs/dir.c:1982 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&root->kernfs_rwsem){++++}-{4:4}: down_write+0x3a/0x50 kernel/locking/rwsem.c:1631 kernfs_add_one+0x41/0x6f0 fs/kernfs/dir.c:825 kernfs_create_link+0x161/0x200 fs/kernfs/symlink.c:48 sysfs_do_create_link_sd+0x83/0x110 fs/sysfs/symlink.c:44 btrfs_sysfs_add_device+0x13f/0x650 fs/btrfs/sysfs.c:2155 btrfs_init_new_device+0xeb6/0x1ca0 fs/btrfs/volumes.c:3038 btrfs_ioctl_add_dev+0x1ad/0x640 fs/btrfs/ioctl.c:2571 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&fs_devs->device_list_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:559 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:578 btrfs_init_new_device+0xa3a/0x1ca0 fs/btrfs/volumes.c:2996 btrfs_ioctl_add_dev+0x1ad/0x640 fs/btrfs/ioctl.c:2571 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x18a/0xc60 fs/btrfs/transaction.c:324 start_transaction+0x6ed/0x17d0 fs/btrfs/transaction.c:729 create_snapshot fs/btrfs/ioctl.c:823 [inline] btrfs_mksubvol+0x8c6/0x10c0 fs/btrfs/ioctl.c:915 btrfs_mksnapshot+0xa3/0xe0 fs/btrfs/ioctl.c:957 __btrfs_ioctl_snap_create+0x4e7/0x7d0 fs/btrfs/ioctl.c:1219 btrfs_ioctl_snap_create_v2+0x1ab/0x330 fs/btrfs/ioctl.c:1288 btrfs_ioctl+0x8ee/0xd60 fs/btrfs/ioctl.c:-1 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5593 [inline] lock_release+0x1a3/0x3c0 kernel/locking/lockdep.c:5930 percpu_up_read include/linux/percpu-rwsem.h:114 [inline] __sb_end_write include/linux/fs/super.h:14 [inline] sb_end_intwrite+0x26/0x190 include/linux/fs/super.h:101 __btrfs_end_transaction+0x23f/0x640 fs/btrfs/transaction.c:1106 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6463 touch_atime+0x2f8/0x670 fs/inode.c:2326 file_accessed include/linux/fs.h:2277 [inline] btrfs_file_mmap_prepare+0x189/0x200 fs/btrfs/file.c:2003 vfs_mmap_prepare include/linux/fs.h:2069 [inline] call_mmap_prepare mm/vma.c:2776 [inline] __mmap_region mm/vma.c:2863 [inline] mmap_region+0xe9f/0x2240 mm/vma.c:2964 do_mmap+0xe0e/0x1310 mm/mmap.c:573 vm_mmap_pgoff+0x275/0x4e0 mm/util.c:581 ksys_mmap_pgoff+0x4a6/0x720 mm/mmap.c:619 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&mm->mmap_lock){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3181 [inline] check_prevs_add kernel/locking/lockdep.c:3300 [inline] validate_chain kernel/locking/lockdep.c:3924 [inline] __lock_acquire+0x15ff/0x2e40 kernel/locking/lockdep.c:5254 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908 down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1599 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:609 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d6/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x343/0x1340 arch/x86/mm/fault.c:1366 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 filldir64+0x2bc/0x620 fs/readdir.c:-1 dir_emit include/linux/fs.h:3607 [inline] kernfs_fop_readdir+0x583/0x960 fs/kernfs/dir.c:1999 iterate_dir+0x2f1/0x4e0 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:399 [inline] __se_sys_getdents64+0xf1/0x280 fs/readdir.c:384 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 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 --> &root->kernfs_rwsem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(&root->kernfs_rwsem); lock(&fs_devs->device_list_mutex); lock(&root->kernfs_rwsem); rlock(&mm->mmap_lock); *** DEADLOCK *** locks held by syz.7.330/8659: 3, last CPU#0: #0: ffff88803aba2728 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x252/0x320 fs/file.c:1259 #1: ffff88804bb657f8 (&type->i_mutex_dir_key#6){++++}-{4:4}, at: iterate_dir+0x215/0x4e0 fs/readdir.c:103 #2: ffff88813ff6d238 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_fop_readdir+0x270/0x960 fs/kernfs/dir.c:1982 stack backtrace: CPU: 0 UID: 0 PID: 8659 Comm: syz.7.330 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2059 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2191 check_prev_add kernel/locking/lockdep.c:3181 [inline] check_prevs_add kernel/locking/lockdep.c:3300 [inline] validate_chain kernel/locking/lockdep.c:3924 [inline] __lock_acquire+0x15ff/0x2e40 kernel/locking/lockdep.c:5254 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908 down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1599 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:609 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d6/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x343/0x1340 arch/x86/mm/fault.c:1366 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 RIP: 0010:filldir64+0x2bc/0x620 fs/readdir.c:369 Code: ca 5d 7f ff 0f 01 cb 48 8b 44 24 28 49 89 47 08 48 bd 00 00 00 00 00 fc ff df 48 8b 44 24 58 48 89 03 8b 4c 24 04 48 8d 43 10 <66> 89 08 8b 4c 24 14 80 e1 0f 48 8d 43 12 88 08 4a 8d 04 2b 48 83 RSP: 0018:ffffc90005a27c50 EFLAGS: 00050293 RAX: 0000200000001000 RBX: 0000200000000ff0 RCX: 0000000000000028 RDX: 0000000000000000 RSI: 000000000000000d RDI: 0000000000000007 RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000000 R10: dffffc0000000000 R11: ffffed1006cd3bb9 R12: ffff888031525660 R13: 000000000000000d R14: 000000000000000d R15: 0000200000000fd8 dir_emit include/linux/fs.h:3607 [inline] kernfs_fop_readdir+0x583/0x960 fs/kernfs/dir.c:1999 iterate_dir+0x2f1/0x4e0 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:399 [inline] __se_sys_getdents64+0xf1/0x280 fs/readdir.c:384 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f70da4ee159 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:00007f70d8746028 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f70da775fa0 RCX: 00007f70da4ee159 RDX: 00000000000000e0 RSI: 0000200000000fc0 RDI: 0000000000000007 RBP: 00007f70da585024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f70da776038 R14: 00007f70da775fa0 R15: 00007ffd12549af8 ---------------- Code disassembly (best guess): 0: ca 5d 7f lret $0x7f5d 3: ff 0f decl (%rdi) 5: 01 cb add %ecx,%ebx 7: 48 8b 44 24 28 mov 0x28(%rsp),%rax c: 49 89 47 08 mov %rax,0x8(%r15) 10: 48 bd 00 00 00 00 00 movabs $0xdffffc0000000000,%rbp 17: fc ff df 1a: 48 8b 44 24 58 mov 0x58(%rsp),%rax 1f: 48 89 03 mov %rax,(%rbx) 22: 8b 4c 24 04 mov 0x4(%rsp),%ecx 26: 48 8d 43 10 lea 0x10(%rbx),%rax * 2a: 66 89 08 mov %cx,(%rax) <-- trapping instruction 2d: 8b 4c 24 14 mov 0x14(%rsp),%ecx 31: 80 e1 0f and $0xf,%cl 34: 48 8d 43 12 lea 0x12(%rbx),%rax 38: 88 08 mov %cl,(%rax) 3a: 4a 8d 04 2b lea (%rbx,%r13,1),%rax 3e: 48 rex.W 3f: 83 .byte 0x83