syzbot


possible deadlock in ext4_xattr_inode_iget (2)

Status: upstream: reported C repro on 2023/07/06 17:31
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+352d78bd60c8e9d6ecdc@syzkaller.appspotmail.com
First crash: 241d, last: 44d
Cause bisection: introduced by (bisect log) :
commit a3c06ae158dd6fa8336157c31d9234689d068d02
Author: Parav Pandit <parav@nvidia.com>
Date: Tue Jan 5 10:32:03 2021 +0000

  vdpa_sim_net: Add support for user supported devices

Crash: possible deadlock in ext4_xattr_inode_iget (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[syzbot] Monthly ext4 report (Jan 2024) 0 (1) 2024/01/09 18:20
[syzbot] Monthly ext4 report (Dec 2023) 0 (1) 2023/12/10 10:05
[syzbot] Monthly ext4 report (Oct 2023) 0 (1) 2023/10/09 09:23
[syzbot] [ext4?] possible deadlock in ext4_xattr_inode_iget (2) 0 (1) 2023/07/06 17:31
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_xattr_inode_iget ext4 C done 351 252d 410d 22/26 fixed on 2023/07/01 16:05
linux-5.15 possible deadlock in ext4_xattr_inode_iget origin:upstream C 66 40d 354d 0/3 upstream: reported C repro on 2023/03/12 00:08
linux-6.1 possible deadlock in ext4_xattr_inode_iget origin:upstream C 38 12d 354d 0/3 upstream: reported C repro on 2023/03/12 10:40
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/01/29 22:35 23m retest repro upstream OK log
2024/01/29 22:35 27m retest repro upstream OK log
2024/01/29 22:35 22m retest repro upstream OK log
2024/01/29 22:35 22m retest repro upstream OK log
2024/01/15 18:06 18m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2024/01/15 15:40 31m retest repro upstream OK log
2024/01/15 15:12 34m retest repro upstream OK log
2024/01/15 15:05 23m retest repro upstream OK log
2023/12/30 02:49 35m retest repro upstream report log
2023/12/30 02:49 22m retest repro upstream report log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc5-syzkaller-00134-g3f7168591ebf #0 Not tainted
------------------------------------------------------
syz-executor738/5186 is trying to acquire lock:
ffff888075f677c0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
ffff888075f677c0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461

but task is already holding lock:
ffff888075f32688 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1b94/0x29d0 fs/ext4/inode.c:5440

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ei->i_data_sem/3){++++}-{3:3}:
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1579
       ext4_update_i_disksize fs/ext4/ext4.h:3381 [inline]
       ext4_xattr_inode_write fs/ext4/xattr.c:1446 [inline]
       ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1594 [inline]
       ext4_xattr_set_entry+0x3415/0x3ce0 fs/ext4/xattr.c:1719
       ext4_xattr_ibody_set+0x126/0x380 fs/ext4/xattr.c:2287
       ext4_xattr_set_handle+0x936/0x1420 fs/ext4/xattr.c:2444
       ext4_xattr_set+0x149/0x370 fs/ext4/xattr.c:2558
       __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
       do_setxattr+0x142/0x170 fs/xattr.c:630
       setxattr+0x159/0x170 fs/xattr.c:653
       path_setxattr+0x175/0x1d0 fs/xattr.c:672
       __do_sys_setxattr fs/xattr.c:688 [inline]
       __se_sys_setxattr fs/xattr.c:684 [inline]
       __x64_sys_setxattr+0xc4/0x160 fs/xattr.c:684
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

