syzbot


possible deadlock in mnt_want_write_file

Status: upstream: reported C repro on 2022/10/23 23:32
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+1dd071a6342bbb854431@syzkaller.appspotmail.com
First crash: 639d, last: 506d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in mnt_want_write_file reiserfs C 41 510d 655d 0/1 upstream: reported C repro on 2022/10/07 22:29
linux-5.15 possible deadlock in mnt_want_write_file origin:upstream C 539 11d 501d 0/3 upstream: reported C repro on 2023/03/10 19:40
upstream possible deadlock in mnt_want_write_file reiserfs C error done 1675 175d 628d 0/27 auto-obsoleted due to no activity on 2024/04/09 17:30
linux-6.1 possible deadlock in mnt_want_write_file origin:upstream C 505 12d 497d 0/3 upstream: reported C repro on 2023/03/14 17:49

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
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
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor221/8104 is trying to acquire lock:
000000004d63dc28 (sb_writers#11){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
000000004d63dc28 (sb_writers#11){.+.+}, at: mnt_want_write_file+0x63/0x1d0 fs/namespace.c:418

but task is already holding lock:
00000000ba80cbc6 (&sbi->lock){+.+.}, at: reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sbi->lock){+.+.}:
       reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
       reiserfs_lookup+0x171/0x490 fs/reiserfs/namei.c:363
       __lookup_slow+0x246/0x4a0 fs/namei.c:1672
       lookup_one_len+0x163/0x190 fs/namei.c:2544
       reiserfs_lookup_privroot+0x92/0x280 fs/reiserfs/xattr.c:970
       reiserfs_fill_super+0x1f12/0x2d80 fs/reiserfs/super.c:2187
       mount_bdev+0x2fc/0x3b0 fs/super.c:1158
       mount_fs+0xa3/0x310 fs/super.c:1261
       vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
       vfs_kern_mount fs/namespace.c:951 [inline]
       do_new_mount fs/namespace.c:2492 [inline]
       do_mount+0x115c/0x2f50 fs/namespace.c:2822
       ksys_mount+0xcf/0x130 fs/namespace.c:3038
       __do_sys_mount fs/namespace.c:3052 [inline]
       __se_sys_mount fs/namespace.c:3049 [inline]
       __x64_sys_mount+0xba/0x150 fs/namespace.c:3049
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&type->i_mutex_dir_key#7){+.+.}:
       inode_lock include/linux/fs.h:748 [inline]
       do_last fs/namei.c:3324 [inline]
       path_openat+0x1071/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_sys_open+0x3b3/0x520 fs/open.c:1085
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (sb_writers#11){.+.+}:
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       __sb_start_write+0x6e/0x2a0 fs/super.c:1366
       sb_start_write include/linux/fs.h:1579 [inline]
       mnt_want_write_file+0x63/0x1d0 fs/namespace.c:418
       reiserfs_ioctl+0x1a7/0x9a0 fs/reiserfs/ioctl.c:110
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:501 [inline]
       do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
       ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
       __do_sys_ioctl fs/ioctl.c:712 [inline]
       __se_sys_ioctl fs/ioctl.c:710 [inline]
       __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  sb_writers#11 --> &type->i_mutex_dir_key#7 --> &sbi->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->lock);
                               lock(&type->i_mutex_dir_key#7);
                               lock(&sbi->lock);
  lock(sb_writers#11);

 *** DEADLOCK ***

1 lock held by syz-executor221/8104:
 #0: 00000000ba80cbc6 (&sbi->lock){+.+.}, at: reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

stack backtrace:
CPU: 0 PID: 8104 Comm: syz-executor221 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
 percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
 __sb_start_write+0x6e/0x2a0 fs/super.c:1366
 sb_start_write include/linux/fs.h:1579 [inline]
 mnt_want_write_file+0x63/0x1d0 fs/namespace.c:418
 reiserfs_ioctl+0x1a7/0x9a0 fs/reiserfs/ioctl.c:110
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fce98314219
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc538c81a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fce98314219
RDX: 0000000000000000 RSI: 0000000040087602 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007fce98382ec0 R09: 00007fce98382ec0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc538c81d0
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

Crashes (81):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/12 12:24 linux-4.19.y 3f8a27f9e27b 96166539 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/25 22:42 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/03/05 14:13 linux-4.19.y 3f8a27f9e27b f8902b57 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/03/03 20:02 linux-4.19.y 3f8a27f9e27b f8902b57 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/03/02 04:55 linux-4.19.y 3f8a27f9e27b f8902b57 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/03/01 13:32 linux-4.19.y 3f8a27f9e27b ef65e6cb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/03/01 03:12 linux-4.19.y 3f8a27f9e27b 95aee97a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/28 14:09 linux-4.19.y 3f8a27f9e27b 95aee97a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/25 05:51 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/24 22:12 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/23 15:24 linux-4.19.y 3f8a27f9e27b 9e2ebb3c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/22 23:20 linux-4.19.y 3f8a27f9e27b 9f1e2cb3 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/19 09:32 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/19 06:16 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/18 20:25 linux-4.19.y 3f8a27f9e27b d02e9a70 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/14 02:34 linux-4.19.y 3f8a27f9e27b 93ae7e0a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/13 12:42 linux-4.19.y 3f8a27f9e27b 957959cb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/13 05:57 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/11 11:17 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/10 08:43 linux-4.19.y 3f8a27f9e27b 07980f9d .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/09 23:00 linux-4.19.y 3f8a27f9e27b 07980f9d .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/07 17:35 linux-4.19.y 3f8a27f9e27b 5bc3be51 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/05 02:02 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/04 23:30 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/03 08:06 linux-4.19.y 3f8a27f9e27b 33fc5c09 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/02/01 22:24 linux-4.19.y 3f8a27f9e27b 9a6f477c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/31 01:47 linux-4.19.y 3f8a27f9e27b b68fb8d6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/26 23:47 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/26 18:55 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/26 10:01 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/25 21:12 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/25 03:51 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/24 12:53 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/22 20:21 linux-4.19.y 3f8a27f9e27b cc0f9968 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/22 14:52 linux-4.19.y 3f8a27f9e27b cc0f9968 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/21 19:02 linux-4.19.y 3f8a27f9e27b cc0f9968 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/18 17:25 linux-4.19.y 3f8a27f9e27b 4620c2d9 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/18 08:41 linux-4.19.y 3f8a27f9e27b 42660d9e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/11 03:18 linux-4.19.y 3f8a27f9e27b 48bc529a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/09 21:56 linux-4.19.y 3f8a27f9e27b 48bc529a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2023/01/06 12:43 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/29 16:30 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/27 14:32 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/26 04:24 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/09 21:20 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/09 08:59 linux-4.19.y 3f8a27f9e27b 1034e5fa .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/06 22:28 linux-4.19.y 3f8a27f9e27b d88f3abb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/06 04:24 linux-4.19.y 3f8a27f9e27b 045cbb84 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/02 03:06 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/02 03:01 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/12/01 15:03 linux-4.19.y 3f8a27f9e27b 4c2a66e8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/30 10:11 linux-4.19.y 3f8a27f9e27b 579a3740 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/29 13:43 linux-4.19.y 3f8a27f9e27b ca9683b8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/28 13:45 linux-4.19.y 3f8a27f9e27b 247de55b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/27 11:36 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/27 07:30 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/26 20:08 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/26 17:22 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/26 11:11 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/11/25 22:30 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
2022/10/23 23:31 linux-4.19.y 3f8a27f9e27b 23bf86af .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in mnt_want_write_file
* Struck through repros no longer work on HEAD.