syzbot


possible deadlock in filename_create

Status: upstream: reported on 2023/01/10 15:41
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+a4b92717330b58c2f45c@syzkaller.appspotmail.com
First crash: 463d, last: 463d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in filename_create reiserfs 1 429d 429d 0/1 upstream: reported on 2023/02/13 11:59
linux-5.15 possible deadlock in filename_create 23 175d 398d 0/3 auto-obsoleted due to no activity on 2024/02/02 20:22
linux-6.1 possible deadlock in filename_create 15 185d 386d 0/3 auto-obsoleted due to no activity on 2024/01/23 21:11
linux-6.1 possible deadlock in filename_create (2) origin:upstream C 2 15d 46d 0/3 upstream: reported C repro on 2024/03/02 21:45
linux-5.15 possible deadlock in filename_create (2) origin:upstream C 4 17d 18d 0/3 upstream: reported C repro on 2024/03/30 13:42
upstream possible deadlock in filename_create reiserfs C 97 94d 525d 0/26 auto-obsoleted due to no activity on 2024/03/25 04:40

Sample crash report:
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop1): Using r5 hash to sort names
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.14.302-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/9638 is trying to acquire lock:
 (&sbi->lock){+.+.}, at: [<ffffffff81b3fca5>] reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

but task is already holding lock:
 (&type->i_mutex_dir_key#8/1){+.+.}, at: [<ffffffff818a98ca>] inode_lock_nested include/linux/fs.h:754 [inline]
 (&type->i_mutex_dir_key#8/1){+.+.}, at: [<ffffffff818a98ca>] filename_create+0x12a/0x3f0 fs/namei.c:3676

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&type->i_mutex_dir_key#8/1){+.+.}:
       down_write_nested+0x36/0x90 kernel/locking/rwsem.c:172
       inode_lock_nested include/linux/fs.h:754 [inline]
       filename_create+0x12a/0x3f0 fs/namei.c:3676
       user_path_create fs/namei.c:3734 [inline]
       SYSC_mkdirat fs/namei.c:3866 [inline]
       SyS_mkdirat+0x95/0x270 fs/namei.c:3858
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #1 (sb_writers#14){.+.+}:
       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+0x64/0x260 fs/super.c:1342
       sb_start_write include/linux/fs.h:1551 [inline]
       mnt_want_write_file+0xfd/0x3b0 fs/namespace.c:497
       reiserfs_ioctl+0x18e/0x8b0 fs/reiserfs/ioctl.c:110
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #0 (&sbi->lock){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
       reiserfs_lookup+0x130/0x400 fs/reiserfs/namei.c:363
       lookup_real fs/namei.c:1555 [inline]
       __lookup_hash fs/namei.c:1575 [inline]
       __lookup_hash+0x1bb/0x270 fs/namei.c:1563
       filename_create+0x156/0x3f0 fs/namei.c:3677
       user_path_create fs/namei.c:3734 [inline]
       SYSC_mkdirat fs/namei.c:3866 [inline]
       SyS_mkdirat+0x95/0x270 fs/namei.c:3858
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

other info that might help us debug this:

Chain exists of:
  &sbi->lock --> sb_writers#14 --> &type->i_mutex_dir_key#8/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&type->i_mutex_dir_key#8/1);
                               lock(sb_writers#14);
                               lock(&type->i_mutex_dir_key#8/1);
  lock(&sbi->lock);

 *** DEADLOCK ***

2 locks held by syz-executor.0/9638:
 #0:  (sb_writers#14){.+.+}, at: [<ffffffff818e1ffa>] sb_start_write include/linux/fs.h:1551 [inline]
 #0:  (sb_writers#14){.+.+}, at: [<ffffffff818e1ffa>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386
 #1:  (&type->i_mutex_dir_key#8/1){+.+.}, at: [<ffffffff818a98ca>] inode_lock_nested include/linux/fs.h:754 [inline]
 #1:  (&type->i_mutex_dir_key#8/1){+.+.}, at: [<ffffffff818a98ca>] filename_create+0x12a/0x3f0 fs/namei.c:3676

stack backtrace:
CPU: 0 PID: 9638 Comm: syz-executor.0 Not tainted 4.14.302-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
 reiserfs_lookup+0x130/0x400 fs/reiserfs/namei.c:363
 lookup_real fs/namei.c:1555 [inline]
 __lookup_hash fs/namei.c:1575 [inline]
 __lookup_hash+0x1bb/0x270 fs/namei.c:1563
 filename_create+0x156/0x3f0 fs/namei.c:3677
 user_path_create fs/namei.c:3734 [inline]
 SYSC_mkdirat fs/namei.c:3866 [inline]
 SyS_mkdirat+0x95/0x270 fs/namei.c:3858
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7fe3ec4db0c9
RSP: 002b:00007fe3eaa4d168 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007fe3ec5faf80 RCX: 00007fe3ec4db0c9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007fe3ec536ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd256c465f R14: 00007fe3eaa4d300 R15: 0000000000022000
EXT4-fs (loop3): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop3): ext4_mb_generate_buddy:754: group 0, block bitmap and bg descriptor inconsistent: 25 vs 150994969 free clusters
REISERFS (device loop1): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop1): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop1): journal params: device loop1, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 1822, max trans age 30
REISERFS (device loop1): checking transaction log (loop1)
REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop0): using ordered data mode
reiserfs: using flush barriers
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 loop1): Using r5 hash to sort names
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop0): using ordered data mode
reiserfs: using flush barriers
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 loop1): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop1): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop1): journal params: device loop1, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 1822, max trans age 30
REISERFS (device loop1): checking transaction log (loop1)
REISERFS (device loop1): Using r5 hash to sort names
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
Cannot find add_set index 0 as target
capability: warning: `syz-executor.0' uses deprecated v2 capabilities in a way that may be insecure
L1TF CPU bug present and SMT on, data leak possible. See CVE-2018-3646 and https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html for details.
audit: type=1326 audit(1673365261.973:2): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=10105 comm="syz-executor.2" exe="/root/syz-executor.2" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7f86c16470c9 code=0x0
audit: type=1804 audit(1673365263.063:3): pid=10213 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir808218567/syzkaller.7OYnwX/36/bus" dev="sda1" ino=13987 res=1
sctp: [Deprecated]: syz-executor.0 (pid 10325) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
syz-executor.2 uses obsolete (PF_INET,SOCK_PACKET)
audit: type=1326 audit(1673365264.083:4): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=10341 comm="syz-executor.1" exe="/root/syz-executor.1" sig=31 arch=c000003e syscall=202 compat=0 ip=0x7fd12ce060c9 code=0x0
unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/10 15:41 linux-4.14.y c4215ee4771b 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in filename_create
* Struck through repros no longer work on HEAD.