====================================================== WARNING: possible circular locking dependency detected 5.1.0-rc5+ #75 Not tainted ------------------------------------------------------ syz-executor.0/7762 is trying to acquire lock: 00000000583aa2cc (&rp->fetch_lock){+.+.}, at: mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 but task is already holding lock: 0000000035adcc40 (&mm->mmap_sem){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1437 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem){++++}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211 __might_fault mm/memory.c:4407 [inline] __might_fault+0x15e/0x1e0 mm/memory.c:4392 _copy_to_user+0x30/0x120 lib/usercopy.c:25 copy_to_user include/linux/uaccess.h:152 [inline] mon_bin_get_event+0x117/0x450 drivers/usb/mon/mon_bin.c:756 mon_bin_ioctl+0xacf/0xc80 drivers/usb/mon/mon_bin.c:1068 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&rp->fetch_lock){+.+.}: check_prevs_add kernel/locking/lockdep.c:2333 [inline] validate_chain kernel/locking/lockdep.c:2714 [inline] __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211 __mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x116/0x4e0 mm/memory.c:3040 do_cow_fault mm/memory.c:3479 [inline] do_fault mm/memory.c:3581 [inline] handle_pte_fault mm/memory.c:3810 [inline] __handle_mm_fault+0xf6c/0x3ec0 mm/memory.c:3934 handle_mm_fault+0x43f/0xb30 mm/memory.c:3971 faultin_page mm/gup.c:548 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:751 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1409 __mm_populate+0x204/0x380 mm/gup.c:1457 mm_populate include/linux/mm.h:2357 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:367 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1609 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem); lock(&rp->fetch_lock); lock(&mm->mmap_sem); lock(&rp->fetch_lock); *** DEADLOCK *** 1 lock held by syz-executor.0/7762: #0: 0000000035adcc40 (&mm->mmap_sem){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1437 stack backtrace: CPU: 1 PID: 7762 Comm: syz-executor.0 Not tainted 5.1.0-rc5+ #75 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1571 check_prev_add.constprop.0+0xf11/0x23c0 kernel/locking/lockdep.c:2220 check_prevs_add kernel/locking/lockdep.c:2333 [inline] validate_chain kernel/locking/lockdep.c:2714 [inline] __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211 __mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x116/0x4e0 mm/memory.c:3040 do_cow_fault mm/memory.c:3479 [inline] do_fault mm/memory.c:3581 [inline] handle_pte_fault mm/memory.c:3810 [inline] __handle_mm_fault+0xf6c/0x3ec0 mm/memory.c:3934 handle_mm_fault+0x43f/0xb30 mm/memory.c:3971 faultin_page mm/gup.c:548 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:751 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1409 __mm_populate+0x204/0x380 mm/gup.c:1457 mm_populate include/linux/mm.h:2357 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:367 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1609 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x458c29 Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f2a9e463c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000458c29