syzbot


possible deadlock in delete_one_xattr (2)

Status: auto-obsoleted due to no activity on 2024/03/16 04:41
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+7a278bf8bfa794494110@syzkaller.appspotmail.com
First crash: 635d, last: 351d
Cause bisection: introduced by (bisect log) :
commit 9df085f3c9a2d4658a9fe323d70c200aa00ede93
Author: Amir Goldstein <amir73il@gmail.com>
Date: Mon Sep 3 06:12:09 2018 +0000

  ovl: relax requirement for non null uuid of lower fs

Crash: possible deadlock in delete_one_xattr (log)
Repro: C syz .config
  
Fix bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [reiserfs?] possible deadlock in delete_one_xattr (2) 1 (4) 2023/09/25 10:14
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in delete_one_xattr reiserfs 2 653d 713d 0/1 upstream: reported on 2022/12/10 02:38
linux-5.15 possible deadlock in delete_one_xattr origin:upstream C error 9 27d 207d 0/3 upstream: reported C repro on 2024/04/30 00:40
linux-6.1 possible deadlock in delete_one_xattr 15 64d 100d 0/3 upstream: reported on 2024/08/14 16:50
upstream possible deadlock in delete_one_xattr reiserfs C error 4 653d 653d 0/28 closed as invalid on 2023/02/08 16:28
linux-4.14 possible deadlock in delete_one_xattr reiserfs 1 653d 653d 0/1 upstream: reported on 2023/02/08 17:45
Last patch testing requests (7)
Created Duration User Patch Repo Result
2024/02/15 14:50 22m retest repro upstream OK log
2024/02/15 09:53 20m retest repro upstream OK log
2023/12/07 03:16 1h24m retest repro upstream report log
2023/11/19 14:50 22m retest repro linux-next OK log
2023/11/02 05:00 1h41m retest repro upstream report log
2023/09/19 18:49 13m retest repro upstream report log
2023/09/10 05:50 22m retest repro linux-next report log
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2023/12/05 07:56 1h11m bisect fix upstream error job log
2023/09/27 23:49 1h46m bisect fix upstream OK (0) job log log
2023/07/11 15:32 2h33m bisect fix upstream OK (0) job log log
Cause bisection attempts (2)
Created Duration User Patch Repo Result
2023/09/25 00:10 5h53m bisect upstream OK (1) job log log
2023/05/08 16:57 7h06m bisect upstream error job log
marked invalid by nogikh@google.com

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.6.0-rc6-syzkaller-00043-gdd72f9c7e512 #0 Not tainted
------------------------------------------------------
syz-executor326/5036 is trying to acquire lock:
ffff888072ef2b00 (&type->i_mutex_dir_key#6/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline]
ffff888072ef2b00 (&type->i_mutex_dir_key#6/2){+.+.}-{3:3}, at: xattr_rmdir fs/reiserfs/xattr.c:107 [inline]
ffff888072ef2b00 (&type->i_mutex_dir_key#6/2){+.+.}-{3:3}, at: delete_one_xattr+0x13e/0x2d0 fs/reiserfs/xattr.c:339

but task is already holding lock:
ffff888072ef03e0 (&type->i_mutex_dir_key#6/3){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline]
ffff888072ef03e0 (&type->i_mutex_dir_key#6/3){+.+.}-{3:3}, at: reiserfs_for_each_xattr+0x737/0x990 fs/reiserfs/xattr.c:310

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&type->i_mutex_dir_key#6/3){+.+.}-{3:3}:
       down_write_nested+0x97/0x200 kernel/locking/rwsem.c:1689
       inode_lock_nested include/linux/fs.h:837 [inline]
       open_xa_root fs/reiserfs/xattr.c:128 [inline]
       open_xa_dir+0x142/0x8d0 fs/reiserfs/xattr.c:153
       xattr_lookup+0x1f/0x380 fs/reiserfs/xattr.c:396
       reiserfs_xattr_set_handle+0x103/0xb50 fs/reiserfs/xattr.c:535
       reiserfs_xattr_set+0x46a/0x5c0 fs/reiserfs/xattr.c:635
       trusted_set+0xa8/0xd0 fs/reiserfs/xattr_trusted.c:31
       __vfs_setxattr+0x173/0x1d0 fs/xattr.c:201
       __vfs_setxattr_noperm+0x127/0x5e0 fs/xattr.c:235
       __vfs_setxattr_locked+0x17e/0x250 fs/xattr.c:296
       vfs_setxattr+0x146/0x350 fs/xattr.c:322
       ovl_do_setxattr fs/overlayfs/overlayfs.h:299 [inline]
       ovl_setxattr fs/overlayfs/overlayfs.h:311 [inline]
       ovl_make_workdir fs/overlayfs/super.c:762 [inline]
       ovl_get_workdir fs/overlayfs/super.c:874 [inline]
       ovl_fill_super+0x13fa/0x6450 fs/overlayfs/super.c:1419
       vfs_get_super fs/super.c:1335 [inline]
       get_tree_nodev+0xd6/0x180 fs/super.c:1354
       vfs_get_tree+0x8c/0x370 fs/super.c:1750
       do_new_mount fs/namespace.c:3335 [inline]
       path_mount+0x1492/0x1ed0 fs/namespace.c:3662
       do_mount fs/namespace.c:3675 [inline]
       __do_sys_mount fs/namespace.c:3884 [inline]
       __se_sys_mount fs/namespace.c:3861 [inline]
       __x64_sys_mount+0x293/0x310 fs/namespace.c:3861
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (&type->i_mutex_dir_key#6){++++}-{3:3}:
       down_write_nested+0x97/0x200 kernel/locking/rwsem.c:1689
       inode_lock_nested include/linux/fs.h:837 [inline]
       lock_two_inodes+0x1b2/0x1e0 fs/inode.c:1127
       vfs_rename+0x4f0/0x1c30 fs/namei.c:4832
       do_renameat2+0xc3c/0xdc0 fs/namei.c:5012
       __do_sys_rename fs/namei.c:5058 [inline]
       __se_sys_rename fs/namei.c:5056 [inline]
       __x64_sys_rename+0x81/0xa0 fs/namei.c:5056
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&type->i_mutex_dir_key#6/2){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3868 [inline]
       __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136
       lock_acquire kernel/locking/lockdep.c:5753 [inline]
       lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718
       down_write_nested+0x97/0x200 kernel/locking/rwsem.c:1689
       inode_lock_nested include/linux/fs.h:837 [inline]
       xattr_rmdir fs/reiserfs/xattr.c:107 [inline]
       delete_one_xattr+0x13e/0x2d0 fs/reiserfs/xattr.c:339
       reiserfs_for_each_xattr+0x746/0x990 fs/reiserfs/xattr.c:312
       reiserfs_delete_xattrs+0x1f/0x90 fs/reiserfs/xattr.c:365
       reiserfs_evict_inode+0x302/0x570 fs/reiserfs/inode.c:53
       evict+0x2ed/0x6b0 fs/inode.c:664
       iput_final fs/inode.c:1775 [inline]
       iput.part.0+0x55e/0x7a0 fs/inode.c:1801
       iput+0x5c/0x80 fs/inode.c:1791
       dentry_unlink_inode+0x292/0x430 fs/dcache.c:401
       __dentry_kill+0x3b8/0x640 fs/dcache.c:607
       dentry_kill fs/dcache.c:745 [inline]
       dput+0x6de/0xf80 fs/dcache.c:913
       cleanup_mnt+0x1fa/0x3d0 fs/namespace.c:1253
       task_work_run+0x14d/0x240 kernel/task_work.c:180
       ptrace_notify+0x10c/0x130 kernel/signal.c:2387
       ptrace_report_syscall include/linux/ptrace.h:411 [inline]
       ptrace_report_syscall_exit include/linux/ptrace.h:473 [inline]
       syscall_exit_work kernel/entry/common.c:251 [inline]
       syscall_exit_to_user_mode_prepare+0x120/0x220 kernel/entry/common.c:278
       __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
       syscall_exit_to_user_mode+0xd/0x60 kernel/entry/common.c:296
       do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  &type->i_mutex_dir_key#6/2 --> &type->i_mutex_dir_key#6 --> &type->i_mutex_dir_key#6/3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&type->i_mutex_dir_key#6/3);
                               lock(&type->i_mutex_dir_key#6);
                               lock(&type->i_mutex_dir_key#6/3);
  lock(&type->i_mutex_dir_key#6/2);

 *** DEADLOCK ***

1 lock held by syz-executor326/5036:
 #0: ffff888072ef03e0 (&type->i_mutex_dir_key#6/3){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline]
 #0: ffff888072ef03e0 (&type->i_mutex_dir_key#6/3){+.+.}-{3:3}, at: reiserfs_for_each_xattr+0x737/0x990 fs/reiserfs/xattr.c:310

stack backtrace:
CPU: 0 PID: 5036 Comm: syz-executor326 Not tainted 6.6.0-rc6-syzkaller-00043-gdd72f9c7e512 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 check_noncircular+0x311/0x3f0 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:3868 [inline]
 __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136
 lock_acquire kernel/locking/lockdep.c:5753 [inline]
 lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718
 down_write_nested+0x97/0x200 kernel/locking/rwsem.c:1689
 inode_lock_nested include/linux/fs.h:837 [inline]
 xattr_rmdir fs/reiserfs/xattr.c:107 [inline]
 delete_one_xattr+0x13e/0x2d0 fs/reiserfs/xattr.c:339
 reiserfs_for_each_xattr+0x746/0x990 fs/reiserfs/xattr.c:312
 reiserfs_delete_xattrs+0x1f/0x90 fs/reiserfs/xattr.c:365
 reiserfs_evict_inode+0x302/0x570 fs/reiserfs/inode.c:53
 evict+0x2ed/0x6b0 fs/inode.c:664
 iput_final fs/inode.c:1775 [inline]
 iput.part.0+0x55e/0x7a0 fs/inode.c:1801
 iput+0x5c/0x80 fs/inode.c:1791
 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401
 __dentry_kill+0x3b8/0x640 fs/dcache.c:607
 dentry_kill fs/dcache.c:745 [inline]
 dput+0x6de/0xf80 fs/dcache.c:913
 cleanup_mnt+0x1fa/0x3d0 fs/namespace.c:1253
 task_work_run+0x14d/0x240 kernel/task_work.c:180
 ptrace_notify+0x10c/0x130 kernel/signal.c:2387
 ptrace_report_syscall include/linux/ptrace.h:411 [inline]
 ptrace_report_syscall_exit include/linux/ptrace.h:473 [inline]
 syscall_exit_work kernel/entry/common.c:251 [inline]
 syscall_exit_to_user_mode_prepare+0x120/0x220 kernel/entry/common.c:278
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0xd/0x60 kernel/entry/common.c:296
 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f201933f547
Code: 07 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fffe97f5688 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f201933f547
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007fffe97f5740
RBP: 00007fffe97f5740 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000206 R12: 00007fffe97f67b0
R13: 0000555556be16c0 R14: 431bde82d7b634db R15: 00007fffe97f67d0
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/10/19 04:50 upstream dd72f9c7e512 342b9c55 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in delete_one_xattr
2023/05/08 16:47 upstream ac9a78681b92 90c93c40 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root possible deadlock in delete_one_xattr
2023/05/29 15:53 linux-next 715abedee4cd cf184559 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root possible deadlock in delete_one_xattr
2023/02/26 10:33 upstream 2fcd07b7ccd5 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in delete_one_xattr
* Struck through repros no longer work on HEAD.