syzbot


possible deadlock in open_xa_dir

Status: upstream: reported on 2022/12/31 06:35
Subsystems: reiserfs (incorrect?)
Reported-by: syzbot+8fb64a61fdd96b50f3b8@syzkaller.appspotmail.com
First crash: 88d, last: 45d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in open_xa_dir reiserfs C error 3 80d 86d 0/1 upstream: reported C repro on 2022/12/29 15:01

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.2.0-rc7-syzkaller-00013-g513c1a3d3f19 #0 Not tainted
------------------------------------------------------
syz-executor.0/12756 is trying to acquire lock:
ffff888034f03e80 (&type->i_mutex_dir_key#14/3){+.+.}-{3:3}, at: open_xa_dir+0x122/0x650

but task is already holding lock:
ffff8880763a5090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x5f/0xd0

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->lock){+.+.}-{3:3}:
       lock_acquire+0x20b/0x600
       __mutex_lock_common+0x1c2/0x2630
       mutex_lock_nested+0x1b/0x20
       reiserfs_write_lock+0x7a/0xd0
       reiserfs_mkdir+0x2f5/0x8d0
       open_xa_dir+0x2bd/0x650
       xattr_lookup+0x24/0x280
       reiserfs_xattr_set_handle+0xfd/0xdc0
       reiserfs_xattr_set+0x428/0x550
       __vfs_setxattr+0x460/0x4a0
       __vfs_setxattr_noperm+0x12e/0x5e0
       vfs_setxattr+0x221/0x420
       ovl_get_workdir+0xcf6/0x16c0
       ovl_fill_super+0x1b8a/0x29c0
       mount_nodev+0x56/0xe0
       legacy_get_tree+0xef/0x190
       vfs_get_tree+0x8c/0x270
       do_new_mount+0x28f/0xae0
       __se_sys_mount+0x2c9/0x3b0
       do_syscall_64+0x41/0xc0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&type->i_mutex_dir_key#14/3){+.+.}-{3:3}:
       validate_chain+0x166b/0x5860
       __lock_acquire+0x125b/0x1f80
       lock_acquire+0x20b/0x600
       down_write_nested+0x3d/0x60
       open_xa_dir+0x122/0x650
       reiserfs_for_each_xattr+0x1a8/0xb50
       reiserfs_delete_xattrs+0x1f/0x90
       reiserfs_evict_inode+0x207/0x470
       evict+0x2a4/0x620
       reiserfs_create+0x328/0x660
       path_openat+0x12b9/0x2e30
       do_filp_open+0x26d/0x500
       do_sys_openat2+0x128/0x4f0
       __x64_sys_openat+0x247/0x290
       do_syscall_64+0x41/0xc0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

3 locks held by syz-executor.0/12756:
 #0: ffff888031e96460 (sb_writers#18){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90
 #1: ffff888034f002e0 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: path_openat+0x7b5/0x2e30
 #2: ffff8880763a5090
 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x5f/0xd0

stack backtrace:
CPU: 0 PID: 12756 Comm: syz-executor.0 Not tainted 6.2.0-rc7-syzkaller-00013-g513c1a3d3f19 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 dump_stack_lvl+0x1b5/0x2a0
 check_noncircular+0x2d1/0x390
 validate_chain+0x166b/0x5860
 __lock_acquire+0x125b/0x1f80
 lock_acquire+0x20b/0x600
 down_write_nested+0x3d/0x60
 open_xa_dir+0x122/0x650
 reiserfs_for_each_xattr+0x1a8/0xb50
 reiserfs_delete_xattrs+0x1f/0x90
 reiserfs_evict_inode+0x207/0x470
 evict+0x2a4/0x620
 reiserfs_create+0x328/0x660
 path_openat+0x12b9/0x2e30
 do_filp_open+0x26d/0x500
 do_sys_openat2+0x128/0x4f0
 __x64_sys_openat+0x247/0x290
 do_syscall_64+0x41/0xc0
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe0e3e8c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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:00007fe0e4bea168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fe0e3fac120 RCX: 00007fe0e3e8c0f9
RDX: 000000000000275a RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007fe0e3ee7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe17fc934f R14: 00007fe0e4bea300 R15: 0000000000022000
 </TASK>

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-upstream-fs 2023/02/08 07:03 upstream 513c1a3d3f19 15c3d445 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in open_xa_dir
ci2-upstream-fs 2023/01/12 13:48 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in open_xa_dir
ci-upstream-kasan-gce-root 2022/12/27 06:27 upstream 1b929c02afd3 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in open_xa_dir
* Struck through repros no longer work on HEAD.