syzbot


possible deadlock in open_xa_dir

Status: upstream: reported C repro on 2022/12/29 15:01
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+131c496feb33821a856b@syzkaller.appspotmail.com
First crash: 482d, last: 476d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in open_xa_dir 4 365d 380d 0/3 auto-obsoleted due to no activity on 2023/08/23 09:03
linux-6.1 possible deadlock in open_xa_dir (2) origin:upstream C 41 13h21m 25d 0/3 upstream: reported C repro on 2024/03/31 06:40
upstream possible deadlock in open_xa_dir reiserfs C done done 7667 85d 481d 0/26 auto-obsoleted due to no activity on 2024/04/09 20:57
linux-6.1 possible deadlock in open_xa_dir 3 373d 383d 0/3 auto-obsoleted due to no activity on 2023/08/15 19:04
linux-5.15 possible deadlock in open_xa_dir (2) origin:upstream C 36 10h42m 22d 0/3 upstream: reported C repro on 2024/04/02 08:22

Sample crash report:
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 30, max trans age 30
REISERFS (device loop1): checking transaction log (loop1)
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor421/9859 is trying to acquire lock:
00000000e6c0d845 (&type->i_mutex_dir_key#7/3){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
00000000e6c0d845 (&type->i_mutex_dir_key#7/3){+.+.}, at: open_xa_root fs/reiserfs/xattr.c:127 [inline]
00000000e6c0d845 (&type->i_mutex_dir_key#7/3){+.+.}, at: open_xa_dir+0x127/0x690 fs/reiserfs/xattr.c:152

but task is already holding lock:
000000008ebafb15 (&sbi->lock){+.+.}, at: reiserfs_write_lock_nested+0x65/0xe0 fs/reiserfs/lock.c:78

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->lock){+.+.}:
       reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
       reiserfs_mkdir+0x311/0x980 fs/reiserfs/namei.c:827
       open_xa_root fs/reiserfs/xattr.c:136 [inline]
       open_xa_dir+0x555/0x690 fs/reiserfs/xattr.c:152
       xattr_lookup+0x21/0x3c0 fs/reiserfs/xattr.c:395
       reiserfs_xattr_set_handle+0xfd/0xb40 fs/reiserfs/xattr.c:531
       reiserfs_xattr_set+0x411/0x570 fs/reiserfs/xattr.c:631
       security_set+0x84/0xb0 fs/reiserfs/xattr_security.c:31
       __vfs_setxattr+0x10e/0x170 fs/xattr.c:149
REISERFS (device loop1): Using r5 hash to sort names
       __vfs_setxattr_noperm+0x11a/0x420 fs/xattr.c:180
       __vfs_setxattr_locked+0x176/0x250 fs/xattr.c:238
REISERFS (device loop1): Created .reiserfs_priv - reserved for xattr storage.
       vfs_setxattr+0xe5/0x270 fs/xattr.c:255
       setxattr+0x23d/0x330 fs/xattr.c:520
       path_setxattr+0x170/0x190 fs/xattr.c:539
       __do_sys_setxattr fs/xattr.c:554 [inline]
       __se_sys_setxattr fs/xattr.c:550 [inline]
       __x64_sys_setxattr+0xc0/0x160 fs/xattr.c:550
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&type->i_mutex_dir_key#7/3){+.+.}:
       down_write_nested+0x36/0x90 kernel/locking/rwsem.c:192
       inode_lock_nested include/linux/fs.h:783 [inline]
       open_xa_root fs/reiserfs/xattr.c:127 [inline]
       open_xa_dir+0x127/0x690 fs/reiserfs/xattr.c:152
       reiserfs_for_each_xattr+0x1ab/0x920 fs/reiserfs/xattr.c:252
       reiserfs_delete_xattrs+0x1c/0x90 fs/reiserfs/xattr.c:364
       reiserfs_evict_inode+0x2e3/0x540 fs/reiserfs/inode.c:53
       evict+0x2ed/0x760 fs/inode.c:559
       iput_final fs/inode.c:1555 [inline]
       iput+0x4f1/0x860 fs/inode.c:1581
       reiserfs_create+0x645/0x720 fs/reiserfs/namei.c:687
       lookup_open+0x893/0x1a20 fs/namei.c:3235
       do_last fs/namei.c:3327 [inline]
       path_openat+0x1094/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

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->lock);
                               lock(&type->i_mutex_dir_key#7/3);
                               lock(&sbi->lock);
  lock(&type->i_mutex_dir_key#7/3);

 *** DEADLOCK ***

3 locks held by syz-executor421/9859:
 #0: 00000000462c3316 (sb_writers#12){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
 #0: 00000000462c3316 (sb_writers#12){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360
 #1: 000000004b973f5e (&type->i_mutex_dir_key#7){+.+.}, at: inode_lock include/linux/fs.h:748 [inline]
 #1: 000000004b973f5e (&type->i_mutex_dir_key#7){+.+.}, at: do_last fs/namei.c:3324 [inline]
 #1: 000000004b973f5e (&type->i_mutex_dir_key#7){+.+.}, at: path_openat+0x1071/0x2df0 fs/namei.c:3537
 #2: 000000008ebafb15 (&sbi->lock){+.+.}, at: reiserfs_write_lock_nested+0x65/0xe0 fs/reiserfs/lock.c:78

stack backtrace:
CPU: 0 PID: 9859 Comm: syz-executor421 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
 down_write_nested+0x36/0x90 kernel/locking/rwsem.c:192
 inode_lock_nested include/linux/fs.h:783 [inline]
 open_xa_root fs/reiserfs/xattr.c:127 [inline]
 open_xa_dir+0x127/0x690 fs/reiserfs/xattr.c:152
 reiserfs_for_each_xattr+0x1ab/0x920 fs/reiserfs/xattr.c:252
 reiserfs_delete_xattrs+0x1c/0x90 fs/reiserfs/xattr.c:364
 reiserfs_evict_inode+0x2e3/0x540 fs/reiserfs/inode.c:53
 evict+0x2ed/0x760 fs/inode.c:559
 iput_final fs/inode.c:1555 [inline]
 iput+0x4f1/0x860 fs/inode.c:1581
 reiserfs_create+0x645/0x720 fs/reiserfs/namei.c:687
 lookup_open+0x893/0x1a20 fs/namei.c:3235
 do_last fs/namei.c:3327 [inline]
 path_openat+0x1094/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
RIP: 0033:0x7fce174ff6b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 18 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fce0f45e2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007fce1757e7e0 RCX: 00007fce174ff6b9
RDX: 00007fce174ff6b9 RSI: 0000000000000000 RDI: 0000000020000000
RBP: 00007fce1754a6c4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 7366726573696572
R13: 6d69762f7665642f R14: 0031656c69662f2e R15: 00007fce1757e7e8
REISERFS (device loop2): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop4): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop2): using ordered data mode
REISERFS (device loop4): using ordered data mode
reiserfs: using flush barriers
reiserfs: using flush barriers
REISERFS (device loop2): journal params: device loop2, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop4): journal params: device loop4, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop4): checking transaction log (loop4)
REISERFS (device loop0): using ordered data mode
REISERFS (device loop2): checking transaction log (loop2)
REISERFS (device loop5): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop5): 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: using flush barriers
REISERFS (device loop5): journal params: device loop5, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop5): checking transaction log (loop5)
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop2): Using r5 hash to sort names
REISERFS (device loop2): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop5): Using r5 hash to sort names
REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop1): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop3): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop1): using ordered data mode
REISERFS (device loop3): 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 30, max trans age 30
reiserfs: using flush barriers
REISERFS (device loop3): journal params: device loop3, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop1): checking transaction log (loop1)
REISERFS (device loop3): checking transaction log (loop3)
REISERFS (device loop3): Using r5 hash to sort names
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop1): Using r5 hash to sort names
REISERFS (device loop1): Created .reiserfs_priv - reserved for xattr storage.

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/29 15:36 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in open_xa_dir
2023/01/04 08:39 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in open_xa_dir
2022/12/29 15:00 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in open_xa_dir
* Struck through repros no longer work on HEAD.