-> #0 (&ea_inode->i_rwsem#7/1){+.+.}-{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:3869 [inline]
       __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137
       lock_acquire kernel/locking/lockdep.c:5754 [inline]
       lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1579
       inode_lock include/linux/fs.h:802 [inline]
       ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461
       ext4_xattr_inode_get+0x170/0x840 fs/ext4/xattr.c:535
       ext4_xattr_move_to_block fs/ext4/xattr.c:2640 [inline]
       ext4_xattr_make_inode_space fs/ext4/xattr.c:2742 [inline]
       ext4_expand_extra_isize_ea+0x125a/0x1b20 fs/ext4/xattr.c:2834
       __ext4_expand_extra_isize+0x342/0x470 fs/ext4/inode.c:5812
       ext4_try_to_expand_extra_isize fs/ext4/inode.c:5855 [inline]
       __ext4_mark_inode_dirty+0x52b/0x810 fs/ext4/inode.c:5933
       ext4_setattr+0x1c08/0x29d0 fs/ext4/inode.c:5443
       notify_change+0x742/0x11c0 fs/attr.c:499
       do_truncate+0x15c/0x220 fs/open.c:66
       handle_truncate fs/namei.c:3280 [inline]
       do_open fs/namei.c:3626 [inline]
       path_openat+0x25a0/0x2c50 fs/namei.c:3779
       do_filp_open+0x1de/0x430 fs/namei.c:3809
       do_sys_openat2+0x176/0x1e0 fs/open.c:1440
       do_sys_open fs/open.c:1455 [inline]
       __do_sys_creat fs/open.c:1531 [inline]
       __se_sys_creat fs/open.c:1525 [inline]
       __x64_sys_creat+0xcd/0x120 fs/open.c:1525
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ei->i_data_sem/3);
                               lock(&ea_inode->i_rwsem#7/1);
                               lock(&ei->i_data_sem/3);
  lock(&ea_inode->i_rwsem#7/1);

 *** DEADLOCK ***

5 locks held by syz-executor738/5186:
 #0: ffff88807197e418 (sb_writers#5){.+.+}-{0:0}, at: do_open fs/namei.c:3615 [inline]
 #0: ffff88807197e418 (sb_writers#5){.+.+}-{0:0}, at: path_openat+0x2112/0x2c50 fs/namei.c:3779
 #1: ffff888075f32800 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
 #1: ffff888075f32800 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: do_truncate+0x14b/0x220 fs/open.c:64
 #2: ffff888075f329a0 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:847 [inline]
 #2: ffff888075f329a0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xdf1/0x29d0 fs/ext4/inode.c:5401
 #3: ffff888075f32688 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1b94/0x29d0 fs/ext4/inode.c:5440
 #4: ffff888075f324c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
 #4: ffff888075f324c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5852 [inline]
 #4: ffff888075f324c8 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x4a1/0x810 fs/ext4/inode.c:5933

stack backtrace:
CPU: 0 PID: 5186 Comm: syz-executor738 Not tainted 6.7.0-rc5-syzkaller-00134-g3f7168591ebf #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 check_noncircular+0x317/0x400 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:3869 [inline]
 __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
 down_write+0x3a/0x50 kernel/locking/rwsem.c:1579
 inode_lock include/linux/fs.h:802 [inline]
 ext4_xattr_inode_iget+0x173/0x430 fs/ext4/xattr.c:461
 ext4_xattr_inode_get+0x170/0x840 fs/ext4/xattr.c:535
 ext4_xattr_move_to_block fs/ext4/xattr.c:2640 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2742 [inline]
 ext4_expand_extra_isize_ea+0x125a/0x1b20 fs/ext4/xattr.c:2834
 __ext4_expand_extra_isize+0x342/0x470 fs/ext4/inode.c:5812
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5855 [inline]
 __ext4_mark_inode_dirty+0x52b/0x810 fs/ext4/inode.c:5933
 ext4_setattr+0x1c08/0x29d0 fs/ext4/inode.c:5443
 notify_change+0x742/0x11c0 fs/attr.c:499
 do_truncate+0x15c/0x220 fs/open.c:66
 handle_truncate fs/namei.c:3280 [inline]
 do_open fs/namei.c:3626 [inline]
 path_openat+0x25a0/0x2c50 fs/namei.c:3779
 do_filp_open+0x1de/0x430 fs/namei.c:3809
 do_sys_openat2+0x176/0x1e0 fs/open.c:1440
 do_sys_open fs/open.c:1455 [inline]
 __do_sys_creat fs/open.c:1531 [inline]
 __se_sys_creat fs/open.c:1525 [inline]
 __x64_sys_creat+0xcd/0x120 fs/open.c:1525
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f861e3af229
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 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:00007ffcfe1ee598 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007f861e3af229
RDX: 00007f861e3af229 RSI: 0000000000000000 RDI: 0000000020000040
RBP: 0000000000000000 R08: 00007ffcfe1ee5d0 R09: 00007ffcfe1ee5d0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcfe1ee5bc
R13: 0000000000000039 R14: 431bde82d7b634db R15: 00007ffcfe1ee5f0
 </TASK>

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/16 01:51 upstream 3f7168591ebf 3222d10c .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ext4_xattr_inode_iget
2023/12/11 20:06 upstream a39b6ac3781d 28b24332 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ext4_xattr_inode_iget
2023/12/11 18:23 upstream a39b6ac3781d 28b24332 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ext4_xattr_inode_iget
2023/12/11 16:39 upstream a39b6ac3781d 28b24332 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ext4_xattr_inode_iget
2023/12/02 21:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2cc14f52aeb7 f819d6f7 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ext4_xattr_inode_iget
2023/12/02 14:20 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2cc14f52aeb7 f819d6f7 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ext4_xattr_inode_iget
2024/01/01 14:50 upstream 610a9b8f49fb fb427a07 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root possible deadlock in ext4_xattr_inode_iget
2023/12/31 15:14 upstream 453f5db0619e fb427a07 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ext4_xattr_inode_iget
2023/10/01 11:07 upstream 3b517966c561 8e26a358 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/09/27 06:27 upstream 50768a425b46 0b6a67ac .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/09/27 04:47 upstream 50768a425b46 0b6a67ac .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/09/27 03:12 upstream 50768a425b46 0b6a67ac .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/07/02 17:28 upstream 995b406c7e97 bfc47836 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root possible deadlock in ext4_xattr_inode_iget
2023/09/25 14:00 upstream 6465e260f487 0b6a67ac .config console log report syz C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-qemu-upstream possible deadlock in ext4_xattr_inode_iget
2023/11/17 12:00 upstream 7475e51b8796 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/09/29 04:34 upstream 9ed22ae6be81 d265efd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ext4_xattr_inode_iget
2023/10/11 07:41 upstream 1c8b86a3799f 83165b57 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ext4_xattr_inode_iget
2023/09/25 21:58 upstream 6465e260f487 0b6a67ac .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ext4_xattr_inode_iget
2023/09/25 13:44 upstream 6465e260f487 0b6a67ac .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ext4_xattr_inode_iget
2023/09/25 15:39 upstream 6465e260f487 0b6a67ac .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ext4_xattr_inode_iget
2023/08/13 21:20 upstream 4c75bf7e4a0e 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ext4_xattr_inode_iget
2023/08/17 17:48 upstream 16931859a650 74b106b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ext4_xattr_inode_iget
* Struck through repros no longer work on HEAD.