syzbot


possible deadlock in mark_as_free_ex

Status: upstream: reported syz repro on 2025/07/03 04:12
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+05e6ebe1716156baf6fe@syzkaller.appspotmail.com
First crash: 58d, last: 3d18h
Bug presence (1)
Date Name Commit Repro Result
2025/08/23 upstream (ToT) 8d245acc1e88 syz [report] possible deadlock in mark_as_free_ex
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in mark_as_free_ex (2) ntfs3 4 C done 3030 4h23m 295d 0/29 upstream: reported C repro on 2024/11/08 07:38
upstream possible deadlock in mark_as_free_ex ntfs3 4 3 816d 821d 0/29 auto-obsoleted due to no activity on 2023/09/13 11:34

Sample crash report:
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.6.102-syzkaller #0 Not tainted
------------------------------------------------------
syz.0.26/5984 is trying to acquire lock:
ffff8880261b2270 (&wnd->rw_lock){++++}-{3:3}, at: mark_as_free_ex+0x3e/0x380 fs/ntfs3/fsntfs.c:2484

but task is already holding lock:
ffff88805ee001b0 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_truncate fs/ntfs3/file.c:396 [inline]
ffff88805ee001b0 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs3_setattr+0x6cd/0xb60 fs/ntfs3/file.c:706

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->file.run_lock#2){++++}-{3:3}:
       down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
       run_unpack_ex+0x7e6/0xba0 fs/ntfs3/run.c:1117
       ntfs_read_mft fs/ntfs3/inode.c:401 [inline]
       ntfs_iget5+0x22e3/0x3750 fs/ntfs3/inode.c:533
       dir_search_u+0x1e0/0x2b0 fs/ntfs3/dir.c:264
       ntfs_atomic_open+0x23b/0x520 fs/ntfs3/namei.c:408
       atomic_open fs/namei.c:3351 [inline]
       lookup_open fs/namei.c:3459 [inline]
       open_last_lookups fs/namei.c:3556 [inline]
       path_openat+0xf27/0x3190 fs/namei.c:3786
       do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
       do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
       do_sys_open fs/open.c:1434 [inline]
       __do_sys_creat fs/open.c:1512 [inline]
       __se_sys_creat fs/open.c:1506 [inline]
       __x64_sys_creat+0x90/0xb0 fs/open.c:1506
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&wnd->rw_lock){++++}-{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+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       down_write_nested+0x9e/0x1f0 kernel/locking/rwsem.c:1689
       mark_as_free_ex+0x3e/0x380 fs/ntfs3/fsntfs.c:2484
       run_deallocate_ex+0x188/0x2e0 fs/ntfs3/attrib.c:122
       attr_set_size+0xeb5/0x2c60 fs/ntfs3/attrib.c:754
       ntfs_truncate fs/ntfs3/file.c:397 [inline]
       ntfs3_setattr+0x78f/0xb60 fs/ntfs3/file.c:706
       notify_change+0xb0d/0xe10 fs/attr.c:499
       do_truncate+0x19b/0x220 fs/open.c:66
       handle_truncate fs/namei.c:3291 [inline]
       do_open fs/namei.c:3636 [inline]
       path_openat+0x298c/0x3190 fs/namei.c:3789
       do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
       do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
       do_sys_open fs/open.c:1434 [inline]
       __do_sys_creat fs/open.c:1512 [inline]
       __se_sys_creat fs/open.c:1506 [inline]
       __x64_sys_creat+0x90/0xb0 fs/open.c:1506
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->file.run_lock#2);
                               lock(&wnd->rw_lock);
                               lock(&ni->file.run_lock#2);
  lock(&wnd->rw_lock);

 *** DEADLOCK ***

4 locks held by syz.0.26/5984:
 #0: ffff8880261b4418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:403
 #1: ffff88805ee003b0 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
 #1: ffff88805ee003b0 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: do_truncate+0x187/0x220 fs/open.c:64
 #2: ffff88805ee00100 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1119 [inline]
 #2: ffff88805ee00100 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_truncate fs/ntfs3/file.c:394 [inline]
 #2: ffff88805ee00100 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs3_setattr+0x6bc/0xb60 fs/ntfs3/file.c:706
 #3: ffff88805ee001b0 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs_truncate fs/ntfs3/file.c:396 [inline]
 #3: ffff88805ee001b0 (&ni->file.run_lock#2){++++}-{3:3}, at: ntfs3_setattr+0x6cd/0xb60 fs/ntfs3/file.c:706

stack backtrace:
CPU: 0 PID: 5984 Comm: syz.0.26 Not tainted 6.6.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 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+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 down_write_nested+0x9e/0x1f0 kernel/locking/rwsem.c:1689
 mark_as_free_ex+0x3e/0x380 fs/ntfs3/fsntfs.c:2484
 run_deallocate_ex+0x188/0x2e0 fs/ntfs3/attrib.c:122
 attr_set_size+0xeb5/0x2c60 fs/ntfs3/attrib.c:754
 ntfs_truncate fs/ntfs3/file.c:397 [inline]
 ntfs3_setattr+0x78f/0xb60 fs/ntfs3/file.c:706
 notify_change+0xb0d/0xe10 fs/attr.c:499
 do_truncate+0x19b/0x220 fs/open.c:66
 handle_truncate fs/namei.c:3291 [inline]
 do_open fs/namei.c:3636 [inline]
 path_openat+0x298c/0x3190 fs/namei.c:3789
 do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
 do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
 do_sys_open fs/open.c:1434 [inline]
 __do_sys_creat fs/open.c:1512 [inline]
 __se_sys_creat fs/open.c:1506 [inline]
 __x64_sys_creat+0x90/0xb0 fs/open.c:1506
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fe1b838ebe9
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:00007fe1b92c1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007fe1b85b5fa0 RCX: 00007fe1b838ebe9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00002000000002c0
RBP: 00007fe1b8411e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe1b85b6038 R14: 00007fe1b85b5fa0 R15: 00007fff740da768
 </TASK>

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/23 20:59 linux-6.6.y bb9c90ab9c5a bf27483f .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/26 16:09 linux-6.6.y bb9c90ab9c5a e12e5ba4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/26 16:08 linux-6.6.y bb9c90ab9c5a e12e5ba4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/23 19:41 linux-6.6.y bb9c90ab9c5a bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/23 11:33 linux-6.6.y bb9c90ab9c5a bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/23 11:32 linux-6.6.y bb9c90ab9c5a bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/20 03:38 linux-6.6.y bb9c90ab9c5a 79512909 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/15 08:33 linux-6.6.y 3a8ababb8b6a 1804e95e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/06 23:20 linux-6.6.y 3a8ababb8b6a 9a42d6b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/08/02 04:22 linux-6.6.y 3a8ababb8b6a 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/07/29 05:59 linux-6.6.y dbcb8d8e4163 c4a95487 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/07/29 05:59 linux-6.6.y dbcb8d8e4163 c4a95487 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/07/03 04:12 linux-6.6.y 3f5b4c104b7d 115ceea7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
2025/07/03 04:12 linux-6.6.y 3f5b4c104b7d 115ceea7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mark_as_free_ex
* Struck through repros no longer work on HEAD.