syzbot


possible deadlock in gup_fast_fallback

Status: upstream: reported C repro on 2024/04/21 03:14
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+63ba90b81c16b86379bd@syzkaller.appspotmail.com
First crash: 218d, last: 5h51m
Cause bisection: introduced by (bisect log) :
commit 69505fe98f198ee813898cbcaf6770949636430b
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date: Thu May 30 07:54:07 2024 +0000

  fs/ntfs3: Replace inode_trylock with inode_lock

Crash: possible deadlock in gup_fast_fallback (log)
Repro: C syz .config
  
Discussions (4)
Title Replies (including bot) Last reply
[syzbot] Monthly mm report (Nov 2024) 1 (2) 2024/11/04 12:58
[syzbot] Monthly mm report (Oct 2024) 0 (1) 2024/10/03 09:02
[syzbot] Monthly mm report (Sep 2024) 0 (1) 2024/09/02 08:17
[syzbot] [mm?] possible deadlock in gup_fast_fallback 0 (3) 2024/07/25 01:01

Sample crash report:
ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend (-116).
ntfs3: loop0: Failed to initialize $Extend.
======================================================
WARNING: possible circular locking dependency detected
6.10.0-syzkaller-12246-g786c8248dbd3 #0 Not tainted
------------------------------------------------------
syz-executor288/5099 is trying to acquire lock:
ffff888063210b18 (&mm->mmap_lock){++++}-{3:3}, at: gup_fast_fallback+0x233/0x2b50 mm/gup.c:3367

but task is already holding lock:
ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: ntfs_file_write_iter+0x24a/0x740 fs/ntfs3/file.c:1166

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #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: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

-> #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
       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

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

2 locks held by syz-executor288/5099:
 #0: ffff888023990420 (sb_writers#9){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2876 [inline]
 #0: ffff888023990420 (sb_writers#9){.+.+}-{0:0}, at: vfs_writev+0x2d4/0xbb0 fs/read_write.c:969
 #1: ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
 #1: ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: ntfs_file_write_iter+0x24a/0x740 fs/ntfs3/file.c:1166

stack backtrace:
CPU: 0 UID: 0 PID: 5099 Comm: syz-executor288 Not tainted 6.10.0-syzkaller-12246-g786c8248dbd3 #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
 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
RIP: 0033:0x7fb9777dcb59
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:00007ffe15926128 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb9777dcb59
RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000005
RBP: 00007fb97786f5f0 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000007000 R11: 0000000000000246 R12: 00007ffe15926160
R13: 00007ffe15926388 R14: 431bde82d7b634db R15: 00007fb97782503b
 </TASK>

Crashes (949):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/24 14:09 upstream 786c8248dbd3 57b2edb1 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/20 20:35 upstream 8f7c8b88bda4 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/20 18:08 upstream bf9aa14fc523 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/20 08:39 upstream a5c93bfec0be 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/19 17:45 upstream 158f238aa69d 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/19 04:25 upstream 23acd177540d 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/18 17:48 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/18 15:13 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/18 13:09 upstream adc218676eef 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/18 09:45 upstream adc218676eef cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/18 07:22 upstream adc218676eef cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/18 06:20 upstream adc218676eef cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/17 20:32 upstream f66d6acccbc0 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/17 14:13 upstream 4a5df3796467 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/17 10:19 upstream b5a24181e461 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/16 23:53 upstream e8bdb3c8be08 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/16 21:27 upstream e8bdb3c8be08 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/16 13:01 upstream e8bdb3c8be08 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/16 08:10 upstream f868cd251776 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/16 04:28 upstream f868cd251776 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/16 01:41 upstream f868cd251776 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/15 19:06 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/15 12:06 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/15 09:05 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/15 07:41 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/14 06:11 upstream 0a9b9d17f3a7 bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/14 06:11 upstream 0a9b9d17f3a7 bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/11 12:19 upstream 2d5404caa8c7 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/11 00:34 upstream a9cda7c0ffed 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/10 20:49 upstream a9cda7c0ffed 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/10 17:16 upstream de2f378f2b77 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/10 09:09 upstream de2f378f2b77 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in gup_fast_fallback
2024/11/09 08:50 upstream da4373fbcf00 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/09 04:36 upstream f1dce1f09380 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/09 02:56 upstream f1dce1f09380 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in gup_fast_fallback
2024/11/08 09:07 upstream 906bd684e4b1 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/20 02:44 upstream 158f238aa69d 7d02db5a .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in gup_fast_fallback
2024/10/23 00:44 upstream c2ee9f594da8 a573a9f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in gup_fast_fallback
2024/10/23 08:39 upstream c2ee9f594da8 15fa2979 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in gup_fast_fallback
2024/11/20 16:55 linux-next ac24e26aa08f 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/20 12:08 linux-next ac24e26aa08f 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/19 08:24 linux-next 414c97c966b6 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/18 11:19 linux-next ae58226b89ac cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/13 00:43 linux-next 929beafbe7ac 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/11 23:55 linux-next 929beafbe7ac 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/11 21:02 linux-next 929beafbe7ac 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/11 07:07 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/10 19:26 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/10 04:07 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/09 14:04 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/09 00:04 linux-next 929beafbe7ac 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/08 10:07 linux-next 929beafbe7ac 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/04/17 03:03 linux-next 66e4190e92ce 18f6e127 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/11/21 00:48 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 7b1d1d4cfac0 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in gup_fast_fallback
2024/11/15 23:02 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 887407160d72 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in gup_fast_fallback
2024/11/11 04:59 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 563047e691f2 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in gup_fast_fallback
2024/11/10 14:09 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 563047e691f2 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in gup_fast_fallback
* Struck through repros no longer work on HEAD.