syzbot


possible deadlock in ntfs_look_for_free_space

Status: upstream: reported on 2024/11/08 07:38
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+d27edf9f96ae85939222@syzkaller.appspotmail.com
First crash: 16d, last: 16h34m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] possible deadlock in ntfs_look_for_free_space 0 (1) 2024/11/08 07:38

Sample crash report:
Process accounting resumed
======================================================
WARNING: possible circular locking dependency detected
6.12.0-next-20241120-syzkaller #0 Not tainted
------------------------------------------------------
syz.5.295/7019 is trying to acquire lock:
ffff88805ea88270 (&wnd->rw_lock){++++}-{4:4}, at: ntfs_look_for_free_space+0x100/0x690 fs/ntfs3/fsntfs.c:362

but task is already holding lock:
ffff88805b3c01b0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_set_size+0x13d/0x200 fs/ntfs3/inode.c:852

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
       ntfs_dir_emit fs/ntfs3/dir.c:335 [inline]
       ntfs_read_hdr+0x700/0xb80 fs/ntfs3/dir.c:383
       ntfs_readdir+0x91f/0xf00 fs/ntfs3/dir.c:494
       iterate_dir+0x571/0x800 fs/readdir.c:108
       __do_sys_getdents64 fs/readdir.c:403 [inline]
       __se_sys_getdents64+0x1e2/0x4b0 fs/readdir.c:389
       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
       ntfs_look_for_free_space+0x100/0x690 fs/ntfs3/fsntfs.c:362
       attr_allocate_clusters+0x1d6/0x990 fs/ntfs3/attrib.c:159
       attr_set_size+0x2053/0x4300 fs/ntfs3/attrib.c:574
       ntfs_set_size+0x161/0x200 fs/ntfs3/inode.c:854
       ntfs_extend+0x1d1/0xad0 fs/ntfs3/file.c:409
       ntfs_file_write_iter+0x403/0x7a0 fs/ntfs3/file.c:1262
       __kernel_write_iter+0x42a/0x940 fs/read_write.c:612
       __kernel_write+0x120/0x180 fs/read_write.c:632
       do_acct_process+0x11ff/0x1870 kernel/acct.c:539
       acct_pin_kill+0x2b/0x130 kernel/acct.c:192
       pin_kill+0x2e1/0x5e0 fs/fs_pin.c:44
       __do_sys_acct kernel/acct.c:309 [inline]
       __se_sys_acct+0x2d2/0x760 kernel/acct.c:291
       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 ***

5 locks held by syz.5.295/7019:
 #0: ffff8880295e2900 (&acct->lock#3){+.+.}-{4:4}, at: acct_pin_kill+0x23/0x130 kernel/acct.c:191
 #1: ffff88814d890420 (sb_writers#13){.+.+}-{0:0}, at: acct_pin_kill+0x2b/0x130 kernel/acct.c:192
 #2: ffff88805b3c0398 (&sb->s_type->i_mutex_key#21){+.+.}-{4:4}, at: inode_trylock include/linux/fs.h:838 [inline]
 #2: ffff88805b3c0398 (&sb->s_type->i_mutex_key#21){+.+.}-{4:4}, at: ntfs_file_write_iter+0x291/0x7a0 fs/ntfs3/file.c:1240
 #3: ffff88805b3c0100 (&ni->ni_lock/5){+.+.}-{4:4}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
 #3: ffff88805b3c0100 (&ni->ni_lock/5){+.+.}-{4:4}, at: ntfs_set_size+0x12e/0x200 fs/ntfs3/inode.c:851
 #4: ffff88805b3c01b0 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_set_size+0x13d/0x200 fs/ntfs3/inode.c:852

stack backtrace:
CPU: 1 UID: 0 PID: 7019 Comm: syz.5.295 Not tainted 6.12.0-next-20241120-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: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
 ntfs_look_for_free_space+0x100/0x690 fs/ntfs3/fsntfs.c:362
 attr_allocate_clusters+0x1d6/0x990 fs/ntfs3/attrib.c:159
 attr_set_size+0x2053/0x4300 fs/ntfs3/attrib.c:574
 ntfs_set_size+0x161/0x200 fs/ntfs3/inode.c:854
 ntfs_extend+0x1d1/0xad0 fs/ntfs3/file.c:409
 ntfs_file_write_iter+0x403/0x7a0 fs/ntfs3/file.c:1262
 __kernel_write_iter+0x42a/0x940 fs/read_write.c:612
 __kernel_write+0x120/0x180 fs/read_write.c:632
 do_acct_process+0x11ff/0x1870 kernel/acct.c:539
 acct_pin_kill+0x2b/0x130 kernel/acct.c:192
 pin_kill+0x2e1/0x5e0 fs/fs_pin.c:44
 __do_sys_acct kernel/acct.c:309 [inline]
 __se_sys_acct+0x2d2/0x760 kernel/acct.c:291
 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:0x7ff30817e819
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:00007ff30901b038 EFLAGS: 00000246 ORIG_RAX: 00000000000000a3
RAX: ffffffffffffffda RBX: 00007ff308336080 RCX: 00007ff30817e819
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007ff3081f175e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007ff308336080 R15: 00007ffe9f25e408
 </TASK>

Crashes (68):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/20 13:54 linux-next ac24e26aa08f 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/20 03:59 linux-next 414c97c966b6 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/20 02:43 linux-next 414c97c966b6 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/19 23:56 linux-next 414c97c966b6 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/19 08:15 linux-next 414c97c966b6 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/13 12:23 linux-next 929beafbe7ac 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/13 00:54 linux-next 929beafbe7ac 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/13 00:54 linux-next 929beafbe7ac 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/12 19:48 linux-next 929beafbe7ac 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/12 04:51 linux-next 929beafbe7ac 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/11 11:09 linux-next 929beafbe7ac 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/11 06:14 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/11 05:04 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/11 03:19 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/10 23:11 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/10 11:27 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/10 10:01 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/10 08:47 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/10 08:21 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/09 15:45 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/09 15:08 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 23:48 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 23:48 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 23:48 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 23:48 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 23:31 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 13:00 linux-next 929beafbe7ac 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 13:00 linux-next 929beafbe7ac 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 02:13 linux-next 74741a050b79 c069283c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/08 02:00 linux-next 74741a050b79 c069283c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/07 14:19 linux-next 74741a050b79 c069283c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/06 11:01 linux-next 5b913f5d7d7f 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/06 07:07 linux-next 850f22c42f4b 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 20:51 linux-next 850f22c42f4b 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 20:51 linux-next 850f22c42f4b 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 12:10 linux-next 850f22c42f4b 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 12:10 linux-next 850f22c42f4b 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 12:10 linux-next 850f22c42f4b 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/05 08:45 linux-next 850f22c42f4b 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 19:56 linux-next 1ffec08567f4 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 17:31 linux-next 1ffec08567f4 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 17:30 linux-next 1ffec08567f4 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 17:29 linux-next 1ffec08567f4 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 17:29 linux-next 1ffec08567f4 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 10:35 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 08:51 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 08:23 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 08:23 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:52 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:52 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:39 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:39 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:37 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
2024/11/04 07:37 linux-next 1ffec08567f4 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_look_for_free_space
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 ntfs_look_for_free_space
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 ntfs_look_for_free_space
* Struck through repros no longer work on HEAD.