syzbot


possible deadlock in ntfs_fiemap

Status: upstream: reported C repro on 2022/11/30 12:51
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+96cee7d33ca3f87eee86@syzkaller.appspotmail.com
First crash: 673d, last: 18m
Cause bisection: failed (error log, bisect log)
  
Fix bisection: the issue occurs on the latest tested release (bisect log)
  
Discussions (14)
Title Replies (including bot) Last reply
[syzbot] Monthly ntfs3 report (Sep 2024) 0 (1) 2024/09/12 08:11
[syzbot] Monthly ntfs3 report (Aug 2024) 0 (1) 2024/08/13 08:54
[syzbot] possible deadlock in ntfs_fiemap 0 (3) 2024/07/20 07:43
[syzbot] Monthly ntfs3 report (Jul 2024) 0 (1) 2024/07/12 10:05
[syzbot] Monthly ntfs3 report (Jun 2024) 0 (1) 2024/06/10 12:41
[syzbot] Monthly ntfs3 report (May 2024) 0 (1) 2024/05/06 13:18
[syzbot] Monthly ntfs3 report (Mar 2024) 0 (1) 2024/03/05 11:09
[syzbot] Monthly ntfs3 report (Jan 2024) 0 (1) 2024/01/02 13:36
[syzbot] Monthly ntfs3 report (Dec 2023) 0 (1) 2023/12/02 14:45
[syzbot] Monthly ntfs3 report (Jul 2023) 0 (1) 2023/07/30 13:16
[syzbot] Monthly ntfs3 report (Jun 2023) 0 (1) 2023/06/29 09:21
[syzbot] Monthly ntfs3 report (May 2023) 0 (1) 2023/05/29 08:47
[PATCH] fs/ntfs3: disable page fault during ntfs_fiemap() 7 (7) 2023/04/20 21:11
[syzbot] Monthly ntfs3 report 0 (1) 2023/03/27 17:38
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in ntfs_fiemap origin:lts-only C inconclusive 27 11h35m 556d 0/3 upstream: reported C repro on 2023/03/28 04:41
linux-5.15 possible deadlock in ntfs_fiemap origin:lts-only C error 30 43d 554d 0/3 upstream: reported C repro on 2023/03/30 02:33
Last patch testing requests (4)
Created Duration User Patch Repo Result
2024/07/20 07:43 15m almaz.alexandrovich@paragon-software.com https://github.com/Paragon-Software-Group/linux-ntfs3.git d57431c6f511bf020e474026d9f3123d7bfbea8c report log
2024/03/25 01:40 24m retest repro upstream OK log
2023/09/11 01:47 15m retest repro upstream OK log
2022/12/09 07:36 23m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master OK log

Sample crash report:
ntfs3: loop0: Failed to initialize $Extend/$ObjId.
======================================================
WARNING: possible circular locking dependency detected
6.10.0-syzkaller-12562-g1722389b0d86 #0 Not tainted
------------------------------------------------------
syz-executor152/5215 is trying to acquire lock:
ffff88802cd73a98 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xaa/0x120 mm/memory.c:6388

