syzbot


possible deadlock in gup_fast_fallback

Status: upstream: reported on 2024/04/21 03:14
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+63ba90b81c16b86379bd@syzkaller.appspotmail.com
First crash: 95d, last: 1d07h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] possible deadlock in gup_fast_fallback 0 (1) 2024/04/21 03:14

Sample crash report:
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.10.0-next-20240719-syzkaller #0 Not tainted
------------------------------------------------------
syz.0.3356/19085 is trying to acquire lock:
ffff88802c231498 (&mm->mmap_lock){++++}-{3:3}, at: gup_fast_fallback+0x233/0x2b50 mm/gup.c:3367

but task is already holding lock:
ffff8880776eafa8 (&sb->s_type->i_mutex_key#30){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
ffff8880776eafa8 (&sb->s_type->i_mutex_key#30){+.+.}-{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#30){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
       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:3158 [inline]
       check_prevs_add kernel/locking/lockdep.c:3277 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5199
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
       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
       new_sync_write fs/read_write.c:497 [inline]
       vfs_write+0xa72/0xc90 fs/read_write.c:590
       ksys_write+0x1a0/0x2c0 fs/read_write.c:643
       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#30);
                               lock(&mm->mmap_lock);
                               lock(&sb->s_type->i_mutex_key#30);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

3 locks held by syz.0.3356/19085:
 #0: ffff888016ea1248 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x24e/0x310 fs/file.c:1191
 #1: ffff888063f12420 (sb_writers#19){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2876 [inline]
 #1: ffff888063f12420 (sb_writers#19){.+.+}-{0:0}, at: vfs_write+0x227/0xc90 fs/read_write.c:586
 #2: ffff8880776eafa8 (&sb->s_type->i_mutex_key#30){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
 #2: ffff8880776eafa8 (&sb->s_type->i_mutex_key#30){+.+.}-{3:3}, at: ntfs_file_write_iter+0x24a/0x740 fs/ntfs3/file.c:1166

stack backtrace:
CPU: 1 UID: 0 PID: 19085 Comm: syz.0.3356 Not tainted 6.10.0-next-20240719-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/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+0x1384/0x2050 kernel/locking/lockdep.c:5199
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822
 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
 new_sync_write fs/read_write.c:497 [inline]
 vfs_write+0xa72/0xc90 fs/read_write.c:590
 ksys_write+0x1a0/0x2c0 fs/read_write.c:643
 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:0x7f441b375b59
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:00007f441c062048 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f441b505f60 RCX: 00007f441b375b59
RDX: 0000000000182000 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 00007f441b3e4e5d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f441b505f60 R15: 00007ffe19165798
 </TASK>

Crashes (38):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/20 16:25 linux-next 41c196e567fb b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/16 17:59 linux-next 4f40be61af99 215bec2d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/16 12:05 linux-next 4f40be61af99 b66b37bd .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/16 12:03 linux-next 4f40be61af99 b66b37bd .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/16 11:37 linux-next 4f40be61af99 b66b37bd .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/06 11:38 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/05 10:57 linux-next 0b58e108042b 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/03 23:29 linux-next 0b58e108042b 409d975c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/01 12:12 linux-next 74564adfd352 b294e901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/07/01 12:12 linux-next 74564adfd352 b294e901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/26 10:06 linux-next 62c97045b8f7 dec8bc94 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/26 08:39 linux-next 62c97045b8f7 dec8bc94 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/25 19:09 linux-next 62c97045b8f7 da0bd5ca .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/24 19:54 linux-next f76698bd9a8c 215eef4a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/22 19:24 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/22 02:29 linux-next f76698bd9a8c edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/20 20:29 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/20 20:29 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/20 20:28 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/20 20:28 linux-next b992b79ca8bc dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/17 01:47 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/17 00: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 gup_fast_fallback
2024/06/17 00:41 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/17 00:41 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/15 09:50 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/15 08:57 linux-next a957267fa7e9 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/15 00:26 linux-next a957267fa7e9 8d849073 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/13 00:13 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/13 00:13 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/13 00:13 linux-next a957267fa7e9 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/12 14:43 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/12 02:55 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/12 02:45 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/12 02:44 linux-next a957267fa7e9 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in gup_fast_fallback
2024/06/12 02:44 linux-next a957267fa7e9 4d75f4f7 .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/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/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
* Struck through repros no longer work on HEAD.