syzbot


possible deadlock in ocfs2_calc_xattr_init (2)

Status: upstream: reported on 2025/09/21 08:44
Reported-by: syzbot+cd2e0cbc5b21ab15c2ca@syzkaller.appspotmail.com
First crash: 48d, last: 12d
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 possible deadlock in ocfs2_calc_xattr_init 4 7 28d 118d 0/2 upstream: reported on 2025/07/13 05:28
linux-5.15 possible deadlock in ocfs2_calc_xattr_init (2) 4 9 30d 119d 0/3 upstream: reported on 2025/07/12 15:36
upstream possible deadlock in ocfs2_calc_xattr_init ocfs2 4 214 4d02h 401d 0/29 upstream: reported on 2024/10/04 01:35
linux-6.1 possible deadlock in ocfs2_calc_xattr_init 4 6 307d 340d 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 244d 421d 0/3 auto-obsoleted due to no activity on 2025/06/17 06:29

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.7.404/6865 is trying to acquire lock:
ffff0000fbce2378 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_calc_xattr_init+0x1c4/0xb9c fs/ocfs2/xattr.c:631

but task is already holding lock:
ffff0000e270c2c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
ffff0000e270c2c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_reserve_suballoc_bits+0x12c/0x3cd4 fs/ocfs2/suballoc.c:782

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}:
       down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
       inode_lock include/linux/fs.h:758 [inline]
       ocfs2_remove_inode fs/ocfs2/inode.c:655 [inline]
       ocfs2_wipe_inode fs/ocfs2/inode.c:818 [inline]
       ocfs2_delete_inode fs/ocfs2/inode.c:1079 [inline]
       ocfs2_evict_inode+0x1248/0x3d2c fs/ocfs2/inode.c:1219
       evict+0x3c8/0x810 fs/inode.c:705
       iput_final fs/inode.c:1834 [inline]
       iput+0x764/0x7f4 fs/inode.c:1860
       ocfs2_dentry_iput+0x1d4/0x2d4 fs/ocfs2/dcache.c:418
       dentry_unlink_inode+0x348/0x438 fs/dcache.c:403
       __dentry_kill+0x320/0x598 fs/dcache.c:611
       dentry_kill+0xc8/0x248 fs/dcache.c:-1
       dput+0x238/0x454 fs/dcache.c:918
       ovl_check_rename_whiteout fs/overlayfs/super.c:1325 [inline]
       ovl_make_workdir fs/overlayfs/super.c:1424 [inline]
       ovl_get_workdir+0x858/0x1068 fs/overlayfs/super.c:1539
       ovl_fill_super+0x139c/0x2294 fs/overlayfs/super.c:2095
       mount_nodev+0x68/0x104 fs/super.c:1489
       ovl_mount+0x3c/0x50 fs/overlayfs/super.c:2186
       legacy_get_tree+0xd4/0x16c fs/fs_context.c:632
       vfs_get_tree+0x90/0x274 fs/super.c:1573
       do_new_mount+0x228/0x810 fs/namespace.c:3078
       path_mount+0x5b4/0xe78 fs/namespace.c:3408
       do_mount fs/namespace.c:3421 [inline]
       __do_sys_mount fs/namespace.c:3629 [inline]
       __se_sys_mount fs/namespace.c:3606 [inline]
       __arm64_sys_mount+0x49c/0x584 fs/namespace.c:3606
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #2 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]){+.+.}-{3:3}:
       down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
       inode_lock include/linux/fs.h:758 [inline]
       ocfs2_del_inode_from_orphan+0x100/0x608 fs/ocfs2/namei.c:2713
       ocfs2_dio_end_io_write fs/ocfs2/aops.c:2333 [inline]
       ocfs2_dio_end_io+0x3f4/0xed8 fs/ocfs2/aops.c:2431
       dio_complete+0x230/0x70c fs/direct-io.c:271
       __blockdev_direct_IO+0x2780/0x318c fs/direct-io.c:1326
       ocfs2_direct_IO+0x208/0x280 fs/ocfs2/aops.c:2468
       generic_file_direct_write+0x31c/0x620 mm/filemap.c:3770
       __generic_file_write_iter+0x1bc/0x37c mm/filemap.c:3930
       ocfs2_file_write_iter+0x1300/0x1bf4 fs/ocfs2/file.c:2469
       call_write_iter include/linux/fs.h:2265 [inline]
       aio_write+0x54c/0x798 fs/aio.c:1615
       __io_submit_one fs/aio.c:-1 [inline]
       io_submit_one+0x7a8/0x11cc fs/aio.c:2034
       __do_sys_io_submit fs/aio.c:2093 [inline]
       __se_sys_io_submit fs/aio.c:2063 [inline]
       __arm64_sys_io_submit+0x268/0x3e4 fs/aio.c:2063
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #1 (&oi->ip_alloc_sem){++++}-{3:3}:
       down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
       ocfs2_try_remove_refcount_tree+0xb4/0x2d8 fs/ocfs2/refcounttree.c:932
       ocfs2_xattr_set+0x45c/0xe98 fs/ocfs2/xattr.c:3673
       ocfs2_xattr_trusted_set+0x4c/0x64 fs/ocfs2/xattr.c:7349
       __vfs_removexattr+0x370/0x38c fs/xattr.c:479
       __vfs_removexattr_locked+0x1d0/0x208 fs/xattr.c:514
       vfs_removexattr+0x80/0x190 fs/xattr.c:536
       ovl_do_removexattr fs/overlayfs/overlayfs.h:270 [inline]
       ovl_removexattr fs/overlayfs/overlayfs.h:278 [inline]
       ovl_make_workdir fs/overlayfs/super.c:1456 [inline]
       ovl_get_workdir+0xa10/0x1068 fs/overlayfs/super.c:1539
       ovl_fill_super+0x139c/0x2294 fs/overlayfs/super.c:2095
       mount_nodev+0x68/0x104 fs/super.c:1489
       ovl_mount+0x3c/0x50 fs/overlayfs/super.c:2186
       legacy_get_tree+0xd4/0x16c fs/fs_context.c:632
       vfs_get_tree+0x90/0x274 fs/super.c:1573
       do_new_mount+0x228/0x810 fs/namespace.c:3078
       path_mount+0x5b4/0xe78 fs/namespace.c:3408
       do_mount fs/namespace.c:3421 [inline]
       __do_sys_mount fs/namespace.c:3629 [inline]
       __se_sys_mount fs/namespace.c:3606 [inline]
       __arm64_sys_mount+0x49c/0x584 fs/namespace.c:3606
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #0 (&oi->ip_xattr_sem){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain kernel/locking/lockdep.c:3825 [inline]
       __lock_acquire+0x293c/0x6544 kernel/locking/lockdep.c:5049
       lock_acquire+0x20c/0x644 kernel/locking/lockdep.c:5662
       down_read+0x64/0x304 kernel/locking/rwsem.c:1520
       ocfs2_calc_xattr_init+0x1c4/0xb9c fs/ocfs2/xattr.c:631
       ocfs2_mknod+0xafc/0x1f18 fs/ocfs2/namei.c:330
       ocfs2_create+0x19c/0x4f0 fs/ocfs2/namei.c:674
       lookup_open fs/namei.c:3490 [inline]
       open_last_lookups fs/namei.c:3558 [inline]
       path_openat+0x112c/0x2680 fs/namei.c:3788
       do_filp_open+0x174/0x344 fs/namei.c:3818
       do_sys_openat2+0x128/0x3d8 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __arm64_sys_openat+0x120/0x154 fs/open.c:1345
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

