====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.7.855/13705 is trying to acquire lock: ffff88803a9a91b0 (&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+0xea5/0x1b20 fs/btrfs/volumes.c:3038 btrfs_ioctl_add_dev+0x1ad/0x640 fs/btrfs/ioctl.c:2556 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+0xa44/0x1b20 fs/btrfs/volumes.c:2996 btrfs_ioctl_add_dev+0x1ad/0x640 fs/btrfs/ioctl.c:2556 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:718 btrfs_create_common+0x15c/0x310 fs/btrfs/inode.c:6984 lookup_open+0xc17/0x1a60 fs/namei.c:4567 open_last_lookups fs/namei.c:4767 [inline] path_openat+0x67c/0x1d60 fs/namei.c:4997 do_file_open+0x23e/0x4a0 fs/namei.c:5029 do_sys_openat2+0x115/0x200 fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_sys_openat fs/open.c:1439 [inline] __se_sys_openat fs/open.c:1434 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1434 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:1095 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6460 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 filldir+0x2bd/0x630 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_getdents fs/readdir.c:319 [inline] __se_sys_getdents+0xf1/0x270 fs/readdir.c:304 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.855/13705: 3, last CPU#0: #0: ffff8880619bdb28 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x252/0x320 fs/file.c:1259 #1: ffff88803de691b0 (&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: 13705 Comm: syz.7.855 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:filldir+0x2bd/0x630 fs/readdir.c:290 Code: a9 7e 7f ff 0f 01 cb 48 8b 44 24 20 49 89 47 08 48 bd 00 00 00 00 00 fc ff df 48 8b 44 24 40 48 89 03 8b 4c 24 04 48 8d 43 10 <66> 89 08 8b 54 24 14 80 e2 0f 89 c9 48 8d 04 0b 48 ff c8 88 10 48 RSP: 0018:ffffc90004a17c50 EFLAGS: 00050297 RAX: 0000200000002000 RBX: 0000200000001ff0 RCX: 0000000000000028 RDX: 0000000000000002 RSI: 000000000000000d RDI: 0000000000000007 RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000000 R10: dffffc0000000000 R11: ffffed1004ce17d1 R12: ffff888027084d80 R13: 000000000000000d R14: 000000000000000d R15: 0000200000001fd8 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_getdents fs/readdir.c:319 [inline] __se_sys_getdents+0xf1/0x270 fs/readdir.c:304 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:0x7f4baecee159 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:00007f4bacf46028 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007f4baef75fa0 RCX: 00007f4baecee159 RDX: 00000000000000b8 RSI: 0000200000001fc0 RDI: 0000000000000003 RBP: 00007f4baed85024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f4baef76038 R14: 00007f4baef75fa0 R15: 00007ffe25439f18 ---------------- Code disassembly (best guess): 0: a9 7e 7f ff 0f test $0xfff7f7e,%eax 5: 01 cb add %ecx,%ebx 7: 48 8b 44 24 20 mov 0x20(%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 40 mov 0x40(%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 54 24 14 mov 0x14(%rsp),%edx 31: 80 e2 0f and $0xf,%dl 34: 89 c9 mov %ecx,%ecx 36: 48 8d 04 0b lea (%rbx,%rcx,1),%rax 3a: 48 ff c8 dec %rax 3d: 88 10 mov %dl,(%rax) 3f: 48 rex.W