syzbot


WARNING: locking bug in ext4_xattr_inode_update_ref (3)

Status: upstream: reported C repro on 2024/04/11 09:48
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+3ca210b2c10e57015b3c@syzkaller.appspotmail.com
First crash: 227d, last: 73d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] WARNING: locking bug in ext4_xattr_inode_update_ref (3) 1 (3) 2024/04/11 12:02
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 WARNING: locking bug in ext4_xattr_inode_update_ref ext4 C error 2 665d 669d 0/1 upstream: reported C repro on 2023/01/21 20:53
linux-4.14 WARNING: locking bug in ext4_xattr_inode_update_ref ext4 C 2 638d 674d 0/1 upstream: reported C repro on 2023/01/16 15:56
upstream WARNING: locking bug in ext4_xattr_inode_update_ref ext4 C error 4 552d 679d 22/28 fixed on 2023/07/01 16:05
upstream WARNING: locking bug in ext4_xattr_inode_update_ref (2) ext4 syz 1 483d 479d 0/28 auto-obsoleted due to no activity on 2023/09/25 03:27
Last patch testing requests (8)
Created Duration User Patch Repo Result
2024/11/17 12:38 16m retest repro upstream OK log
2024/10/01 17:59 33m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2024/09/08 12:12 20m retest repro upstream report log
2024/07/23 16:17 22m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2024/06/30 11:41 23m retest repro upstream report log
2024/05/14 09:17 1h51m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2024/04/21 09:47 16m retest repro upstream report log
2024/04/11 11:39 21m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f2f80ac80987 OK log

Sample crash report:
------------[ cut here ]------------
Looking for class "&ea_inode->i_rwsem" with key ext4_fs_type, but found a different class "&sb->s_type->i_mutex_key" with the same key
WARNING: CPU: 1 PID: 7155 at kernel/locking/lockdep.c:935 look_up_lock_class+0xec/0x158 kernel/locking/lockdep.c:932
Modules linked in:
CPU: 1 PID: 7155 Comm: syz-executor.4 Not tainted 6.9.0-rc4-syzkaller-g6a71d2909427 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
pstate: 604010c5 (nZCv daIF +PAN -UAO -TCO -DIT +SSBS BTYPE=--)
pc : look_up_lock_class+0xec/0x158 kernel/locking/lockdep.c:932
lr : look_up_lock_class+0xec/0x158 kernel/locking/lockdep.c:932
sp : ffff80009e1768e0
x29: ffff80009e1768e0 x28: dfff800000000000 x27: ffff700013c2eda0
x26: ffff8000936a5580 x25: ffff8000936a5000 x24: 0000000000000000
x23: ffff700013c2ed58 x22: 0000000000000000 x21: ffff80008f219df8
x20: ffff0000dfb5c000 x19: ffff8000922d3cb0 x18: 0000000000000008
x17: 0000000000000000 x16: ffff80008ae725bc x15: 0000000000000001
x14: 1fffe000367bde02 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000002 x10: 0000000000ff0100 x9 : 95806845256a6700
x8 : 95806845256a6700 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff80009e176058 x4 : ffff80008ef650a0 x3 : ffff8000805e616c
x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000000
Call trace:
 look_up_lock_class+0xec/0x158 kernel/locking/lockdep.c:932
 register_lock_class+0x8c/0x6ac kernel/locking/lockdep.c:1284
 __lock_acquire+0x184/0x763c kernel/locking/lockdep.c:5014
 lock_acquire+0x248/0x73c kernel/locking/lockdep.c:5754
 down_write+0x50/0xc0 kernel/locking/rwsem.c:1579
 inode_lock include/linux/fs.h:795 [inline]
 ext4_xattr_inode_update_ref+0xac/0x4e8 fs/ext4/xattr.c:1042
 ext4_xattr_inode_dec_ref fs/ext4/xattr.c:1093 [inline]
 ext4_xattr_set_entry+0x1340/0x33d4 fs/ext4/xattr.c:1729
 ext4_xattr_block_set+0x560/0x2b8c fs/ext4/xattr.c:1968
 ext4_xattr_set_handle+0xc68/0x12d0 fs/ext4/xattr.c:2443
 ext4_xattr_set+0x1e0/0x354 fs/ext4/xattr.c:2545
 ext4_xattr_trusted_set+0x4c/0x64 fs/ext4/xattr_trusted.c:38
 __vfs_setxattr+0x3d8/0x400 fs/xattr.c:200
 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:234
 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:295
 vfs_setxattr+0x1a8/0x344 fs/xattr.c:321
 do_setxattr fs/xattr.c:629 [inline]
 setxattr+0x208/0x29c fs/xattr.c:652
 path_setxattr+0x17c/0x258 fs/xattr.c:671
 __do_sys_setxattr fs/xattr.c:687 [inline]
 __se_sys_setxattr fs/xattr.c:683 [inline]
 __arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:683
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
irq event stamp: 2527
hardirqs last  enabled at (2527): [<ffff800080c2c848>] lookup_bh_lru fs/buffer.c:1385 [inline]
hardirqs last  enabled at (2527): [<ffff800080c2c848>] __find_get_block+0x3ac/0xdc4 fs/buffer.c:1397
hardirqs last disabled at (2526): [<ffff800080c2c504>] lookup_bh_lru fs/buffer.c:1362 [inline]
hardirqs last disabled at (2526): [<ffff800080c2c504>] __find_get_block+0x68/0xdc4 fs/buffer.c:1397
softirqs last  enabled at (264): [<ffff8000800218e4>] softirq_handle_end kernel/softirq.c:400 [inline]
softirqs last  enabled at (264): [<ffff8000800218e4>] __do_softirq+0xb10/0xd2c kernel/softirq.c:583
softirqs last disabled at (243): [<ffff80008002ad34>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:81
---[ end trace 0000000000000000 ]---

============================================
WARNING: possible recursive locking detected
6.9.0-rc4-syzkaller-g6a71d2909427 #0 Tainted: G        W         
--------------------------------------------
syz-executor.4/7155 is trying to acquire lock:
ffff0000dfb5c000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline]
ffff0000dfb5c000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: ext4_xattr_inode_update_ref+0xac/0x4e8 fs/ext4/xattr.c:1042

