======================================================
WARNING: possible circular locking dependency detected
4.17.0-rc2+ #22 Not tainted
------------------------------------------------------
syz-executor5/10685 is trying to acquire lock:
        (ptrval) (sk_lock-AF_INET){+.+.}, at: lock_sock include/net/sock.h:1469 [inline]
        (ptrval) (sk_lock-AF_INET){+.+.}, at: tcp_mmap+0x1c7/0x14f0 net/ipv4/tcp.c:1759

but task is already holding lock:
        (ptrval) (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x1a1/0x2a0 mm/util.c:355

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&mm->mmap_sem){++++}:
       __might_fault+0x155/0x1e0 mm/memory.c:4555
       _copy_from_iter_full+0x2fd/0xd10 lib/iov_iter.c:607
       copy_from_iter_full include/linux/uio.h:124 [inline]
       skb_do_copy_data_nocache include/net/sock.h:1883 [inline]
       skb_add_data_nocache include/net/sock.h:1894 [inline]
       tcp_sendmsg_locked+0x2f98/0x3e10 net/ipv4/tcp.c:1316
       tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1446
       inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798
       sock_sendmsg_nosec net/socket.c:629 [inline]
       sock_sendmsg+0xd5/0x120 net/socket.c:639
       sock_write_iter+0x35a/0x5a0 net/socket.c:908
       call_write_iter include/linux/fs.h:1784 [inline]
       new_sync_write fs/read_write.c:474 [inline]
       __vfs_write+0x64d/0x960 fs/read_write.c:487
       vfs_write+0x1f8/0x560 fs/read_write.c:549
       ksys_write+0xf9/0x250 fs/read_write.c:598
       __do_sys_write fs/read_write.c:610 [inline]
       __se_sys_write fs/read_write.c:607 [inline]
       __x64_sys_write+0x73/0xb0 fs/read_write.c:607
       do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (sk_lock-AF_INET){+.+.}:
       lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
       lock_sock_nested+0xd0/0x120 net/core/sock.c:2844
       lock_sock include/net/sock.h:1469 [inline]
       tcp_mmap+0x1c7/0x14f0 net/ipv4/tcp.c:1759
       sock_mmap+0x8e/0xc0 net/socket.c:1144
       call_mmap include/linux/fs.h:1789 [inline]
       mmap_region+0xd13/0x1820 mm/mmap.c:1723
       do_mmap+0xc79/0x11d0 mm/mmap.c:1494
       do_mmap_pgoff include/linux/mm.h:2237 [inline]
       vm_mmap_pgoff+0x1fb/0x2a0 mm/util.c:357
       ksys_mmap_pgoff+0x4c9/0x640 mm/mmap.c:1544
       __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+0x1b1/0x800 arch/x86/entry/common.c:287
       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(sk_lock-AF_INET);
                               lock(&mm->mmap_sem);
sock: sock_set_timeout: `syz-executor1' (pid 10726) tries to set negative timeout
  lock(sk_lock-AF_INET);

 *** DEADLOCK ***

1 lock held by syz-executor5/10685:
 #0:         (ptrval) (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x1a1/0x2a0 mm/util.c:355

stack backtrace:
CPU: 0 PID: 10685 Comm: syz-executor5 Not tainted 4.17.0-rc2+ #22
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
sock: sock_set_timeout: `syz-executor1' (pid 10726) tries to set negative timeout
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_circular_bug.isra.36.cold.54+0x1bd/0x27d kernel/locking/lockdep.c:1223
 check_prev_add kernel/locking/lockdep.c:1863 [inline]
 check_prevs_add kernel/locking/lockdep.c:1976 [inline]
 validate_chain kernel/locking/lockdep.c:2417 [inline]
 __lock_acquire+0x343e/0x5140 kernel/locking/lockdep.c:3431
 lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
 lock_sock_nested+0xd0/0x120 net/core/sock.c:2844
 lock_sock include/net/sock.h:1469 [inline]
 tcp_mmap+0x1c7/0x14f0 net/ipv4/tcp.c:1759
 sock_mmap+0x8e/0xc0 net/socket.c:1144
 call_mmap include/linux/fs.h:1789 [inline]
 mmap_region+0xd13/0x1820 mm/mmap.c:1723
 do_mmap+0xc79/0x11d0 mm/mmap.c:1494
 do_mmap_pgoff include/linux/mm.h:2237 [inline]
 vm_mmap_pgoff+0x1fb/0x2a0 mm/util.c:357
 ksys_mmap_pgoff+0x4c9/0x640 mm/mmap.c:1544
 __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+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455979
