syzbot


possible deadlock in move_pages (2)

Status: upstream: reported C repro on 2024/12/22 07:37
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+eedb611600ae59683656@syzkaller.appspotmail.com
First crash: 4d05h, last: 2d07h
Cause bisection: introduced by (bisect log) :
commit 032377449a80095d3526d263414fa7216bac5b2a
Author: Suren Baghdasaryan <surenb@google.com>
Date: Mon Dec 16 19:24:13 2024 +0000

  mm: replace vm_lock and detached flag with a reference count

Crash: possible deadlock in move_pages (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] possible deadlock in move_pages (2) 0 (1) 2024/12/22 07:37
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in move_pages mm C 206 269d 278d 25/28 fixed on 2024/05/23 00:16

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.13.0-rc3-next-20241218-syzkaller #0 Not tainted
--------------------------------------------
syz-executor591/5830 is trying to acquire lock:
ffff8880122abc08 (vm_lock){++++}-{0:0}, at: uffd_move_lock mm/userfaultfd.c:1477 [inline]
ffff8880122abc08 (vm_lock){++++}-{0:0}, at: move_pages+0x26b/0x1680 mm/userfaultfd.c:1632

but task is already holding lock:
ffff88823bfcafc8 (vm_lock){++++}-{0:0}, at: vma_start_read_locked include/linux/mm.h:803 [inline]
ffff88823bfcafc8 (vm_lock){++++}-{0:0}, at: uffd_lock_vma+0x20c/0x2c0 mm/userfaultfd.c:88

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

       CPU0
       ----
  lock(vm_lock);
  lock(vm_lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor591/5830:
 #0: ffff88823bfcafc8 (vm_lock){++++}-{0:0}, at: vma_start_read_locked include/linux/mm.h:803 [inline]
 #0: ffff88823bfcafc8 (vm_lock){++++}-{0:0}, at: uffd_lock_vma+0x20c/0x2c0 mm/userfaultfd.c:88
 #1: ffffffff8e937d20 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline]
 #1: ffffffff8e937d20 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
 #1: ffffffff8e937d20 (rcu_read_lock){....}-{1:3}, at: lock_vma_under_rcu+0x1dd/0xa40 mm/memory.c:6422

stack backtrace:
CPU: 0 UID: 0 PID: 5830 Comm: syz-executor591 Not tainted 6.13.0-rc3-next-20241218-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037
 check_deadlock kernel/locking/lockdep.c:3089 [inline]
 validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891
 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
 vma_start_read include/linux/mm.h:744 [inline]
 lock_vma_under_rcu+0x370/0xa40 mm/memory.c:6427
 uffd_move_lock mm/userfaultfd.c:1477 [inline]
 move_pages+0x26b/0x1680 mm/userfaultfd.c:1632
 userfaultfd_move fs/userfaultfd.c:1899 [inline]
 userfaultfd_ioctl+0x5221/0x6840 fs/userfaultfd.c:2022
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0xf5/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:0x7ff238379329
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:00007ffca8233748 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffca8233918 RCX: 00007ff238379329
RDX: 0000000020000080 RSI: 00000000c028aa05 RDI: 0000000000000003
RBP: 00007

Crashes (264):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/18 22:42 linux-next 7fa366f1b6e3 1432fc84 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/20 05:43 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/20 03: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 move_pages
2024/12/20 02:20 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/20 00:53 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 18:54 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 18:52 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 17:45 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 17:28 linux-next 8503810115fb 1d58202c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 12:25 linux-next 8503810115fb 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 01:40 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 00:40 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/19 00:40 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 21:00 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 20:50 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 19:48 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 18:37 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 18:14 linux-next 7fa366f1b6e3 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 14:21 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 13:52 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 12:45 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 12:11 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 10:55 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 10:23 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 10:01 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:39 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:36 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:36 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:31 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:31 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:27 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:26 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:15 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:15 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:08 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:08 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:02 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:02 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:01 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 09:01 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 08:53 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 08:53 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 08:37 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
2024/12/18 08:36 linux-next 7fa366f1b6e3 a0626d3a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in move_pages
* Struck through repros no longer work on HEAD.