but task is already holding lock:
ffff88807802f680 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
ffff88807802f680 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xff/0x180 fs/ntfs3/file.c:1277

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ni->ni_lock/4){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
       ntfs_fallocate+0x760/0x1280 fs/ntfs3/file.c:646
       vfs_fallocate+0x553/0x6c0 fs/open.c:334
       ksys_fallocate fs/open.c:357 [inline]
       __do_sys_fallocate fs/open.c:365 [inline]
       __se_sys_fallocate fs/open.c:363 [inline]
       __x64_sys_fallocate+0xbd/0x110 fs/open.c:363
       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

-> #1 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       down_write+0x99/0x220 kernel/locking/rwsem.c:1579
       inode_lock include/linux/fs.h:799 [inline]
       ntfs_file_mmap+0x5bf/0x850 fs/ntfs3/file.c:368
       call_mmap include/linux/fs.h:2129 [inline]
       mmap_region+0xe8f/0x2090 mm/mmap.c:2957
       do_mmap+0x8f9/0x1010 mm/mmap.c:1468
       vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
       ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514
       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 (&mm->mmap_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3133 [inline]
       check_prevs_add kernel/locking/lockdep.c:3252 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
       __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __might_fault+0xc6/0x120 mm/memory.c:6388
       _copy_to_user+0x2a/0xb0 lib/usercopy.c:41
       copy_to_user include/linux/uaccess.h:191 [inline]
       fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145
       ni_fiemap+0x4f5/0x1910 fs/ntfs3/frecord.c:1993
       ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1279
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x1c07/0x2e50 fs/ioctl.c:841
       __do_sys_ioctl fs/ioctl.c:905 [inline]
       __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
       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:

Chain exists of:
  &mm->mmap_lock --> &sb->s_type->i_mutex_key#14 --> &ni->ni_lock/4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->ni_lock/4);
                               lock(&sb->s_type->i_mutex_key#14);
                               lock(&ni->ni_lock/4);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

1 lock held by syz-executor152/5215:
 #0: ffff88807802f680 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
 #0: ffff88807802f680 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xff/0x180 fs/ntfs3/file.c:1277

stack backtrace:
CPU: 0 UID: 0 PID: 5215 Comm: syz-executor152 Not tainted 6.10.0-syzkaller-12562-g1722389b0d86 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2186
 check_prev_add kernel/locking/lockdep.c:3133 [inline]
 check_prevs_add kernel/locking/lockdep.c:3252 [inline]
 validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 __might_fault+0xc6/0x120 mm/memory.c:6388
 _copy_to_user+0x2a/0xb0 lib/usercopy.c:41
 copy_to_user include/linux/uaccess.h:191 [inline]
 fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145
 ni_fiemap+0x4f5/0x1910 fs/ntfs3/frecord.c:1993
 ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1279
 ioctl_fiemap fs/ioctl.c:220 [inline]
 do_vfs_ioctl+0x1c07/0x2e50 fs/ioctl.c:841
 __do_sys_ioctl fs/ioctl.c:905 [inline]
 __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
 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:0x7f48e07ec099
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd996d44d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f48e07ec099
RDX: 00000000200074c0 RSI: 00000000c020660b RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000000 R09: 000055555b7b84c0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (2245):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/26 08:57 upstream 1722389b0d86 3f86dfed .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/04/19 03:50 linux-next 7b4f2bc91c15 af24b050 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_fiemap
2022/12/09 04:00 upstream f3e8416619ce 1034e5fa .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_fiemap
2023/11/14 07:52 upstream 9bacdd8996c7 cb976f63 .config console log report syz C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-qemu-upstream possible deadlock in ntfs_fiemap
2024/10/04 09:38 upstream 0c559323bbaa d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/04 06:09 upstream 0c559323bbaa d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/04 06:08 upstream 0c559323bbaa d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/04 02:38 upstream 3840cbe24cf0 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ntfs_fiemap
2024/10/04 01:14 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 20:45 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 19:39 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 17:29 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 16:23 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 10:31 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 08:57 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 07:54 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 06:24 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 04:16 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 02:50 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/03 00:53 upstream f23aa4c0761a 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 21:25 upstream f23aa4c0761a 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 15:42 upstream e32cde8d2bd7 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/10/02 15:15 upstream e32cde8d2bd7 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 13:49 upstream e32cde8d2bd7 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 11:31 upstream e32cde8d2bd7 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 10:31 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 06:44 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 05:42 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 04:04 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/02 02:56 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ntfs_fiemap
2024/10/02 02:23 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 23:44 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 22:31 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 21:23 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/10/01 18:07 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 16:15 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/10/01 12:38 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 11:30 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 05:28 upstream e32cde8d2bd7 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/10/01 02:38 upstream e32cde8d2bd7 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 01:26 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 00:25 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 23:11 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 21:25 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 19:28 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 17:28 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 16:02 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 14:54 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/09/30 13:46 upstream 9852d85ec9d4 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/06/25 13:09 upstream 55027e689933 215eef4a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_fiemap
2024/06/09 07:09 upstream 771ed66105de 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_fiemap
2024/09/22 17:29 upstream 88264981f208 6f888b75 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in ntfs_fiemap
2024/06/16 20:56 upstream 2ccbdf43d5e7 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ntfs_fiemap
2024/06/06 08:09 upstream 2df0193e62cf c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ntfs_fiemap
2022/11/30 12:37 upstream 01f856ae6d0c 4c2a66e8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/01 12:47 linux-next 77df9e4bb222 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_fiemap
2024/10/04 12:07 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in ntfs_fiemap
2024/10/03 11:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in ntfs_fiemap
* Struck through repros no longer work on HEAD.