RSP: 002b:00007f0e775a9c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007f0e775aa6d4 RCX: 0000000000455979
RDX: 0000000000000004 RSI: 000000000000a000 RDI: 0000000020ff6000
RBP: 000000000072bea0 R08: 0000000000000013 R09: 0000000000000000
R10: 0000000000000013 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000003fe R14: 00000000006f9070 R15: 0000000000000000
ieee80211 phy4: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy5: Selected rate control algorithm 'minstrel_ht'
netlink: 'syz-executor4': attribute type 2 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
kernel msg: ebtables bug: please report to author: entries_size too small
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
kernel msg: ebtables bug: please report to author: entries_size too small
netlink: 'syz-executor4': attribute type 2 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
netlink: 'syz-executor0': attribute type 29 has an invalid length.
bridge0: port 2(bridge_slave_1) entered disabled state
bridge0: port 1(bridge_slave_0) entered disabled state
nla_parse: 11 callbacks suppressed
netlink: 4 bytes leftover after parsing attributes in process `syz-executor7'.
BUG: sleeping function called from invalid context at mm/slab.h:421
in_atomic(): 1, irqs_disabled(): 1, pid: 4444, name: sshd
INFO: lockdep is turned off.
irq event stamp: 136314
netlink: 'syz-executor0': attribute type 53 has an invalid length.
hardirqs last  enabled at (136313): [<ffffffff876fd434>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
hardirqs last  enabled at (136313): [<ffffffff876fd434>] _raw_spin_unlock_irqrestore+0x74/0xc0 kernel/locking/spinlock.c:184
hardirqs last disabled at (136314): [<ffffffff876e554d>] __schedule+0x22d/0x1e30 kernel/sched/core.c:3417
softirqs last  enabled at (136290): [<ffffffff85d6e1e2>] spin_unlock_bh include/linux/spinlock.h:355 [inline]
softirqs last  enabled at (136290): [<ffffffff85d6e1e2>] release_sock+0x1e2/0x2b0 net/core/sock.c:2864
softirqs last disabled at (136288): [<ffffffff85d6e074>] spin_lock_bh include/linux/spinlock.h:315 [inline]
softirqs last disabled at (136288): [<ffffffff85d6e074>] release_sock+0x74/0x2b0 net/core/sock.c:2851
CPU: 1 PID: 4444 Comm: sshd Not tainted 4.17.0-rc2+ #22
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 ___might_sleep.cold.87+0x11f/0x13a kernel/sched/core.c:6188
 __might_sleep+0x95/0x190 kernel/sched/core.c:6141
 slab_pre_alloc_hook mm/slab.h:421 [inline]
 slab_alloc mm/slab.c:3378 [inline]
 __do_kmalloc mm/slab.c:3716 [inline]
 __kmalloc+0x2b9/0x760 mm/slab.c:3727
 kmalloc_array include/linux/slab.h:631 [inline]
 kcalloc include/linux/slab.h:642 [inline]
 numa_crng_init drivers/char/random.c:798 [inline]
 crng_reseed+0x427/0x920 drivers/char/random.c:923
 credit_entropy_bits+0x98d/0xa30 drivers/char/random.c:708
 add_interrupt_randomness+0x494/0x860 drivers/char/random.c:1254
 handle_irq_event_percpu+0xf9/0x1c0 kernel/irq/handle.c:191
 handle_irq_event+0xa7/0x135 kernel/irq/handle.c:206
 handle_edge_irq+0x20f/0x870 kernel/irq/chip.c:791
 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
 handle_irq+0x18c/0x2e7 arch/x86/kernel/irq_64.c:77
 do_IRQ+0x78/0x190 arch/x86/kernel/irq.c:245
 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:642
 </IRQ>
RIP: 0010:__sanitizer_cov_trace_const_cmp8+0x1/0x20 kernel/kcov.c:194
RSP: 0018:ffff8801b66c75c0 EFLAGS: 00000202 ORIG_RAX: ffffffffffffffd8
RAX: ffff8801b80e0180 RBX: 0000000000000514 RCX: ffffffff81c5c4aa
RDX: 0000000000000000 RSI: 0000000000000514 RDI: 0000000000000000
RBP: ffff8801b66c7a90 R08: ffff8801b80e0180 R09: 0000000000000000
R10: ffff8801b66c7aa8 R11: ffff8801b80e0180 R12: 0000000000000000
R13: 0000000000000001 R14: ffff8801d0ba4148 R15: 0000000000000a28
 core_sys_select+0x768/0xb60 fs/select.c:655
 kern_select+0x1b7/0x250 fs/select.c:696
 __do_sys_select fs/select.c:705 [inline]
 __se_sys_select fs/select.c:702 [inline]
 __x64_sys_select+0xbe/0x150 fs/select.c:702
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fec621d0dd3
RSP: 002b:00007fff33688578 EFLAGS: 00000246 ORIG_RAX: 0000000000000017
RAX: ffffffffffffffda RBX: 00007fff33688600 RCX: 00007fec621d0dd3
RDX: 00005640fb95cab0 RSI: 00005640fb95cad0 RDI: 000000000000000c
RBP: 00005640fa40f8dc R08: 00007fff336885a0 R09: 0101010101010101
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff33688608
R13: 0000000000000000 R14: 00007fff336885f8 R15: 00007fff336885fc
random: crng init done
netlink: 20 bytes leftover after parsing attributes in process `syz-executor1'.
netlink: 20 bytes leftover after parsing attributes in process `syz-executor1'.
validate_nla: 1 callbacks suppressed
netlink: 'syz-executor0': attribute type 10 has an invalid length.
netlink: 'syz-executor1': attribute type 4 has an invalid length.
netlink: 28 bytes leftover after parsing attributes in process `syz-executor1'.
netlink: 'syz-executor0': attribute type 10 has an invalid length.
netlink: 'syz-executor1': attribute type 4 has an invalid length.
netlink: 28 bytes leftover after parsing attributes in process `syz-executor1'.
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
CPU: 1 PID: 11570 Comm: syz-executor3 Tainted: G        W         4.17.0-rc2+ #22
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+0x1b9/0x294 lib/dump_stack.c:113
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold.4+0xa/0x1a lib/fault-inject.c:149
 __should_failslab+0x124/0x180 mm/failslab.c:32
 should_failslab+0x9/0x14 mm/slab_common.c:1522
 slab_pre_alloc_hook mm/slab.h:423 [inline]
 slab_alloc mm/slab.c:3378 [inline]
 __do_kmalloc mm/slab.c:3716 [inline]
 __kmalloc_track_caller+0x2c4/0x760 mm/slab.c:3733
 memdup_user+0x2c/0xa0 mm/util.c:160
 map_lookup_elem+0x2ed/0xe10 kernel/bpf/syscall.c:617
 __do_sys_bpf kernel/bpf/syscall.c:2099 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:2073 [inline]
 __x64_sys_bpf+0x31a/0x4e0 kernel/bpf/syscall.c:2073
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455979
RSP: 002b:00007f58a137bc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f58a137c6d4 RCX: 0000000000455979
RDX: 0000000000000018 RSI: 00000000200001c0 RDI: 0000000000000001
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000014
R13: 000000000000003f R14: 00000000006f3688 R15: 0000000000000000
kernel msg: ebtables bug: please report to author: Wrong len argument
kernel msg: ebtables bug: please report to author: Wrong len argument
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 0 PID: 11639 Comm: syz-executor3 Tainted: G        W         4.17.0-rc2+ #22
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+0x1b9/0x294 lib/dump_stack.c:113
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold.4+0xa/0x1a lib/fault-inject.c:149
 __should_failslab+0x124/0x180 mm/failslab.c:32
 should_failslab+0x9/0x14 mm/slab_common.c:1522
 slab_pre_alloc_hook mm/slab.h:423 [inline]
 slab_alloc mm/slab.c:3378 [inline]
 kmem_cache_alloc_trace+0x2cb/0x780 mm/slab.c:3618
 kmalloc include/linux/slab.h:512 [inline]
 map_lookup_elem+0x87d/0xe10 kernel/bpf/syscall.c:633
 __do_sys_bpf kernel/bpf/syscall.c:2099 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:2073 [inline]
 __x64_sys_bpf+0x31a/0x4e0 kernel/bpf/syscall.c:2073
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
kernel msg: ebtables bug: please report to author: Wrong len argument
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455979
RSP: 002b:00007f58a137bc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f58a137c6d4 RCX: 0000000000455979
RDX: 0000000000000018 RSI: 00000000200001c0 RDI: 0000000000000001
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000014
R13: 000000000000003f R14: 00000000006f3688 R15: 0000000000000001