syzbot


possible deadlock in delete_one_xattr

Status: upstream: reported on 2022/12/10 02:38
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+11b51b7d736765442d49@syzkaller.appspotmail.com
First crash: 714d, last: 653d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
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
upstream possible deadlock in delete_one_xattr (2) reiserfs C done error 4 352d 631d 0/28 auto-obsoleted due to no activity on 2024/03/16 04:41
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 654d 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

Sample crash report:
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 loop3): checking transaction log (loop3)
REISERFS (device loop3): Using r5 hash to sort names
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/16774 is trying to acquire lock:
000000006fdd34c0 (&type->i_mutex_dir_key#14/2){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
000000006fdd34c0 (&type->i_mutex_dir_key#14/2){+.+.}, at: xattr_rmdir fs/reiserfs/xattr.c:106 [inline]
000000006fdd34c0 (&type->i_mutex_dir_key#14/2){+.+.}, at: delete_one_xattr+0x13d/0x2d0 fs/reiserfs/xattr.c:338

but task is already holding lock:
000000006078994f (&type->i_mutex_dir_key#14/3){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
000000006078994f (&type->i_mutex_dir_key#14/3){+.+.}, at: reiserfs_for_each_xattr+0x6d3/0x920 fs/reiserfs/xattr.c:309

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&type->i_mutex_dir_key#14/3){+.+.}:
       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
       dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
       __dentry_kill+0x3c0/0x640 fs/dcache.c:566
       dentry_kill+0xc4/0x510 fs/dcache.c:685
       dput+0x55f/0x640 fs/dcache.c:846
       do_renameat2+0xb69/0xc70 fs/namei.c:4633
       __do_sys_renameat2 fs/namei.c:4664 [inline]
       __se_sys_renameat2 fs/namei.c:4661 [inline]
       __x64_sys_renameat2+0xba/0x150 fs/namei.c:4661
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&type->i_mutex_dir_key#14/2){+.+.}:
       down_write_nested+0x36/0x90 kernel/locking/rwsem.c:192
       inode_lock_nested include/linux/fs.h:783 [inline]
       xattr_rmdir fs/reiserfs/xattr.c:106 [inline]
       delete_one_xattr+0x13d/0x2d0 fs/reiserfs/xattr.c:338
       reiserfs_for_each_xattr+0x6e4/0x920 fs/reiserfs/xattr.c:311
       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
       dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
       d_delete+0x210/0x280 fs/dcache.c:2372
       vfs_rmdir.part.0+0x28a/0x3d0 fs/namei.c:3895
       vfs_rmdir fs/namei.c:3868 [inline]
       do_rmdir+0x3fd/0x490 fs/namei.c:3943
       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(&type->i_mutex_dir_key#14/3);
                               lock(&type->i_mutex_dir_key#14/2);
                               lock(&type->i_mutex_dir_key#14/3);
  lock(&type->i_mutex_dir_key#14/2);

 *** DEADLOCK ***

3 locks held by syz-executor.3/16774:
 #0: 00000000a48f6109 (sb_writers#28){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
 #0: 00000000a48f6109 (sb_writers#28){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360
 #1: 0000000064fd2b0f (&type->i_mutex_dir_key#14/1){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
 #1: 0000000064fd2b0f (&type->i_mutex_dir_key#14/1){+.+.}, at: do_rmdir+0x255/0x490 fs/namei.c:3931
 #2: 000000006078994f (&type->i_mutex_dir_key#14/3){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline]
 #2: 000000006078994f (&type->i_mutex_dir_key#14/3){+.+.}, at: reiserfs_for_each_xattr+0x6d3/0x920 fs/reiserfs/xattr.c:309

stack backtrace:
CPU: 1 PID: 16774 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
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]
 xattr_rmdir fs/reiserfs/xattr.c:106 [inline]
 delete_one_xattr+0x13d/0x2d0 fs/reiserfs/xattr.c:338
 reiserfs_for_each_xattr+0x6e4/0x920 fs/reiserfs/xattr.c:311
 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
 dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
 d_delete+0x210/0x280 fs/dcache.c:2372
 vfs_rmdir.part.0+0x28a/0x3d0 fs/namei.c:3895
 vfs_rmdir fs/namei.c:3868 [inline]
 do_rmdir+0x3fd/0x490 fs/namei.c:3943
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f5732f640f9
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:00007f57314d6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000054
RAX: ffffffffffffffda RBX: 00007f5733083f80 RCX: 00007f5732f640f9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000140
RBP: 00007f5732fbfae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe7de920ff R14: 00007f57314d6300 R15: 0000000000022000
REISERFS (device loop3): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop3): using ordered data mode
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 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 loop3): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop3): using ordered data mode
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 loop3): checking transaction log (loop3)
REISERFS (device loop3): Using r5 hash to sort names
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
device hsr_slave_1 left promiscuous mode
device hsr_slave_0 left promiscuous mode
team0 (unregistering): Port device team_slave_1 removed
team0 (unregistering): Port device team_slave_0 removed
bond0 (unregistering): Releasing backup interface bond_slave_1
bond0 (unregistering): Releasing backup interface bond_slave_0
bond0 (unregistering): Released all slaves
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.1'.
nf_conntrack: default automatic helper assignment has been turned off for security reasons and CT-based  firewall rule not found. Use the iptables CT target to attach helpers instead.
REISERFS (device loop3): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop3): using ordered data mode
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 loop3): checking transaction log (loop3)
can: request_module (can-proto-3) failed.
REISERFS (device loop3): Using r5 hash to sort names
base_sock_release(000000001f4ff15e) sk=          (null)
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
audit: type=1804 audit(1675873340.197:153): pid=16926 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir3159991537/syzkaller.hFPLq4/214/bus" dev="sda1" ino=14875 res=1
base_sock_release(0000000020b941e2) sk=0000000049aa601f
audit: type=1804 audit(1675873340.197:154): pid=16926 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.4" name="/root/syzkaller-testdir3159991537/syzkaller.hFPLq4/214/bus" dev="sda1" ino=14875 res=1
base_sock_release(00000000d4a8e22b) sk=000000005793c9fc
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256
batman_adv: batadv0: adding TT local entry ba:00:22:07:ff:ff to non-existent VLAN 256

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/08 16:22 linux-4.19.y 3f8a27f9e27b fc9c934e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in delete_one_xattr
2022/12/10 02:38 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in delete_one_xattr
* Struck through repros no longer work on HEAD.