syzbot


possible deadlock in ocfs2_calc_xattr_init

Status: upstream: reported on 2024/10/04 01:35
Subsystems: ocfs2
[Documentation on labels]
Reported-by: syzbot+6f7edba4b1e2ca109d7f@syzkaller.appspotmail.com
First crash: 334d, last: 7d09h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ocfs2?] possible deadlock in ocfs2_calc_xattr_init 0 (1) 2024/10/04 01:35
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 possible deadlock in ocfs2_calc_xattr_init 4 5 13d 48d 0/2 upstream: reported on 2025/07/13 05:28
linux-5.15 possible deadlock in ocfs2_calc_xattr_init (2) 4 5 21d 48d 0/3 upstream: reported on 2025/07/12 15:36
linux-6.1 possible deadlock in ocfs2_calc_xattr_init 4 6 236d 270d 0/3 auto-obsoleted due to no activity on 2025/04/15 19:53
linux-5.15 possible deadlock in ocfs2_calc_xattr_init 4 14 174d 350d 0/3 auto-obsoleted due to no activity on 2025/06/17 06:29

Sample crash report:
loop1: detected capacity change from 0 to 32768
ocfs2: Mounting device (7,1) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.2108/15849 is trying to acquire lock:
ffff888054b331b8 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_calc_xattr_init+0x20a/0xd80 fs/ocfs2/xattr.c:627

but task is already holding lock:
ffff888051399800 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
ffff888051399800 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x15e/0x4640 fs/ocfs2/suballoc.c:788

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
       inode_lock include/linux/fs.h:869 [inline]
       ocfs2_remove_inode fs/ocfs2/inode.c:731 [inline]
       ocfs2_wipe_inode fs/ocfs2/inode.c:894 [inline]
       ocfs2_delete_inode fs/ocfs2/inode.c:1155 [inline]
       ocfs2_evict_inode+0x153d/0x40e0 fs/ocfs2/inode.c:1292
       evict+0x504/0x9c0 fs/inode.c:810
       ocfs2_dentry_iput+0x247/0x370 fs/ocfs2/dcache.c:407
       __dentry_kill+0x209/0x660 fs/dcache.c:669
       dput+0x19f/0x2b0 fs/dcache.c:911
       do_renameat2+0x6de/0xa80 fs/namei.c:5280
       __do_sys_renameat2 fs/namei.c:5312 [inline]
       __se_sys_renameat2 fs/namei.c:5309 [inline]
       __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5309
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
       inode_lock include/linux/fs.h:869 [inline]
       ocfs2_del_inode_from_orphan+0x134/0x740 fs/ocfs2/namei.c:2730
       ocfs2_dio_end_io_write fs/ocfs2/aops.c:2306 [inline]
       ocfs2_dio_end_io+0x479/0x10f0 fs/ocfs2/aops.c:2404
       dio_complete+0x25b/0x790 fs/direct-io.c:281
       __blockdev_direct_IO+0x2e63/0x3490 fs/direct-io.c:1303
       ocfs2_direct_IO+0x25f/0x2d0 fs/ocfs2/aops.c:2441
       generic_file_direct_write+0x1db/0x3e0 mm/filemap.c:4109
       __generic_file_write_iter+0x11d/0x230 mm/filemap.c:4278
       ocfs2_file_write_iter+0x157a/0x1d10 fs/ocfs2/file.c:2469
       iter_file_splice_write+0x975/0x10e0 fs/splice.c:738
       do_splice_from fs/splice.c:938 [inline]
       direct_splice_actor+0x101/0x160 fs/splice.c:1161
       splice_direct_to_actor+0x5a8/0xcc0 fs/splice.c:1105
       do_splice_direct_actor fs/splice.c:1204 [inline]
       do_splice_direct+0x181/0x270 fs/splice.c:1230
       do_sendfile+0x4da/0x7e0 fs/read_write.c:1370
       __do_sys_sendfile64 fs/read_write.c:1431 [inline]
       __se_sys_sendfile64+0x13e/0x190 fs/read_write.c:1417
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
       ocfs2_try_remove_refcount_tree+0xb6/0x320 fs/ocfs2/refcounttree.c:932
       ocfs2_xattr_set+0x595/0x11f0 fs/ocfs2/xattr.c:3669
       ocfs2_set_acl+0x701/0x7b0 fs/ocfs2/acl.c:254
       ocfs2_iop_set_acl+0x1aa/0x2a0 fs/ocfs2/acl.c:286
       set_posix_acl fs/posix_acl.c:954 [inline]
       vfs_set_acl+0x887/0xb00 fs/posix_acl.c:1133
       do_setxattr fs/xattr.c:633 [inline]
       filename_setxattr+0x2e0/0x600 fs/xattr.c:665
       path_setxattrat+0x364/0x3a0 fs/xattr.c:713
       __do_sys_setxattr fs/xattr.c:747 [inline]
       __se_sys_setxattr fs/xattr.c:743 [inline]
       __x64_sys_setxattr+0xbc/0xe0 fs/xattr.c:743
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&oi->ip_xattr_sem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_read+0x46/0x2e0 kernel/locking/rwsem.c:1537
       ocfs2_calc_xattr_init+0x20a/0xd80 fs/ocfs2/xattr.c:627
       ocfs2_mknod+0xc92/0x2050 fs/ocfs2/namei.c:333
       ocfs2_mkdir+0x191/0x440 fs/ocfs2/namei.c:659
       vfs_mkdir+0x306/0x510 fs/namei.c:4366
       do_mkdirat+0x247/0x590 fs/namei.c:4399
       __do_sys_mkdirat fs/namei.c:4416 [inline]
       __se_sys_mkdirat fs/namei.c:4414 [inline]
       __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4414
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &oi->ip_xattr_sem --> &ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE] --> &ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);
                               lock(&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]);
                               lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);
  rlock(&oi->ip_xattr_sem);

 *** DEADLOCK ***