but task is already holding lock:
ffff0000e4db4000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline]
ffff0000e4db4000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: vfs_setxattr+0x17c/0x344 fs/xattr.c:320

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&sb->s_type->i_mutex_key#8);
  lock(&sb->s_type->i_mutex_key#8);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by syz-executor.4/7155:
 #0: ffff0000ce304420 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:409
 #1: ffff0000e4db4000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline]
 #1: ffff0000e4db4000 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: vfs_setxattr+0x17c/0x344 fs/xattr.c:320
 #2: ffff0000e4db3cc8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
 #2: ffff0000e4db3cc8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x1dc/0x12d0 fs/ext4/xattr.c:2358

stack backtrace:
CPU: 1 PID: 7155 Comm: syz-executor.4 Tainted: G        W          6.9.0-rc4-syzkaller-g6a71d2909427 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114
 dump_stack+0x1c/0x28 lib/dump_stack.c:123
 print_deadlock_bug+0x4e4/0x660 kernel/locking/lockdep.c:3012
 check_deadlock kernel/locking/lockdep.c:3062 [inline]
 validate_chain kernel/locking/lockdep.c:3856 [inline]
 __lock_acquire+0x5fe4/0x763c kernel/locking/lockdep.c:5137
 lock_acquire+0x248/0x73c kernel/locking/lockdep.c:5754
 down_write+0x50/0xc0 kernel/locking/rwsem.c:1579
 inode_lock include/linux/fs.h:795 [inline]
 ext4_xattr_inode_update_ref+0xac/0x4e8 fs/ext4/xattr.c:1042
 ext4_xattr_inode_dec_ref fs/ext4/xattr.c:1093 [inline]
 ext4_xattr_set_entry+0x1340/0x33d4 fs/ext4/xattr.c:1729
 ext4_xattr_block_set+0x560/0x2b8c fs/ext4/xattr.c:1968
 ext4_xattr_set_handle+0xc68/0x12d0 fs/ext4/xattr.c:2443
 ext4_xattr_set+0x1e0/0x354 fs/ext4/xattr.c:2545
 ext4_xattr_trusted_set+0x4c/0x64 fs/ext4/xattr_trusted.c:38
 __vfs_setxattr+0x3d8/0x400 fs/xattr.c:200
 __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:234
 __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:295
 vfs_setxattr+0x1a8/0x344 fs/xattr.c:321
 do_setxattr fs/xattr.c:629 [inline]
 setxattr+0x208/0x29c fs/xattr.c:652
 path_setxattr+0x17c/0x258 fs/xattr.c:671
 __do_sys_setxattr fs/xattr.c:687 [inline]
 __se_sys_setxattr fs/xattr.c:683 [inline]
 __arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:683
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/30 08:34 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6a71d2909427 27e33c58 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 WARNING: locking bug in ext4_xattr_inode_update_ref
2024/04/07 09:43 upstream f2f80ac80987 ca620dd8 .config console log report syz C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-qemu-upstream WARNING: locking bug in ext4_xattr_inode_update_ref
* Struck through repros no longer work on HEAD.