syzbot


possible deadlock in mnt_want_write_file

Status: upstream: reported C repro on 2025/09/15 23:33
Reported-by: syzbot+69bfd5c59004af1ae52d@syzkaller.appspotmail.com
First crash: 3d21h, last: 3d21h
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in mnt_want_write_file reiserfs 4 C 41 933d 1077d 0/1 upstream: reported C repro on 2022/10/07 22:29
linux-5.15 possible deadlock in mnt_want_write_file missing-backport origin:upstream 4 C done 662 6d07h 924d 0/3 upstream: reported C repro on 2023/03/10 19:40
linux-4.19 possible deadlock in mnt_want_write_file reiserfs 4 C 81 929d 1061d 0/1 upstream: reported C repro on 2022/10/23 23:32
upstream possible deadlock in mnt_want_write_file fs 4 C error done 1675 598d 1050d 0/29 auto-obsoleted due to no activity on 2024/04/09 17:30
linux-6.1 possible deadlock in mnt_want_write_file origin:upstream missing-backport 4 C done 590 12h27m 920d 0/3 upstream: reported C repro on 2023/03/14 17:49

Sample crash report:
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/5953 is trying to acquire lock:
ffff88807cfa2418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write_file+0x63/0x200 fs/namespace.c:447

but task is already holding lock:
ffff88814baa7090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x79/0xd0 fs/reiserfs/lock.c:27

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sbi->lock){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       reiserfs_write_lock+0x79/0xd0 fs/reiserfs/lock.c:27
       reiserfs_lookup+0x151/0x520 fs/reiserfs/namei.c:364
       __lookup_slow+0x281/0x3b0 fs/namei.c:1694
       lookup_one_len+0x192/0x2c0 fs/namei.c:2744
       reiserfs_lookup_privroot+0x89/0x180 fs/reiserfs/xattr.c:977
       reiserfs_fill_super+0x1f44/0x2340 fs/reiserfs/super.c:2174
       mount_bdev+0x22b/0x2d0 fs/super.c:1643
       legacy_get_tree+0xea/0x180 fs/fs_context.c:662
       vfs_get_tree+0x8c/0x280 fs/super.c:1764
       do_new_mount+0x24b/0xa40 fs/namespace.c:3377
       do_mount fs/namespace.c:3717 [inline]
       __do_sys_mount fs/namespace.c:3926 [inline]
       __se_sys_mount+0x2da/0x3c0 fs/namespace.c:3903
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&type->i_mutex_dir_key#8){+.+.}-{3:3}:
       down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
       inode_lock include/linux/fs.h:804 [inline]
       open_last_lookups fs/namei.c:3553 [inline]
       path_openat+0x7c6/0x3190 fs/namei.c:3786
       do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
       do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
       do_sys_open fs/open.c:1434 [inline]
       __do_sys_openat fs/open.c:1450 [inline]
       __se_sys_openat fs/open.c:1445 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1445
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (sb_writers#13){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1633 [inline]
       sb_start_write+0x4d/0x1c0 include/linux/fs.h:1708
       mnt_want_write_file+0x63/0x200 fs/namespace.c:447
       reiserfs_ioctl+0x112/0x2d0 fs/reiserfs/ioctl.c:103
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:871 [inline]
       __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  sb_writers#13 --> &type->i_mutex_dir_key#8 --> &sbi->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->lock);
                               lock(&type->i_mutex_dir_key#8);
                               lock(&sbi->lock);
  rlock(sb_writers#13);

 *** DEADLOCK ***

1 lock held by syz.0.17/5953:
 #0: ffff88814baa7090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x79/0xd0 fs/reiserfs/lock.c:27

stack backtrace:
CPU: 0 PID: 5953 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1633 [inline]
 sb_start_write+0x4d/0x1c0 include/linux/fs.h:1708
 mnt_want_write_file+0x63/0x200 fs/namespace.c:447
 reiserfs_ioctl+0x112/0x2d0 fs/reiserfs/ioctl.c:103
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f046798eba9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc758a1988 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f0467bd5fa0 RCX: 00007f046798eba9
RDX: 0000000000000000 RSI: 0000000040087602 RDI: 0000000000000004
RBP: 00007f0467a11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f0467bd5fa0 R14: 00007f0467bd5fa0 R15: 0000000000000003
 </TASK>

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/16 00:00 linux-6.6.y 60a9e718726f e2beed91 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-6-kasan possible deadlock in mnt_want_write_file
2025/09/15 23:34 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write_file
2025/09/15 23:33 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write_file
* Struck through repros no longer work on HEAD.