====================================================== WARNING: possible circular locking dependency detected 5.0.0+ #15 Not tainted ------------------------------------------------------ syz-executor618/7546 is trying to acquire lock: 0000000045f218a9 (&rp->fetch_lock){+.+.}, at: mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 but task is already holding lock: 00000000e52354c2 (&mm->mmap_sem){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1427 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:4202 __might_fault mm/memory.c:4406 [inline] __might_fault+0x15e/0x1e0 mm/memory.c:4391 _copy_to_user+0x30/0x120 lib/usercopy.c:25 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:700 [inline] do_loop_readv_writev fs/read_write.c:687 [inline] do_iter_read+0x4a9/0x660 fs/read_write.c:921 compat_readv+0x18e/0x200 fs/read_write.c:1164 do_compat_preadv64+0x190/0x1c0 fs/read_write.c:1213 __do_compat_sys_preadv fs/read_write.c:1233 [inline] __se_compat_sys_preadv fs/read_write.c:1227 [inline] __ia32_compat_sys_preadv+0xc7/0x140 fs/read_write.c:1227 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x281/0xc98 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 -> #0 (&rp->fetch_lock){+.+.}: check_prevs_add kernel/locking/lockdep.c:2324 [inline] validate_chain kernel/locking/lockdep.c:2705 [inline] __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3692 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4202 __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:3039 do_cow_fault mm/memory.c:3478 [inline] do_fault mm/memory.c:3580 [inline] handle_pte_fault mm/memory.c:3809 [inline] __handle_mm_fault+0xf6c/0x3ec0 mm/memory.c:3933 handle_mm_fault+0x43f/0xb30 mm/memory.c:3970 faultin_page mm/gup.c:538 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:741 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1399 __mm_populate+0x204/0x380 mm/gup.c:1447 mm_populate include/linux/mm.h:2343 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:367 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1609 __do_sys_mmap_pgoff mm/mmap.c:1620 [inline] __se_sys_mmap_pgoff mm/mmap.c:1616 [inline] __ia32_sys_mmap_pgoff+0xdd/0x1a0 mm/mmap.c:1616 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x281/0xc98 arch/x86/entry/common.c:397 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); lock(&rp->fetch_lock); lock(&mm->mmap_sem); lock(&rp->fetch_lock); *** DEADLOCK *** 1 lock held by syz-executor618/7546: #0: 00000000e52354c2 (&mm->mmap_sem){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1427 stack backtrace: CPU: 0 PID: 7546 Comm: syz-executor618 Not tainted 5.0.0+ #15 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:1562 check_prev_add.constprop.0+0xf11/0x23c0 kernel/locking/lockdep.c:2211 check_prevs_add kernel/locking/lockdep.c:2324 [inline] validate_chain kernel/locking/lockdep.c:2705 [inline] __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3692 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4202 __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:3039 do_cow_fault mm/memory.c:3478 [inline] do_fault mm/memory.c:3580 [inline] handle_pte_fault mm/memory.c:3809 [inline] __handle_mm_fault+0xf6c/0x3ec0 mm/memory.c:3933 handle_mm_fault+0x43f/0xb30 mm/memory.c:3970 faultin_page mm/gup.c:538 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:741 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1399 __mm_populate+0x204/0x380 mm/gup.c:1447 mm_populate include/linux/mm.h:2343 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:367 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1609 __do_sys_mmap_pgoff mm/mmap.c:1620 [inline] __se_sys_mmap_pgoff mm/mmap.c:1616 [inline] __ia32_sys_mmap_pgoff+0xdd/0x1a0 mm/mmap.c:1616 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x281/0xc98 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f45869 Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 14 24 c3 8b 3c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 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:00000000f7f2011c EFLAGS: 00000296 ORIG_RAX: 00000000000000c0 RAX: ffffffffffffffda RBX: 0000000020a05000 RCX: 0000000000400000 RDX: 0000000000000013 RSI: 0000000000008012 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000