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: 752d, last: 10m
Cause bisection: failed (error log, bisect log)
  
Fix bisection: the issue occurs on the latest tested release (bisect log)
  
Discussions (16)
Title Replies (including bot) Last reply
[syzbot] Monthly ntfs3 report (Dec 2024) 0 (1) 2024/12/16 09:44
[syzbot] Monthly ntfs3 report (Nov 2024) 0 (1) 2024/11/13 11:07
[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 124 1d14h 634d 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 40 13h40m 632d 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:
         option from the mount to silence this warning.
=======================================================
======================================================
WARNING: possible circular locking dependency detected
6.12.0-syzkaller-09073-g9f16d5e6f220 #0 Not tainted
------------------------------------------------------
syz-executor229/5836 is trying to acquire lock:
ffff88807dc11e60 (&mm->mmap_lock){++++}-{4:4}, at: __might_fault+0xaa/0x120 mm/memory.c:6751

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

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ni->ni_lock#3/5){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
       ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
       ntfs_fallocate+0x763/0x1270 fs/ntfs3/file.c:693
       vfs_fallocate+0x569/0x6e0 fs/open.c:327
       ksys_fallocate fs/open.c:351 [inline]
       __do_sys_fallocate fs/open.c:356 [inline]
       __se_sys_fallocate fs/open.c:354 [inline]
       __x64_sys_fallocate+0xbc/0x110 fs/open.c:354
       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){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_write+0x99/0x220 kernel/locking/rwsem.c:1577
       inode_lock include/linux/fs.h:818 [inline]
       ntfs_file_mmap+0x5bc/0x850 fs/ntfs3/file.c:377
       call_mmap include/linux/fs.h:2183 [inline]
       mmap_file mm/internal.h:124 [inline]
       __mmap_new_file_vma mm/vma.c:2291 [inline]
       __mmap_new_vma mm/vma.c:2355 [inline]
       __mmap_region+0x2204/0x2cd0 mm/vma.c:2456
       mmap_region+0x226/0x2c0 mm/mmap.c:1347
       do_mmap+0x8f0/0x1000 mm/mmap.c:496
       vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
       ksys_mmap_pgoff+0x4eb/0x720 mm/mmap.c:542
       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){++++}-{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
       __might_fault+0xc6/0x120 mm/memory.c:6751
       _inline_copy_to_user include/linux/uaccess.h:192 [inline]
       _copy_to_user+0x2c/0xb0 lib/usercopy.c:26
       copy_to_user include/linux/uaccess.h:225 [inline]
       ni_fiemap+0x57c/0x18c0 fs/ntfs3/frecord.c:2139
       ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1352
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x1c01/0x2e40 fs/ioctl.c:840
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x80/0x170 fs/ioctl.c:892
       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#3/5

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz-executor229/5836:
 #0: ffff8880788def28 (&ni->ni_lock#3/5){+.+.}-{4:4}, at: ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
 #0: ffff8880788def28 (&ni->ni_lock#3/5){+.+.}-{4:4}, at: ntfs_fiemap+0xff/0x180 fs/ntfs3/file.c:1350

stack backtrace:
CPU: 1 UID: 0 PID: 5836 Comm: syz-executor229 Not tainted 6.12.0-syzkaller-09073-g9f16d5e6f220 #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
 __might_fault+0xc6/0x120 mm/memory.c:6751
 _inline_copy_to_user include/linux/uaccess.h:192 [inline]
 _copy_to_user+0x2c/0xb0 lib/usercopy.c:26
 copy_to_user include/linux/uaccess.h:225 [inline]
 ni_fiemap+0x57c/0x18c0 fs/ntfs3/frecord.c:2139
 ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1352
 ioctl_fiemap fs/ioctl.c:220 [inline]
 do_vfs_ioctl+0x1c01/0x2e40 fs/ioctl.c:840
 __do_sys_ioctl fs/ioctl.c:904 [inline]
 __se_sys_ioctl+0x80/0x170 fs/ioctl.c:892
 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:0x7f9008cefb19
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:00007ffe2da6c4f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9008cefb19
RDX: 0000000020001040 RSI: 00000000c020660b RDI: 0000000000000004
RBP: 00007f9008d825f0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000004 R11: 0000000000000246 R12: 00007ffe2da6c530
R13: 00007ffe2da6c758 R14: 431bde82d7b634db R15: 00007f9008d3803b
 </TASK>

Crashes (3443):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/24 11:58 upstream 9f16d5e6f220 68da6d95 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/10/12 10:30 upstream 9e4c6c1ad9a1 084d8178 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_fiemap
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/12/21 14:56 upstream 499551201b5f d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/21 05:56 upstream e9b8ffafd20a d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/21 04:07 upstream e9b8ffafd20a d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/20 20:08 upstream 8faabc041a00 0f61b415 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/20 18:57 upstream 8faabc041a00 0f61b415 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/20 17:10 upstream 8faabc041a00 0f61b415 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/20 10:44 upstream 8faabc041a00 0f61b415 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/20 04:01 upstream baaa2567a712 5905cb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 22:47 upstream baaa2567a712 5905cb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 18:53 upstream baaa2567a712 5905cb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 17:36 upstream eabcdba3ad40 5905cb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 16:12 upstream eabcdba3ad40 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 06:01 upstream eabcdba3ad40 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/19 02:50 upstream eabcdba3ad40 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/18 17:26 upstream aef25be35d23 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/18 04:58 upstream 59dbb9d81adf a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/17 23:39 upstream 59dbb9d81adf a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/17 15:56 upstream f44d154d6e3d c8c15bb2 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/12/17 12:25 upstream f44d154d6e3d f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/16 17:41 upstream 78d4f34e2115 f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/12/16 11:33 upstream dccbe2047a5b 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_fiemap
2024/12/16 06:44 upstream 78d4f34e2115 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/15 18:24 upstream 2d8308bf5b67 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/15 09:57 upstream a0e3919a2df2 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/15 06:19 upstream a0e3919a2df2 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/15 03:30 upstream a0e3919a2df2 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/14 23:51 upstream a0e3919a2df2 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/14 05:57 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/14 05:05 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/14 02:16 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/14 00:42 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 23:23 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 21:22 upstream 243f750a2df0 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 16:21 upstream f932fb9b4074 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 12:01 upstream f932fb9b4074 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 07:58 upstream f932fb9b4074 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/13 06:12 upstream 150b567e0d57 530e80f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/12 12:35 upstream 231825b2e1ff 6f1b0fa8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/12 09:06 upstream 231825b2e1ff 6f1b0fa8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/12 07:03 upstream 231825b2e1ff 6f1b0fa8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/12 02:12 upstream 231825b2e1ff 6f1b0fa8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/12 00:01 upstream 231825b2e1ff ff949d25 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/12/11 22:44 upstream f92f4749861b ff949d25 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_fiemap
2024/11/24 06:15 upstream 9f16d5e6f220 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root 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/12/13 10:38 upstream 150b567e0d57 3547e30f .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/12/20 08:35 linux-next 8155b4ef3466 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_fiemap
2024/12/19 14:57 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_fiemap
2024/12/17 00:42 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e7aff49b5da f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in ntfs_fiemap
2024/12/14 15:26 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e7aff49b5da 7cbfbb3a .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.