3 locks held by syz.1.2108/15849:
 #0: ffff88803480a428 (sb_writers#20){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:557
 #1: ffff888054b33480 (&type->i_mutex_dir_key#11/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:914 [inline]
 #1: ffff888054b33480 (&type->i_mutex_dir_key#11/1){+.+.}-{4:4}, at: filename_create+0x1f8/0x3c0 fs/namei.c:4139
 #2: ffff888051399800 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline]
 #2: ffff888051399800 (&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_reserve_suballoc_bits+0x15e/0x4640 fs/ocfs2/suballoc.c:788

stack backtrace:
CPU: 1 UID: 0 PID: 15849 Comm: syz.1.2108 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3165 [inline]
 check_prevs_add kernel/locking/lockdep.c:3284 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 down_read+0x46/0x2e0 kernel/locking/rwsem.c:1537
 ocfs2_calc_xattr_init+0x20a/0xd80 fs/ocfs2/xattr.c:627
 ocfs2_mknod+0xc92/0x2050 fs/ocfs2/namei.c:333
 ocfs2_mkdir+0x191/0x440 fs/ocfs2/namei.c:659
 vfs_mkdir+0x306/0x510 fs/namei.c:4366
 do_mkdirat+0x247/0x590 fs/namei.c:4399
 __do_sys_mkdirat fs/namei.c:4416 [inline]
 __se_sys_mkdirat fs/namei.c:4414 [inline]
 __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4414
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5d5858ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5d5949e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f5d587b6090 RCX: 00007f5d5858ebe9
RDX: 00000000000001c0 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007f5d58611e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5d587b6128 R14: 00007f5d587b6090 R15: 00007fff4a01e398
 </TASK>

Crashes (175):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/23 01:15 upstream a2e94e80790b bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/08/15 23:44 upstream 8d084337a32f 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/08/15 21:57 upstream 8d084337a32f 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/08/15 00:41 upstream 0cc53520e68b dcc075fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/08/08 10:47 upstream bec077162bd0 6a893178 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/08/08 08:43 upstream bec077162bd0 6a893178 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/30 17:54 upstream 4b290aae788e f8f2b4da .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/24 09:14 upstream 01a412d06bc5 0c1d6ded .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/21 12:29 upstream 89be9a83ccf1 0b3788a0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/21 00:17 upstream 89be9a83ccf1 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/14 13:15 upstream 347e9f5043c8 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/12 07:17 upstream 40f92e79b0aa 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/07/10 11:52 upstream 8c2e52ebbe88 19d4829f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/10 03:33 upstream 8c2e52ebbe88 956bd956 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/09 14:03 upstream 733923397fd9 f4e5e155 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/08 18:47 upstream d006330be3f7 abade794 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/08 15:29 upstream d7b8f8e20813 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/07/08 12:46 upstream d7b8f8e20813 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/08 11:37 upstream d7b8f8e20813 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/01 14:55 upstream 66701750d556 6e83b42d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/28 02:56 upstream 35e261cd95dd 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/27 07:55 upstream e34a79b96ab9 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/25 21:33 upstream 92ca6c498a5e 26d77996 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/21 19:27 upstream 3f75bfff44be d6cdfb8a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/19 06:25 upstream fb4d33ab452e ed3e87f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/17 12:24 upstream 9afe652958c3 417d98fa .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/16 07:22 upstream 08215f5486ec 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/09 10:25 upstream 19272b37aa4f 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/08 04:43 upstream 5b032cac6225 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/05/02 14:07 upstream ebd297a2affa 2bfec9c0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/05/01 09:22 upstream 4f79eaa2ceac ce7952f4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/04/23 13:59 upstream bc3372351d0c d971f7e2 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/04/20 17:48 upstream 6fea5fabd332 2a20f901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/04/20 11:18 upstream 119009db2674 2a20f901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2025/04/16 06:20 upstream 1a1d569a75f3 23b969b7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2024/09/30 06:47 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ocfs2_calc_xattr_init
2024/09/30 01:31 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/08/09 12:30 linux-next b1549501188c 32a0e5ed .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/08/03 22:51 linux-next 84b92a499e7e 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/08/03 10:23 linux-next 84b92a499e7e 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/20 08:37 linux-next d086c886ceb9 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/12 22:27 linux-next a62b7a37e6fc 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/07/08 09:39 linux-next 26ffb3d6f02c 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/15 20:47 linux-next bc6e0ba6c9ba 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/12 12:13 linux-next 0bb71d301869 98683f8f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/09 06:44 linux-next 475c850a7fdd 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/08 22:26 linux-next 475c850a7fdd 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/02 04:12 linux-next 3a83b350b5be 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
2025/06/01 01:54 linux-next 3a83b350b5be 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ocfs2_calc_xattr_init
* Struck through repros no longer work on HEAD.