syzbot


possible deadlock in ntfs_file_mmap

Status: upstream: reported on 2024/06/15 07:17
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+c1751b6739d83d70bb75@syzkaller.appspotmail.com
First crash: 32d, last: 4d06h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] possible deadlock in ntfs_file_mmap 0 (1) 2024/06/15 07:17

Sample crash report:
loop1: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc6-next-20240703-syzkaller #0 Not tainted
------------------------------------------------------
syz.1.1870/12690 is trying to acquire lock:
ffff888079fa20f8 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:799 [inline]
ffff888079fa20f8 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: ntfs_file_mmap+0x5bf/0x850 fs/ntfs3/file.c:368

but task is already holding lock:
ffff88807cb75718 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
ffff88807cb75718 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:586

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816
       gup_fast_fallback+0x24c/0x2b50 mm/gup.c:3367
       pin_user_pages_fast+0xcc/0x160 mm/gup.c:3491
       iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline]
       iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646
       dio_refill_pages fs/direct-io.c:173 [inline]
       dio_get_page fs/direct-io.c:214 [inline]
       do_direct_IO fs/direct-io.c:916 [inline]
       __blockdev_direct_IO+0x144c/0x4890 fs/direct-io.c:1249
       blockdev_direct_IO include/linux/fs.h:3212 [inline]
       ntfs_direct_IO+0x195/0x370 fs/ntfs3/inode.c:801
       generic_file_direct_write+0x130/0x350 mm/filemap.c:3941
       __generic_file_write_iter+0x129/0x230 mm/filemap.c:4107
       ntfs_file_write_iter+0x663/0x740 fs/ntfs3/file.c:1193
       do_iter_readv_writev+0x60a/0x890
       vfs_writev+0x37c/0xbb0 fs/read_write.c:971
       do_pwritev fs/read_write.c:1072 [inline]
       __do_sys_pwritev2 fs/read_write.c:1131 [inline]
       __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
       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 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3158 [inline]
       check_prevs_add kernel/locking/lockdep.c:3277 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901
       __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5193
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816
       down_write+0x3a/0x50 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:2927
       do_mmap+0x8ad/0xfa0 mm/mmap.c:1438
       vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
       ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1484
       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(&mm->mmap_lock);
                               lock(&sb->s_type->i_mutex_key#22);
                               lock(&mm->mmap_lock);
  lock(&sb->s_type->i_mutex_key#22);

 *** DEADLOCK ***

1 lock held by syz.1.1870/12690:
 #0: ffff88807cb75718 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
 #0: ffff88807cb75718 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:586

stack backtrace:
CPU: 1 UID: 0 PID: 12690 Comm: syz.1.1870 Not tainted 6.10.0-rc6-next-20240703-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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:2203
 check_prev_add kernel/locking/lockdep.c:3158 [inline]
 check_prevs_add kernel/locking/lockdep.c:3277 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901
 __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5193
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5816
 down_write+0x3a/0x50 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:2927
 do_mmap+0x8ad/0xfa0 mm/mmap.c:1438
 vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
 ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1484
 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:0x7fbfc0975bd9
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:00007fbfc1690048 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fbfc0b03f60 RCX: 00007fbfc0975bd9
RDX: 0000000000000002 RSI: 0000000000b36000 RDI: 0000000020000000
RBP: 00007fbfc09e4e60 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000028011 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fbfc0b03f60 R15: 00007ffc97e7d6d8
 </TASK>

Crashes (61):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/09 05:02 linux-next 0b58e108042b bc23a442 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/09 04:56 linux-next 0b58e108042b bc23a442 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/08 13:47 linux-next 0b58e108042b cde64f7d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/07 14:45 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/07 13:43 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/07 10:43 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/06 10:29 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/04 15:24 linux-next 0b58e108042b dc6bbff0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/03 23:56 linux-next 0b58e108042b 409d975c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/07/01 12:08 linux-next 74564adfd352 b294e901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/27 22:23 linux-next 642a16ca7994 b62c7d46 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/26 15:46 linux-next 62c97045b8f7 880c1ca1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/25 16:15 linux-next 62c97045b8f7 da0bd5ca .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/25 03:38 linux-next 62c97045b8f7 215eef4a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 02:40 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 01:20 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 00:33 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 00:33 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 00:33 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 00:33 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/23 00:33 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/22 20:14 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/22 13:13 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/22 13:12 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/22 13:12 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/20 20:19 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/20 20:19 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 15:53 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 05:45 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 02:37 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 02:37 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 00:40 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/17 00:11 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/16 13:42 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/16 09:37 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/15 09:45 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/15 08:54 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/15 00:04 linux-next a957267fa7e9 8d849073 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/14 22:09 linux-next a957267fa7e9 8d849073 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/14 09:50 linux-next a957267fa7e9 a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 22:54 linux-next a957267fa7e9 a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 01:20 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 01:20 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 01:20 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 01:20 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 01:20 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/13 00:12 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/12 14:56 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/12 02:39 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/12 02:38 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/12 02:38 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/11 12:36 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/11 11:45 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/11 11:45 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/11 11:44 linux-next a957267fa7e9 c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
2024/06/11 07:14 linux-next a957267fa7e9 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_file_mmap
* Struck through repros no longer work on HEAD.