====================================================== WARNING: possible circular locking dependency detected 5.4.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/30416 is trying to acquire lock: ffff88809c7d3100 (&rp->fetch_lock){+.+.}, at: mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 but task is already holding lock: ffff88806152a198 (&mm->mmap_sem#2){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1251 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem#2){++++}: __might_fault mm/memory.c:4524 [inline] __might_fault+0x15e/0x1e0 mm/memory.c:4509 _copy_to_user+0x30/0x160 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:152 [inline] mon_bin_read+0x329/0x640 drivers/usb/mon/mon_bin.c:825 do_loop_readv_writev fs/read_write.c:714 [inline] do_loop_readv_writev fs/read_write.c:701 [inline] do_iter_read+0x4a4/0x660 fs/read_write.c:935 compat_readv+0x187/0x1f0 fs/read_write.c:1186 do_compat_readv+0xf5/0x1f0 fs/read_write.c:1206 __do_compat_sys_readv fs/read_write.c:1218 [inline] __se_compat_sys_readv fs/read_write.c:1214 [inline] __ia32_compat_sys_readv+0x74/0xb0 fs/read_write.c:1214 do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline] do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 -> #0 (&rp->fetch_lock){+.+.}: check_prev_add kernel/locking/lockdep.c:2476 [inline] check_prevs_add kernel/locking/lockdep.c:2581 [inline] validate_chain kernel/locking/lockdep.c:2971 [inline] __lock_acquire+0x2596/0x4a00 kernel/locking/lockdep.c:3955 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1106 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1121 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x111/0x540 mm/memory.c:3166 do_cow_fault mm/memory.c:3592 [inline] do_fault mm/memory.c:3694 [inline] handle_pte_fault mm/memory.c:3923 [inline] __handle_mm_fault+0xce8/0x4040 mm/memory.c:4047 handle_mm_fault+0x3b2/0xa50 mm/memory.c:4084 faultin_page mm/gup.c:640 [inline] __get_user_pages+0x7cf/0x1ae0 mm/gup.c:845 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1223 __mm_populate+0x204/0x380 mm/gup.c:1271 mm_populate include/linux/mm.h:2357 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:501 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1629 __do_sys_mmap_pgoff mm/mmap.c:1640 [inline] __se_sys_mmap_pgoff mm/mmap.c:1636 [inline] __ia32_sys_mmap_pgoff+0xdd/0x1a0 mm/mmap.c:1636 do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline] do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem#2); lock(&rp->fetch_lock); lock(&mm->mmap_sem#2); lock(&rp->fetch_lock); *** DEADLOCK *** 1 lock held by syz-executor.2/30416: #0: ffff88806152a198 (&mm->mmap_sem#2){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1251 stack backtrace: CPU: 0 PID: 30416 Comm: syz-executor.2 Not tainted 5.4.0-syzkaller #0 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+0x197/0x210 lib/dump_stack.c:118 print_circular_bug.isra.0.cold+0x163/0x172 kernel/locking/lockdep.c:1685 check_noncircular+0x32e/0x3e0 kernel/locking/lockdep.c:1809 check_prev_add kernel/locking/lockdep.c:2476 [inline] check_prevs_add kernel/locking/lockdep.c:2581 [inline] validate_chain kernel/locking/lockdep.c:2971 [inline] __lock_acquire+0x2596/0x4a00 kernel/locking/lockdep.c:3955 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1106 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1121 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x111/0x540 mm/memory.c:3166 do_cow_fault mm/memory.c:3592 [inline] do_fault mm/memory.c:3694 [inline] handle_pte_fault mm/memory.c:3923 [inline] __handle_mm_fault+0xce8/0x4040 mm/memory.c:4047 handle_mm_fault+0x3b2/0xa50 mm/memory.c:4084 faultin_page mm/gup.c:640 [inline] __get_user_pages+0x7cf/0x1ae0 mm/gup.c:845 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1223 __mm_populate+0x204/0x380 mm/gup.c:1271 mm_populate include/linux/mm.h:2357 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:501 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1629 __do_sys_mmap_pgoff mm/mmap.c:1640 [inline] __se_sys_mmap_pgoff mm/mmap.c:1636 [inline] __ia32_sys_mmap_pgoff+0xdd/0x1a0 mm/mmap.c:1636 do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline] do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f0ca39 Code: 00 00 00 89 d3 5b 5e 5f 5d c3 b8 80 96 98 00 eb c4 8b 04 24 c3 8b 1c 24 c3 8b 34 24 c3 8b 3c 24 c3 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000f5d080cc EFLAGS: 00000296 ORIG_RAX: 00000000000000c0 RAX: ffffffffffffffda RBX: 0000000020a05000 RCX: 0000000000400300 RDX: 0000000001000002 RSI: 0000000000008012 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000