syzbot


possible deadlock in ext4_xattr_inode_iget (2)

Status: fixed on 2024/03/20 11:33
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+352d78bd60c8e9d6ecdc@syzkaller.appspotmail.com
Fix commit: 6f861765464f fs: Block writes to mounted block devices
First crash: 523d, last: 326d
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
  
Fix bisection: fixed by (bisect log) :
commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000

  fs: Block writes to mounted block devices

  
Discussions (4)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in ext4_xattr_inode_iget (2) 1 (3) 2024/03/11 17:54
[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
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_xattr_inode_iget ext4 C done 351 533d 691d 22/28 fixed on 2023/07/01 16:05
linux-5.15 possible deadlock in ext4_xattr_inode_iget C error 85 57d 636d 0/3 upstream: reported C repro on 2023/03/12 00:08
linux-6.1 possible deadlock in ext4_xattr_inode_iget origin:upstream missing-backport C error 89 74d 635d 0/3 upstream: reported C repro on 2023/03/12 10:40
upstream possible deadlock in ext4_xattr_inode_iget (3) ext4 C error done 183 65d 247d 28/28 fixed on 2024/11/13 12:19
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/03/09 15:56 31m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci OK log
2024/03/09 07:34 26m retest repro upstream OK log
2024/03/09 07:34 23m retest repro upstream OK log
2024/03/09 07:34 25m retest repro upstream OK log
2024/03/09 07:34 25m retest repro upstream OK log
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

Sample crash report:
EXT4-fs: Ignoring removed oldalloc option
EXT4-fs (loop0): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc3-syzkaller-g2cc14f52aeb7 #0 Not tainted
------------------------------------------------------
syz-executor268/6316 is trying to acquire lock:
ffff0000dec78e00 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
ffff0000dec78e00 (&ea_inode->i_rwsem#8/1){+.+.}-{3:3}, at: ext4_xattr_inode_iget+0x344/0x4dc fs/ext4/xattr.c:461

but task is already holding lock:
ffff0000dec79688 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1094/0x1618 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+0x50/0xc0 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+0x26cc/0x30a8 fs/ext4/xattr.c:1719
       ext4_xattr_ibody_set+0x104/0x328 fs/ext4/xattr.c:2287
       ext4_xattr_set_handle+0xb64/0x12d0 fs/ext4/xattr.c:2444
       ext4_xattr_set+0x1e0/0x354 fs/ext4/xattr.c:2558
       ext4_xattr_trusted_set+0x4c/0x64 fs/ext4/xattr_trusted.c:38
       __vfs_setxattr+0x3d8/0x400 fs/xattr.c:201
       __vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:235
       __vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:296
       vfs_setxattr+0x1a8/0x344 fs/xattr.c:322
       do_setxattr fs/xattr.c:630 [inline]
       setxattr+0x208/0x29c fs/xattr.c:653
       path_setxattr+0x17c/0x258 fs/xattr.c:672
       __do_sys_lsetxattr fs/xattr.c:695 [inline]
       __se_sys_lsetxattr fs/xattr.c:691 [inline]
       __arm64_sys_lsetxattr+0xbc/0xd8 fs/xattr.c:691
       __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
       el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
       do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
       el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
       el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
       el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

-> #0 (&ea_inode->i_rwsem#8/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+0x3384/0x763c kernel/locking/lockdep.c:5137
       lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754
       down_write+0x50/0xc0 kernel/locking/rwsem.c:1579
       inode_lock include/linux/fs.h:802 [inline]
       ext4_xattr_inode_iget+0x344/0x4dc fs/ext4/xattr.c:461
       ext4_xattr_inode_get+0x12c/0x37c 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+0xbc8/0x16c0 fs/ext4/xattr.c:2834
       __ext4_expand_extra_isize+0x290/0x348 fs/ext4/inode.c:5812
       ext4_try_to_expand_extra_isize fs/ext4/inode.c:5855 [inline]
       __ext4_mark_inode_dirty+0x448/0x848 fs/ext4/inode.c:5933
       ext4_setattr+0x10fc/0x1618 fs/ext4/inode.c:5443
       notify_change+0x9d4/0xc8c fs/attr.c:499
       do_truncate+0x1c0/0x28c fs/open.c:66
       handle_truncate fs/namei.c:3280 [inline]
       do_open fs/namei.c:3626 [inline]
       path_openat+0x2170/0x2888 fs/namei.c:3779
       do_filp_open+0x1bc/0x3cc fs/namei.c:3809
       do_sys_openat2+0x124/0x1b8 fs/open.c:1440
       do_sys_open fs/open.c:1455 [inline]
       __do_sys_openat fs/open.c:1471 [inline]
       __se_sys_openat fs/open.c:1466 [inline]
       __arm64_sys_openat+0x1f0/0x240 fs/open.c:1466
       __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
       invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
       el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
       do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
       el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
       el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
       el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

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#8/1);
                               lock(&ei->i_data_sem/3);
  lock(&ea_inode->i_rwsem#8/1);

 *** DEADLOCK ***

5 locks held by syz-executor268/6316:
 #0: ffff0000d4c16418 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:404
 #1: ffff0000dec79800 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline]
 #1: ffff0000dec79800 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:64
 #2: ffff0000dec799a0 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:847 [inline]
 #2: ffff0000dec799a0 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_setattr+0xc40/0x1618 fs/ext4/inode.c:5401
 #3: ffff0000dec79688 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x1094/0x1618 fs/ext4/inode.c:5440
 #4: ffff0000dec794c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline]
 #4: ffff0000dec794c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5852 [inline]
 #4: ffff0000dec794c8 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x3c8/0x848 fs/ext4/inode.c:5933

stack backtrace:
CPU: 0 PID: 6316 Comm: syz-executor268 Not tainted 6.7.0-rc3-syzkaller-g2cc14f52aeb7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233
 show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
 dump_stack+0x1c/0x28 lib/dump_stack.c:113
 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060
 check_noncircular+0x310/0x404 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+0x3384/0x763c kernel/locking/lockdep.c:5137
 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754
 down_write+0x50/0xc0 kernel/locking/rwsem.c:1579
 inode_lock include/linux/fs.h:802 [inline]
 ext4_xattr_inode_iget+0x344/0x4dc fs/ext4/xattr.c:461
 ext4_xattr_inode_get+0x12c/0x37c 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+0xbc8/0x16c0 fs/ext4/xattr.c:2834
 __ext4_expand_extra_isize+0x290/0x348 fs/ext4/inode.c:5812
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5855 [inline]
 __ext4_mark_inode_dirty+0x448/0x848 fs/ext4/inode.c:5933
 ext4_setattr+0x10fc/0x1618 fs/ext4/inode.c:5443
 notify_change+0x9d4/0xc8c fs/attr.c:499
 do_truncate+0x1c0/0x28c fs/open.c:66
 handle_truncate fs/namei.c:3280 [inline]
 do_open fs/namei.c:3626 [inline]
 path_openat+0x2170/0x2888 fs/namei.c:3779
 do_filp_open+0x1bc/0x3cc fs/namei.c:3809
 do_sys_openat2+0x124/0x1b8 fs/open.c:1440
 do_sys_open fs/open.c:1455 [inline]
 __do_sys_openat fs/open.c:1471 [inline]
 __se_sys_openat fs/open.c:1466 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1466
 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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/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/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/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 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.