syzbot


possible deadlock in mark_as_free_ex (2)

Status: upstream: reported syz repro on 2024/11/08 07:38
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+8df514c431bd240c5644@syzkaller.appspotmail.com
First crash: 32d, last: 6m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] possible deadlock in mark_as_free_ex (2) 0 (2) 2024/11/29 01:43
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in mark_as_free_ex ntfs3 3 550d 555d 0/28 auto-obsoleted due to no activity on 2023/09/13 11:34

Sample crash report:
loop2: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.12.0-syzkaller-10689-g7af08b57bcb9 #0 Not tainted
------------------------------------------------------
syz.2.134/6316 is trying to acquire lock:
ffff88807b844270 (&wnd->rw_lock){++++}-{4:4}, at: mark_as_free_ex+0x3e/0x390 fs/ntfs3/fsntfs.c:2484

but task is already holding lock:
ffff88805ac3adc0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:505 [inline]
ffff88805ac3adc0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_setattr+0x6d3/0xb80 fs/ntfs3/file.c:824

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->file.run_lock#2){++++}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524
       run_unpack_ex+0x55e/0x9e0 fs/ntfs3/run.c:1119
       ntfs_read_mft fs/ntfs3/inode.c:401 [inline]
       ntfs_iget5+0x1f9a/0x37b0 fs/ntfs3/inode.c:537
       dir_search_u+0x2fe/0x3a0 fs/ntfs3/dir.c:264
       ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85
       lookup_one_qstr_excl+0x11f/0x260 fs/namei.c:1692
       do_renameat2+0x670/0x13f0 fs/namei.c:5165
       __do_sys_rename fs/namei.c:5271 [inline]
       __se_sys_rename fs/namei.c:5269 [inline]
       __x64_sys_rename+0x82/0x90 fs/namei.c:5269
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&wnd->rw_lock){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1693
       mark_as_free_ex+0x3e/0x390 fs/ntfs3/fsntfs.c:2484
       run_deallocate_ex+0x244/0x5f0 fs/ntfs3/attrib.c:122
       attr_set_size+0x168d/0x4300 fs/ntfs3/attrib.c:753
       ntfs_truncate fs/ntfs3/file.c:506 [inline]
       ntfs_setattr+0x7a4/0xb80 fs/ntfs3/file.c:824
       notify_change+0xbca/0xe90 fs/attr.c:552
       do_truncate+0x220/0x310 fs/open.c:65
       handle_truncate fs/namei.c:3449 [inline]
       do_open fs/namei.c:3832 [inline]
       path_openat+0x2e1e/0x3590 fs/namei.c:3987
       do_filp_open+0x27f/0x4e0 fs/namei.c:4014
       do_sys_openat2+0x13e/0x1d0 fs/open.c:1402
       do_sys_open fs/open.c:1417 [inline]
       __do_sys_creat fs/open.c:1495 [inline]
       __se_sys_creat fs/open.c:1489 [inline]
       __x64_sys_creat+0x123/0x170 fs/open.c:1489
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

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.2.134/6316:
 #0: ffff88807b842420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
 #1: ffff88805ac3afa8 (&sb->s_type->i_mutex_key#22){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:818 [inline]
 #1: ffff88805ac3afa8 (&sb->s_type->i_mutex_key#22){+.+.}-{4:4}, at: do_truncate+0x20c/0x310 fs/open.c:63
 #2: ffff88805ac3ad10 (&ni->ni_lock#3/5){+.+.}-{4:4}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
 #2: ffff88805ac3ad10 (&ni->ni_lock#3/5){+.+.}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:503 [inline]
 #2: ffff88805ac3ad10 (&ni->ni_lock#3/5){+.+.}-{4:4}, at: ntfs_setattr+0x6bf/0xb80 fs/ntfs3/file.c:824
 #3: ffff88805ac3adc0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:505 [inline]
 #3: ffff88805ac3adc0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_setattr+0x6d3/0xb80 fs/ntfs3/file.c:824

stack backtrace:
CPU: 1 UID: 0 PID: 6316 Comm: syz.2.134 Not tainted 6.12.0-syzkaller-10689-g7af08b57bcb9 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206
 check_prev_add kernel/locking/lockdep.c:3161 [inline]
 check_prevs_add kernel/locking/lockdep.c:3280 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1693
 mark_as_free_ex+0x3e/0x390 fs/ntfs3/fsntfs.c:2484
 run_deallocate_ex+0x244/0x5f0 fs/ntfs3/attrib.c:122
 attr_set_size+0x168d/0x4300 fs/ntfs3/attrib.c:753
 ntfs_truncate fs/ntfs3/file.c:506 [inline]
 ntfs_setattr+0x7a4/0xb80 fs/ntfs3/file.c:824
 notify_change+0xbca/0xe90 fs/attr.c:552
 do_truncate+0x220/0x310 fs/open.c:65
 handle_truncate fs/namei.c:3449 [inline]
 do_open fs/namei.c:3832 [inline]
 path_openat+0x2e1e/0x3590 fs/namei.c:3987
 do_filp_open+0x27f/0x4e0 fs/namei.c:4014
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1402
 do_sys_open fs/open.c:1417 [inline]
 __do_sys_creat fs/open.c:1495 [inline]
 __se_sys_creat fs/open.c:1489 [inline]
 __x64_sys_creat+0x123/0x170 fs/open.c:1489
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb9f1980809
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:00007fb9f282a058 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007fb9f1b45fa0 RCX: 00007fb9f1980809
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200002c0
RBP: 00007fb9f19f393e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fb9f1b45fa0 R15: 00007ffcedbec7c8
 </TASK>

Crashes (454):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/29 01:42 upstream 7af08b57bcb9 5df23865 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/07 00:15 upstream 9a6e8c7c3a02 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 23:00 upstream 9a6e8c7c3a02 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 20:15 upstream b8f52214c61a 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 17:19 upstream b8f52214c61a 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mark_as_free_ex
2024/12/06 15:50 upstream b8f52214c61a 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 13:55 upstream b8f52214c61a 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 12:28 upstream b8f52214c61a 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 09:06 upstream b8f52214c61a 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 04:41 upstream 5076001689e4 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/06 02:19 upstream 5076001689e4 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 23:05 upstream 5076001689e4 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mark_as_free_ex
2024/12/05 16:12 upstream feffde684ac2 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 14:12 upstream feffde684ac2 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 13:45 upstream feffde684ac2 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/05 06:06 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 05:04 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 02:42 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/05 01:14 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 23:56 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/04 21:33 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/04 19:57 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 16:52 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mark_as_free_ex
2024/12/04 14:57 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/04 10:27 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 10:27 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 07:42 upstream ceb8bf2ceaa7 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 06:36 upstream ceb8bf2ceaa7 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 04:49 upstream ceb8bf2ceaa7 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/04 00:57 upstream ceb8bf2ceaa7 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 22:15 upstream ceb8bf2ceaa7 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 20:32 upstream ceb8bf2ceaa7 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mark_as_free_ex
2024/12/03 19:06 upstream ceb8bf2ceaa7 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 17:55 upstream ceb8bf2ceaa7 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 15:24 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 12:53 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 11:52 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 10:32 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 08:45 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 06:53 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mark_as_free_ex
2024/12/03 05:43 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 03:16 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/03 01:39 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/02 23:30 upstream e70140ba0d2b b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/02 21:57 upstream e70140ba0d2b b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in mark_as_free_ex
2024/12/02 19:28 upstream e70140ba0d2b bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/05 18:02 linux-next af2ea8ab7a54 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/03 23:24 linux-next f486c8aa16b8 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/02 20:30 linux-next f486c8aa16b8 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
2024/12/02 17:18 linux-next f486c8aa16b8 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
2024/11/08 06:46 linux-next 74741a050b79 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
2024/11/04 07:27 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mark_as_free_ex
* Struck through repros no longer work on HEAD.