syzbot


possible deadlock in move_pages

Status: fixed on 2024/05/23 00:16
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+49056626fe41e01f2ba7@syzkaller.appspotmail.com
Fix commit: 30af24facf0a userfaultfd: fix deadlock warning when locking src and dst VMAs
First crash: 70d, last: 57d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs 2 (2) 2024/03/22 00:47
[syzbot] [mm?] possible deadlock in move_pages 4 (6) 2024/03/20 11:09
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/03/20 10:46 22m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e5eb28f6d1af OK log

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.8.0-syzkaller-09791-ge5eb28f6d1af #0 Not tainted
--------------------------------------------
syz-executor258/5169 is trying to acquire lock:
ffff88802a6d23d0 (&vma->vm_lock->lock){++++}-{3:3}, at: uffd_move_lock mm/userfaultfd.c:1447 [inline]
ffff88802a6d23d0 (&vma->vm_lock->lock){++++}-{3:3}, at: move_pages+0xbab/0x4970 mm/userfaultfd.c:1583

but task is already holding lock:
ffff88802a6d2580 (&vma->vm_lock->lock){++++}-{3:3}, at: uffd_move_lock mm/userfaultfd.c:1445 [inline]
ffff88802a6d2580 (&vma->vm_lock->lock){++++}-{3:3}, at: move_pages+0xb6f/0x4970 mm/userfaultfd.c:1583

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&vma->vm_lock->lock);
  lock(&vma->vm_lock->lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor258/5169:
 #0: ffff888015086a20 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:146 [inline]
 #0: ffff888015086a20 (&mm->mmap_lock){++++}-{3:3}, at: uffd_move_lock mm/userfaultfd.c:1438 [inline]
 #0: ffff888015086a20 (&mm->mmap_lock){++++}-{3:3}, at: move_pages+0x8df/0x4970 mm/userfaultfd.c:1583
 #1: ffff88802a6d2580 (&vma->vm_lock->lock){++++}-{3:3}, at: uffd_move_lock mm/userfaultfd.c:1445 [inline]
 #1: ffff88802a6d2580 (&vma->vm_lock->lock){++++}-{3:3}, at: move_pages+0xb6f/0x4970 mm/userfaultfd.c:1583

stack backtrace:
CPU: 2 PID: 5169 Comm: syz-executor258 Not tainted 6.8.0-syzkaller-09791-ge5eb28f6d1af #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 check_deadlock kernel/locking/lockdep.c:3062 [inline]
 validate_chain kernel/locking/lockdep.c:3856 [inline]
 __lock_acquire+0x20e6/0x3b30 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719
 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526
 uffd_move_lock mm/userfaultfd.c:1447 [inline]
 move_pages+0xbab/0x4970 mm/userfaultfd.c:1583
 userfaultfd_move fs/userfaultfd.c:2008 [inline]
 userfaultfd_ioctl+0x5e1/0x60e0 fs/userfaultfd.c:2126
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:904 [inline]
 __se_sys_ioctl fs/ioctl.c:890 [inline]
 __x64_sys_ioctl+0x193/0x220 fs/ioctl.c:890
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fd48da20329
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd1244f8e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffd1244fab8 RCX: 00007fd48da20329
RDX: 00000000200000c0 RSI: 00000000c028aa05 RDI: 0000000000000003
RBP: 00007fd48da93610 R08: 00007ffd1244fab8 R09: 00007ffd1244fab8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd1244faa8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Crashes (206):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/15 13:03 upstream e5eb28f6d1af d615901c .config console log report syz C [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/28 04:28 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/28 03:01 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/27 19:06 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/27 18:01 upstream 962490525cff 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/26 22:42 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/26 17:07 upstream 928a87efa423 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/26 10:11 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/25 23:22 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/25 19:02 upstream 928a87efa423 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/25 11:36 upstream 4cece7649650 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/24 23:23 upstream 4cece7649650 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/24 10:04 upstream 70293240c5ce 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/23 21:27 upstream 484193fecd2b 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/23 21:01 upstream 484193fecd2b 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/22 18:16 upstream 4f55aa85a874 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/22 17:10 upstream 8e938e398669 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/22 05:33 upstream 8e938e398669 7a239ce7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/21 16:56 upstream 23956900041d 10ed73e3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/21 13:56 upstream 23956900041d 6753db5c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/21 05:54 upstream dba89d1b81df 6753db5c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/21 00:45 upstream dba89d1b81df 6753db5c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/20 12:39 upstream a4145ce1e7bc 5b7d42ae .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/20 04:24 upstream 78c3925c048c a485f239 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/20 00:30 upstream 78c3925c048c a485f239 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/19 17:28 upstream d95fcdf4961d e104824c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/19 12:33 upstream b3603fcb79b1 e104824c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in move_pages
2024/03/28 03:08 upstream 962490525cff 120789fd .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/27 18:02 upstream 962490525cff 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/27 14:14 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/27 09:30 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 22:48 upstream 7033999ecd7b 454571b6 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 16:14 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 14:36 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 08:40 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 07:37 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 04:03 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/26 02:27 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/25 23:45 upstream 928a87efa423 bcd9b39f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/25 08:43 upstream 4cece7649650 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/23 22:28 upstream 484193fecd2b 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/23 07:25 upstream bfa8f18691ed 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/23 05:04 upstream 4f55aa85a874 0ea90952 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/22 08:04 upstream 8e938e398669 7a239ce7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
2024/03/22 06:38 upstream 8e938e398669 7a239ce7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in move_pages
* Struck through repros no longer work on HEAD.