syzbot


possible deadlock in ocfs2_xattr_set

Status: upstream: reported on 2024/09/25 09:02
Reported-by: syzbot+c0d46b51c54922dc038f@syzkaller.appspotmail.com
First crash: 57d, last: 16h24m
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in ocfs2_xattr_set 56 1d20h 68d 0/3 upstream: reported on 2024/09/14 01:11
upstream possible deadlock in ocfs2_xattr_set ocfs2 768 6h11m 72d 0/28 upstream: reported on 2024/09/10 05:07

Sample crash report:
ocfs2: Mounting device (7,4) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
6.1.118-syzkaller #0 Not tainted
------------------------------------------------------
syz.4.12/4384 is trying to acquire lock:
ffff888070d45f48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
ffff888070d45f48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{3:3}, at: ocfs2_xattr_set+0xe96/0x1930 fs/ocfs2/xattr.c:3626

but task is already holding lock:
ffff888070d631b8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_xattr_set+0x62f/0x1930 fs/ocfs2/xattr.c:3587

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&oi->ip_xattr_sem){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       ocfs2_init_acl+0x398/0x930 fs/ocfs2/acl.c:365
       ocfs2_mknod+0x1f75/0x2e20 fs/ocfs2/namei.c:408
       ocfs2_create+0x1c0/0x4e0 fs/ocfs2/namei.c:672
       lookup_open fs/namei.c:3482 [inline]
       open_last_lookups fs/namei.c:3550 [inline]
       path_openat+0x12f1/0x2e60 fs/namei.c:3780
       do_filp_open+0x230/0x480 fs/namei.c:3810
       do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_open fs/open.c:1342 [inline]
       __se_sys_open fs/open.c:1338 [inline]
       __x64_sys_open+0x221/0x270 fs/open.c:1338
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (jbd2_handle){++++}-{0:0}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       jbd2_journal_lock_updates+0xa6/0x380 fs/jbd2/transaction.c:880
       __ocfs2_flush_truncate_log+0x2ef/0x12a0 fs/ocfs2/alloc.c:6022
       ocfs2_flush_truncate_log+0x4b/0x60 fs/ocfs2/alloc.c:6069
       ocfs2_sync_fs+0x121/0x380 fs/ocfs2/super.c:402
       sync_filesystem+0x1bc/0x220 fs/sync.c:66
       generic_shutdown_super+0x6b/0x340 fs/super.c:474
       kill_block_super+0x7a/0xe0 fs/super.c:1470
       deactivate_locked_super+0xa0/0x110 fs/super.c:332
       cleanup_mnt+0x490/0x520 fs/namespace.c:1186
       task_work_run+0x246/0x300 kernel/task_work.c:203
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
       syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
       do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_write+0x36/0x60 kernel/locking/rwsem.c:1573
       inode_lock include/linux/fs.h:758 [inline]
       ocfs2_xattr_set+0xe96/0x1930 fs/ocfs2/xattr.c:3626
       __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
       __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
       vfs_setxattr+0x21d/0x420 fs/xattr.c:309
       do_setxattr fs/xattr.c:594 [inline]
       setxattr+0x250/0x2b0 fs/xattr.c:617
       path_setxattr+0x1bc/0x2a0 fs/xattr.c:636
       __do_sys_lsetxattr fs/xattr.c:659 [inline]
       __se_sys_lsetxattr fs/xattr.c:655 [inline]
       __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:655
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

3 locks held by syz.4.12/4384:
 #0: ffff888057b96460 (sb_writers#16){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff888070d63488 (&type->i_mutex_dir_key#11){++++}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #1: ffff888070d63488 (&type->i_mutex_dir_key#11){++++}-{3:3}, at: vfs_setxattr+0x1dd/0x420 fs/xattr.c:308
 #2: ffff888070d631b8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_xattr_set+0x62f/0x1930 fs/ocfs2/xattr.c:3587

stack backtrace:
CPU: 1 PID: 4384 Comm: syz.4.12 Not tainted 6.1.118-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 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+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 down_write+0x36/0x60 kernel/locking/rwsem.c:1573
 inode_lock include/linux/fs.h:758 [inline]
 ocfs2_xattr_set+0xe96/0x1930 fs/ocfs2/xattr.c:3626
 __vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
 __vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
 vfs_setxattr+0x21d/0x420 fs/xattr.c:309
 do_setxattr fs/xattr.c:594 [inline]
 setxattr+0x250/0x2b0 fs/xattr.c:617
 path_setxattr+0x1bc/0x2a0 fs/xattr.c:636
 __do_sys_lsetxattr fs/xattr.c:659 [inline]
 __se_sys_lsetxattr fs/xattr.c:655 [inline]
 __x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:655
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f33d717e819
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:00007f33d801d038 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 00007f33d7335fa0 RCX: 00007f33d717e819
RDX: 0000000000000000 RSI: 00000000200002c0 RDI: 0000000020000280
RBP: 00007f33d71f175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f33d7335fa0 R15: 00007fff1d776438
 </TASK>
OCFS2: ERROR (device loop4): int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *, handle_t *, u32, u32, struct ocfs2_suballoc_result *): Chain allocator dinode 23 has 4294967295 used bits but only 16777215 total
On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
OCFS2: Returning error to the calling process.
(syz.4.12,4384,0):ocfs2_claim_suballoc_bits:1983 ERROR: status = -5
(syz.4.12,4384,0):__ocfs2_claim_clusters:2355 ERROR: status = -5
(syz.4.12,4384,0):__ocfs2_claim_clusters:2363 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_block_group_alloc_contig:433 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_block_group_alloc:705 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_block_group_alloc:758 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_reserve_suballoc_bits:833 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_reserve_suballoc_bits:850 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_reserve_new_metadata_blocks:990 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_reserve_new_metadata_blocks:1013 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_init_xattr_set_ctxt:3284 ERROR: status = -5
(syz.4.12,4384,0):ocfs2_xattr_set:3641 ERROR: status = -5

