syzbot


possible deadlock in ntfs_fiemap

Status: upstream: reported C repro on 2023/03/28 04:41
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+b40a7a91431612fd07c7@syzkaller.appspotmail.com
First crash: 454d, last: 27d
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: possible deadlock in ntfs_fiemap (log)
Repro: C syz .config
  
Bug presence (2)
Date Name Commit Repro Result
2023/05/18 linux-6.1.y (ToT) fa74641fb6b9 C [report] possible deadlock in ntfs_fiemap
2023/05/18 upstream (ToT) 2d1bcbc6cd70 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ntfs_fiemap ntfs3 C error inconclusive 838 2d11h 572d 0/27 upstream: reported C repro on 2022/11/30 12:51
linux-5.15 possible deadlock in ntfs_fiemap origin:lts-only C error 28 6d20h 452d 0/3 upstream: reported C repro on 2023/03/30 02:33
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2023/10/04 18:54 1h47m fix candidate upstream job log (0)
2023/10/03 12:27 2h16m bisect fix linux-6.1.y job log (0) log
2023/08/07 21:04 4h55m bisect fix linux-6.1.y job log (0) log

Sample crash report:
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.1.29-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor315/4216 is trying to acquire lock:
ffff0000d44cc948 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:5654

but task is already holding lock:
ffff0000df187700 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
ffff0000df187700 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xec/0x168 fs/ntfs3/file.c:1243

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->ni_lock/4){+.+.}-{3:3}:
       __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:1109 [inline]
       attr_data_get_block+0x330/0x1bdc fs/ntfs3/attrib.c:921
       ntfs_file_mmap+0x3a4/0x688 fs/ntfs3/file.c:387
       call_mmap include/linux/fs.h:2210 [inline]
       mmap_region+0xdd0/0x1a98 mm/mmap.c:2663
       do_mmap+0xa00/0x1108 mm/mmap.c:1411
       vm_mmap_pgoff+0x1a4/0x2b4 mm/util.c:520
       ksys_mmap_pgoff+0x3c8/0x5b0 mm/mmap.c:1457
       __do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
       __se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
       __arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
       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:581

-> #0 (&mm->mmap_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain kernel/locking/lockdep.c:3832 [inline]
       __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
       lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
       __might_fault+0xc4/0x124 mm/memory.c:5655
       _copy_to_user include/linux/uaccess.h:143 [inline]
       copy_to_user include/linux/uaccess.h:169 [inline]
       fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144
       ni_fiemap+0xc40/0xe10 fs/ntfs3/frecord.c:1943
       ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1245
       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/0x2c0 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
       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:581

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->ni_lock/4);
                               lock(&mm->mmap_lock);
                               lock(&ni->ni_lock/4);
  lock(&mm->mmap_lock);

 *** DEADLOCK ***

1 lock held by syz-executor315/4216:
 #0: ffff0000df187700 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
 #0: ffff0000df187700 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xec/0x168 fs/ntfs3/file.c:1243

stack backtrace:
CPU: 0 PID: 4216 Comm: syz-executor315 Not tainted 6.1.29-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
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/0x5c lib/dump_stack.c:113
 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2056
 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain kernel/locking/lockdep.c:3832 [inline]
 __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
 __might_fault+0xc4/0x124 mm/memory.c:5655
 _copy_to_user include/linux/uaccess.h:143 [inline]
 copy_to_user include/linux/uaccess.h:169 [inline]
 fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144
 ni_fiemap+0xc40/0xe10 fs/ntfs3/frecord.c:1943
 ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1245
 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/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 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:581

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/18 14:49 linux-6.1.y fa74641fb6b9 3bb7af1d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/06/19 06:55 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2024/05/28 18:41 linux-6.1.y 88690811da69 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2024/05/15 14:25 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2024/04/04 12:41 linux-6.1.y 347385861c50 0ee3535e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/05/31 00:11 linux-6.1.y d2869ace6eeb df37c7f1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2023/04/03 16:17 linux-6.1.y 3b29299e5f60 41147e3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2023/03/28 04:40 linux-6.1.y e3a87a10f259 47f3aaf1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_fiemap
2023/05/25 13:05 linux-6.1.y a343b0dd87b4 0513b3e6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/05/17 17:45 linux-6.1.y fa74641fb6b9 eaac4681 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/05/16 18:49 linux-6.1.y bf4ad6fa4e53 11c89444 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/05/12 16:35 linux-6.1.y bf4ad6fa4e53 ecca8a24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/05/05 15:48 linux-6.1.y ca48fc16c493 de870ca5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
2023/04/25 18:07 linux-6.1.y f17b0ab65d17 65320f8e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_fiemap
* Struck through repros no longer work on HEAD.