syzbot


possible deadlock in ext4_xattr_set_handle

Status: fixed on 2023/07/17 13:09
Reported-by: syzbot+d3ecdc484479fe6658f9@syzkaller.appspotmail.com
Fix commit: bdbfbb7d5057 ext4: add EA_INODE checking to ext4_iget()
First crash: 495d, last: 403d
Fix bisection: fixed by (bisect log) :
commit bdbfbb7d5057c738b152772f4c7697cee06eaf50
Author: Theodore Ts'o <tytso@mit.edu>
Date: Wed May 24 03:49:48 2023 +0000

  ext4: add EA_INODE checking to ext4_iget()

  
Bug presence (1)
Date Name Commit Repro Result
2023/06/27 upstream (ToT) 1ef6663a587b C Didn't crash
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ext4_xattr_set_handle (5) ext4 72 19d 62d 0/27 upstream: reported on 2024/05/13 11:53
upstream possible deadlock in ext4_xattr_set_handle (3) ext4 C 451 380d 537d 22/27 fixed on 2023/07/01 16:05
upstream possible deadlock in ext4_xattr_set_handle (4) ext4 5 176d 297d 0/27 auto-obsoleted due to no activity on 2024/04/29 16:11
upstream possible deadlock in ext4_xattr_set_handle ext4 1 1000d 996d 0/27 auto-closed as invalid on 2022/02/15 19:59
upstream possible deadlock in ext4_xattr_set_handle (2) ext4 1 734d 733d 0/27 auto-obsoleted due to no activity on 2022/11/08 16:24
linux-4.19 possible deadlock in ext4_xattr_set_handle ext4 1 527d 527d 0/1 upstream: reported on 2023/02/03 16:43
linux-6.1 possible deadlock in ext4_xattr_set_handle C done 15 403d 491d 3/3 fixed on 2023/07/17 13:09

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: quota,nodelalloc,errors=remount-ro,grpid,. Quota mode: writeback.
ext4 filesystem being mounted at /root/file0 supports timestamps until 2038 (0x7fffffff)
======================================================
WARNING: possible circular locking dependency detected
5.15.113-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor709/3496 is trying to acquire lock:
ffff88807508da80 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
ffff88807508da80 (&ei->xattr_sem){++++}-{3:3}, at: ext4_xattr_set_handle+0x270/0x1560 fs/ext4/xattr.c:2322