other info that might help us debug this:

Chain exists of:
  &oi->ip_xattr_sem --> &ocfs2_sysfile_lock_key[args->fi_sysfile_type] --> &ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2);
                               lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
                               lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2);
  lock(&oi->ip_xattr_sem);

 *** DEADLOCK ***

3 locks held by syz.7.404/6865:
 #0: ffff0000fac92460 (sb_writers#19){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
 #1: ffff0000fbce2648 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #1: ffff0000fbce2648 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: open_last_lookups fs/namei.c:3555 [inline]
 #1: ffff0000fbce2648 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: path_openat+0x5e4/0x2680 fs/namei.c:3788
 #2: ffff0000e270c2c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #2: ffff0000e270c2c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#2){+.+.}-{3:3}, at: ocfs2_reserve_suballoc_bits+0x12c/0x3cd4 fs/ocfs2/suballoc.c:782

stack backtrace:
CPU: 0 PID: 6865 Comm: syz.7.404 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/30/2025
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack+0x30/0x40 lib/dump_stack.c:88
 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106
 dump_stack+0x1c/0x5c lib/dump_stack.c:113
 print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2048
 check_noncircular+0x240/0x2d4 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain kernel/locking/lockdep.c:3825 [inline]
 __lock_acquire+0x293c/0x6544 kernel/locking/lockdep.c:5049
 lock_acquire+0x20c/0x644 kernel/locking/lockdep.c:5662
 down_read+0x64/0x304 kernel/locking/rwsem.c:1520
 ocfs2_calc_xattr_init+0x1c4/0xb9c fs/ocfs2/xattr.c:631
 ocfs2_mknod+0xafc/0x1f18 fs/ocfs2/namei.c:330
 ocfs2_create+0x19c/0x4f0 fs/ocfs2/namei.c:674
 lookup_open fs/namei.c:3490 [inline]
 open_last_lookups fs/namei.c:3558 [inline]
 path_openat+0x112c/0x2680 fs/namei.c:3788
 do_filp_open+0x174/0x344 fs/namei.c:3818
 do_sys_openat2+0x128/0x3d8 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __arm64_sys_openat+0x120/0x154 fs/open.c:1345
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
netlink: 4 bytes leftover after parsing attributes in process `syz.7.404'.
nbd: socks must be embedded in a SOCK_ITEM attr

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/27 06:44 linux-6.1.y 8e6e2188d949 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_calc_xattr_init
2025/09/21 08:43 linux-6.1.y 363a599da6d9 67c37560 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_calc_xattr_init
* Struck through repros no longer work on HEAD.