Crashes (60):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/20 23:18 linux-6.1.y b67dc5c9ade9 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/11/08 04:37 linux-6.1.y 7c15117f9468 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/11/06 03:22 linux-6.1.y 7c15117f9468 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/11/04 17:41 linux-6.1.y 7c15117f9468 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/11/03 06:33 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/30 06:00 linux-6.1.y 7ec6f9fa3d97 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/30 06:00 linux-6.1.y 7ec6f9fa3d97 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/30 04:06 linux-6.1.y 7ec6f9fa3d97 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/27 18:50 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/22 23:39 linux-6.1.y 7ec6f9fa3d97 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/22 05:22 linux-6.1.y 54d90d17e8ce a93682b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/18 21:53 linux-6.1.y 54d90d17e8ce cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/18 21:53 linux-6.1.y 54d90d17e8ce cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/16 16:05 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/16 15:42 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/11 22:57 linux-6.1.y aa4cd140bba5 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/11 08:12 linux-6.1.y aa4cd140bba5 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/11 08:12 linux-6.1.y aa4cd140bba5 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/08 14:35 linux-6.1.y aa4cd140bba5 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/03 16:16 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/03 16:15 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/03 16:15 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/03 02:09 linux-6.1.y aa4cd140bba5 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/02 21:13 linux-6.1.y aa4cd140bba5 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/10/02 21:13 linux-6.1.y aa4cd140bba5 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/09/25 09:02 linux-6.1.y e526b12bf916 349a68c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/09/25 09:02 linux-6.1.y e526b12bf916 349a68c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_xattr_set
2024/11/20 05:49 linux-6.1.y b67dc5c9ade9 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/19 23:26 linux-6.1.y b67dc5c9ade9 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/17 19:05 linux-6.1.y b67dc5c9ade9 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/16 04:29 linux-6.1.y 59d7b1a7104a cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/06 23:34 linux-6.1.y 7c15117f9468 df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/05 16:45 linux-6.1.y 7c15117f9468 da38b4c9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/03 11:39 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/03 08:55 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/02 02:28 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/11/02 02:28 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/30 20:55 linux-6.1.y 7ec6f9fa3d97 fb888278 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/29 07:30 linux-6.1.y 7ec6f9fa3d97 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/29 07:29 linux-6.1.y 7ec6f9fa3d97 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/29 00:23 linux-6.1.y 7ec6f9fa3d97 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/29 00:20 linux-6.1.y 7ec6f9fa3d97 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/29 00:20 linux-6.1.y 7ec6f9fa3d97 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/28 17:59 linux-6.1.y 7ec6f9fa3d97 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/28 02:36 linux-6.1.y 7ec6f9fa3d97 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/22 21:34 linux-6.1.y 7ec6f9fa3d97 a93682b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/22 03:31 linux-6.1.y 54d90d17e8ce f1e4447c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/16 23:11 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/16 23:10 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/12 02:12 linux-6.1.y aa4cd140bba5 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/11 09:48 linux-6.1.y aa4cd140bba5 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/11 09:47 linux-6.1.y aa4cd140bba5 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/03 14:32 linux-6.1.y aa4cd140bba5 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
2024/10/03 13:12 linux-6.1.y aa4cd140bba5 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_xattr_set
* Struck through repros no longer work on HEAD.