syzbot


possible deadlock in ntfs_fallocate

Status: upstream: reported C repro on 2023/11/22 18:34
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+e5a561d1c6c138fdb32a@syzkaller.appspotmail.com
First crash: 432d, last: 16d
Bug presence (2)
Date Name Commit Repro Result
2024/12/29 linux-6.1.y (ToT) 563edd786f0a C [report] possible deadlock in ntfs_fallocate
2024/12/29 upstream (ToT) 059dd502b263 C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ntfs_fallocate ntfs3 C error 395 5d11h 780d 0/28 upstream: reported C repro on 2022/12/09 08:57

Sample crash report:
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.1.121-syzkaller #0 Tainted: G        W         
------------------------------------------------------
syz-executor215/4290 is trying to acquire lock:
ffff0000df737700 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1101 [inline]
ffff0000df737700 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_fallocate+0x48c/0xd88 fs/ntfs3/file.c:598

but task is already holding lock:
ffff0000df737b40 (mapping.invalidate_lock#3){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:803 [inline]
ffff0000df737b40 (mapping.invalidate_lock#3){++++}-{3:3}, at: ntfs_fallocate+0x2fc/0xd88 fs/ntfs3/file.c:580

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (mapping.invalidate_lock#3){++++}-{3:3}:
       down_read+0x64/0x308 kernel/locking/rwsem.c:1520
       filemap_invalidate_lock_shared include/linux/fs.h:813 [inline]
       filemap_fault+0x58c/0xf7c mm/filemap.c:3219
       __do_fault+0x11c/0x3d8 mm/memory.c:4278
       do_shared_fault mm/memory.c:4684 [inline]
       do_fault mm/memory.c:4762 [inline]
       handle_pte_fault mm/memory.c:5029 [inline]
       __handle_mm_fault mm/memory.c:5171 [inline]
       handle_mm_fault+0x17ac/0x3d38 mm/memory.c:5292
       __do_page_fault arch/arm64/mm/fault.c:499 [inline]
       do_page_fault+0x330/0x890 arch/arm64/mm/fault.c:583
       do_translation_fault+0x94/0xc8 arch/arm64/mm/fault.c:667
       do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:803
       el0_da+0x70/0x184 arch/arm64/kernel/entry-common.c:515
       el0t_64_sync_handler+0xcc/0xf0 arch/arm64/kernel/entry-common.c:658
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       __might_fault+0xc4/0x124 mm/memory.c:5851
       _copy_to_user include/linux/uaccess.h:143 [inline]
       copy_to_user include/linux/uaccess.h:169 [inline]
       ni_fiemap+0x1134/0x1444 fs/ntfs3/frecord.c:2140
       ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1254
       ioctl_fiemap fs/ioctl.c:219 [inline]
       do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810
       __do_sys_ioctl fs/ioctl.c:868 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856
       __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/0x168 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 (&ni->ni_lock/5){+.+.}-{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+0x3338/0x7680 kernel/locking/lockdep.c:5049
       lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
       __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
       ni_lock fs/ntfs3/ntfs_fs.h:1101 [inline]
       ntfs_fallocate+0x48c/0xd88 fs/ntfs3/file.c:598
       vfs_fallocate+0x478/0x5b4 fs/open.c:323
       ioctl_preallocate+0x278/0x324 fs/ioctl.c:290
       do_vfs_ioctl+0x1ad8/0x26f8 fs/ioctl.c:849
       __do_sys_ioctl fs/ioctl.c:868 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856
       __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/0x168 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:
  &ni->ni_lock/5 --> &mm->mmap_lock --> mapping.invalidate_lock#3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(mapping.invalidate_lock#3);
                               lock(&mm->mmap_lock);
                               lock(mapping.invalidate_lock#3);
  lock(&ni->ni_lock/5);

 *** DEADLOCK ***

3 locks held by syz-executor215/4290:
 #0: ffff0000dad54460 (sb_writers#8){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:3015 [inline]
 #0: ffff0000dad54460 (sb_writers#8){.+.+}-{0:0}, at: vfs_fallocate+0x404/0x5b4 fs/open.c:322
 #1: ffff0000df7379a0 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #1: ffff0000df7379a0 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: ntfs_fallocate+0x25c/0xd88 fs/ntfs3/file.c:566
 #2: ffff0000df737b40 (mapping.invalidate_lock#3){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:803 [inline]
 #2: ffff0000df737b40 (mapping.invalidate_lock#3){++++}-{3:3}, at: ntfs_fallocate+0x2fc/0xd88 fs/ntfs3/file.c:580

stack backtrace:
CPU: 0 PID: 4290 Comm: syz-executor215 Tainted: G        W          6.1.121-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 dump_stack+0x1c/0x58 lib/dump_stack.c:113
 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048
 check_noncircular+0x2cc/0x378 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+0x3338/0x7680 kernel/locking/lockdep.c:5049
 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
 ni_lock fs/ntfs3/ntfs_fs.h:1101 [inline]
 ntfs_fallocate+0x48c/0xd88 fs/ntfs3/file.c:598
 vfs_fallocate+0x478/0x5b4 fs/open.c:323
 ioctl_preallocate+0x278/0x324 fs/ioctl.c:290
 do_vfs_ioctl+0x1ad8/0x26f8 fs/ioctl.c:849
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856
 __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/0x168 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

Crashes (26):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/27 12:51 linux-6.1.y 29f02ec58a94 d3ccff63 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2025/01/11 23:37 linux-6.1.y c63962be84ef 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2025/01/05 14:05 linux-6.1.y 7dc732d24ff7 f3558dbf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/12/20 14:08 linux-6.1.y 29f02ec58a94 0f61b415 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/10/03 12:31 linux-6.1.y aa4cd140bba5 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/08/12 18:14 linux-6.1.y 36790ef5e00b 842184b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/06/10 20:53 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/05/16 21:06 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2024/02/01 17:38 linux-6.1.y e5c3b988b827 81024119 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fallocate
2025/01/08 18:00 linux-6.1.y 7dc732d24ff7 f3558dbf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2025/01/02 05:40 linux-6.1.y 563edd786f0a d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/12/27 10:55 linux-6.1.y 29f02ec58a94 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/12/07 22:36 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/12/07 00:12 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/12/05 03:21 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/11/06 04:49 linux-6.1.y 7c15117f9468 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/10/11 11:19 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 ntfs_fallocate
2024/10/08 09:54 linux-6.1.y aa4cd140bba5 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/08/19 20:02 linux-6.1.y ee5e09825b81 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/08/19 20:01 linux-6.1.y ee5e09825b81 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/08/19 20:00 linux-6.1.y ee5e09825b81 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/05/15 12:11 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/04/08 14:15 linux-6.1.y 347385861c50 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/04/08 04:08 linux-6.1.y 347385861c50 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2024/03/10 13:00 linux-6.1.y 61adba85cc40 6ee49f2e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
2023/11/22 18:33 linux-6.1.y 69e434a1cb21 03e12510 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fallocate
* Struck through repros no longer work on HEAD.