but task is already holding lock:
ffff88807508dda8 (&ea_inode->i_rwsem#9/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
ffff88807508dda8 (&ea_inode->i_rwsem#9/1){+.+.}-{3:3}, at: vfs_setxattr+0x1dd/0x420 fs/xattr.c:302

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ea_inode->i_rwsem#9/1){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       down_write+0x97/0x170 kernel/locking/rwsem.c:1541
       inode_lock include/linux/fs.h:787 [inline]
       ext4_xattr_inode_create fs/ext4/xattr.c:1475 [inline]
       ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1558 [inline]
       ext4_xattr_set_entry+0x33c5/0x3c00 fs/ext4/xattr.c:1686
       ext4_xattr_block_set+0xb10/0x3680 fs/ext4/xattr.c:1992
       ext4_xattr_set_handle+0xdac/0x1560 fs/ext4/xattr.c:2407
       ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2508
       __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
       __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
       vfs_setxattr+0x21d/0x420 fs/xattr.c:303
       do_setxattr fs/xattr.c:588 [inline]
       setxattr+0x27e/0x2e0 fs/xattr.c:611
       path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
       __do_sys_setxattr fs/xattr.c:646 [inline]
       __se_sys_setxattr fs/xattr.c:642 [inline]
       __x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:642
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x61/0xcb

-> #0 (&ei->xattr_sem){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       down_write+0x97/0x170 kernel/locking/rwsem.c:1541
       ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
       ext4_xattr_set_handle+0x270/0x1560 fs/ext4/xattr.c:2322
       ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2508
       __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
       __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
       vfs_setxattr+0x21d/0x420 fs/xattr.c:303
       do_setxattr fs/xattr.c:588 [inline]
       setxattr+0x27e/0x2e0 fs/xattr.c:611
       path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
       __do_sys_setxattr fs/xattr.c:646 [inline]
       __se_sys_setxattr fs/xattr.c:642 [inline]
       __x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:642
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x61/0xcb

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ea_inode->i_rwsem#9/1);
                               lock(&ei->xattr_sem);
                               lock(&ea_inode->i_rwsem#9/1);
  lock(&ei->xattr_sem);

 *** DEADLOCK ***

2 locks held by syz-executor709/3496:
 #0: ffff888078ebc460 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377
 #1: ffff88807508dda8 (&ea_inode->i_rwsem#9/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
 #1: ffff88807508dda8 (&ea_inode->i_rwsem#9/1){+.+.}-{3:3}, at: vfs_setxattr+0x1dd/0x420 fs/xattr.c:302

stack backtrace:
CPU: 1 PID: 3496 Comm: syz-executor709 Not tainted 5.15.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
 down_write+0x97/0x170 kernel/locking/rwsem.c:1541
 ext4_write_lock_xattr fs/ext4/xattr.h:155 [inline]
 ext4_xattr_set_handle+0x270/0x1560 fs/ext4/xattr.c:2322
 ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2508
 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
 vfs_setxattr+0x21d/0x420 fs/xattr.c:303
 do_setxattr fs/xattr.c:588 [inline]
 setxattr+0x27e/0x2e0 fs/xattr.c:611
 path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
 __do_sys_setxattr fs/xattr.c:646 [inline]
 __se_sys_setxattr fs/xattr.c:642 [inline]
 __x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:642
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fbbb18268a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdd3d09ff8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fbbb18268a9
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000020000000
RBP: 00007fbbb17e6140 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbb

Crashes (42):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/29 17:32 linux-5.15.y 1fe619a7d252 cf184559 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/06/02 17:17 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/05/10 03:08 linux-5.15.y 8a7f2a5c5aa1 30aa2a7e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/02 06:19 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/06/01 13:27 linux-5.15.y 0ab06468cbd1 babc4389 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/03/22 17:22 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/03/18 03:24 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/03/07 20:13 linux-5.15.y d9b4a0c83a2d d7ea8bc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ext4_xattr_set_handle
2023/06/08 02:49 linux-5.15.y d7af3e5ba454 058b3a5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/05 17:32 linux-5.15.y d7af3e5ba454 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/04 11:47 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/02 02:35 linux-5.15.y 0ab06468cbd1 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/01 13:15 linux-5.15.y 0ab06468cbd1 babc4389 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/06/01 13:15 linux-5.15.y 0ab06468cbd1 babc4389 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/04/25 22:54 linux-5.15.y 3299fb36854f 65320f8e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/04/13 11:21 linux-5.15.y d86dfc4d95cd 82d5e53e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/04/06 18:54 linux-5.15.y d86dfc4d95cd 08707520 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/23 23:47 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/23 21:13 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/22 21:14 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/21 23:50 linux-5.15.y 8020ae3c051d 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/20 20:34 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/20 16:51 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/18 14:33 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/17 23:16 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/17 22:42 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/17 17:09 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/17 12:48 linux-5.15.y 8020ae3c051d 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/17 08:58 linux-5.15.y 8020ae3c051d 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/16 21:54 linux-5.15.y 2ddbd0f967b3 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/16 18:07 linux-5.15.y 2ddbd0f967b3 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/15 12:32 linux-5.15.y 2ddbd0f967b3 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/15 10:13 linux-5.15.y 2ddbd0f967b3 18b58603 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/14 14:00 linux-5.15.y 2ddbd0f967b3 0d5c4377 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/14 10:39 linux-5.15.y 2ddbd0f967b3 0d5c4377 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/13 15:23 linux-5.15.y 2ddbd0f967b3 026e2200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/13 10:30 linux-5.15.y 2ddbd0f967b3 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/12 21:31 linux-5.15.y bbf9f29bac04 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/12 16:10 linux-5.15.y bbf9f29bac04 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/12 13:07 linux-5.15.y bbf9f29bac04 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/12 02:43 linux-5.15.y d214f240b0f6 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
2023/03/07 17:51 linux-5.15.y d9b4a0c83a2d d7ea8bc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ext4_xattr_set_handle
* Struck through repros no longer work on HEAD.