BUG: sleeping function called from invalid context at net/core/sock.c:2772 in_atomic(): 1, irqs_disabled(): 0, pid: 438, name: kworker/u4:3 5 locks held by kworker/u4:3/438: #0: ((wq_completion)"%s""netns"){+.+.}, at: [<00000000cf04ff28>] process_one_work+0xaaf/0x1af0 kernel/workqueue.c:2084 #1: (net_cleanup_work){+.+.}, at: [<00000000981c6e46>] process_one_work+0xb01/0x1af0 kernel/workqueue.c:2088 #2: (net_sem){++++}, at: [<00000000eb4e5a8c>] cleanup_net+0x23f/0xd20 net/core/net_namespace.c:494 #3: (net_mutex){+.+.}, at: [<0000000002eafda5>] cleanup_net+0xa7d/0xd20 net/core/net_namespace.c:496 #4: (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] spin_lock_bh include/linux/spinlock.h:315 [inline] #4: (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] tipc_topsrv_stop+0x231/0x610 net/tipc/topsrv.c:685 CPU: 0 PID: 438 Comm: kworker/u4:3 Not tainted 4.16.0-rc1+ #232 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 ___might_sleep+0x2b2/0x470 kernel/sched/core.c:6128 __might_sleep+0x95/0x190 kernel/sched/core.c:6081 lock_sock_nested+0x37/0x110 net/core/sock.c:2772 lock_sock include/net/sock.h:1463 [inline] tipc_release+0x103/0xff0 net/tipc/socket.c:572 netlink: 'syz-executor2': attribute type 6 has an invalid length. netlink: 1 bytes leftover after parsing attributes in process `syz-executor2'. Cannot find add_set index 0 as target sock_release+0x8d/0x1e0 net/socket.c:594 tipc_topsrv_stop+0x3c0/0x610 net/tipc/topsrv.c:696 tipc_exit_net+0x15/0x40 net/tipc/core.c:96 ops_exit_list.isra.6+0xae/0x150 net/core/net_namespace.c:148 cleanup_net+0x6ba/0xd20 net/core/net_namespace.c:529 process_one_work+0xbbf/0x1af0 kernel/workqueue.c:2113 netlink: 'syz-executor2': attribute type 6 has an invalid length. worker_thread+0x223/0x1990 kernel/workqueue.c:2247 netlink: 1 bytes leftover after parsing attributes in process `syz-executor2'. Cannot find add_set index 0 as target kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 ====================================================== WARNING: possible circular locking dependency detected 4.16.0-rc1+ #232 Tainted: G W ------------------------------------------------------ kworker/u4:3/438 is trying to acquire lock: (k-sk_lock-AF_TIPC){+.+.}, at: [<0000000008929e9b>] lock_sock include/net/sock.h:1463 [inline] (k-sk_lock-AF_TIPC){+.+.}, at: [<0000000008929e9b>] tipc_release+0x103/0xff0 net/tipc/socket.c:572 but task is already holding lock: (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] spin_lock_bh include/linux/spinlock.h:315 [inline] (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] tipc_topsrv_stop+0x231/0x610 net/tipc/topsrv.c:685 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&(&srv->idr_lock)->rlock){+...}: __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:315 [inline] tipc_conn_lookup+0x1f/0x90 net/tipc/topsrv.c:225 tipc_topsrv_queue_evt+0x225/0x6d0 net/tipc/topsrv.c:326 tipc_sub_send_event+0x250/0x440 net/tipc/subscr.c:54 tipc_sub_report_overlap+0x3f6/0x4f0 net/tipc/subscr.c:98 tipc_nameseq_insert_publ net/tipc/name_table.c:329 [inline] tipc_nametbl_insert_publ+0xf1c/0x1850 net/tipc/name_table.c:489 tipc_nametbl_publish+0x2aa/0x4f0 net/tipc/name_table.c:762 tipc_sk_publish+0x1f5/0x4b0 net/tipc/socket.c:2600 tipc_sk_join net/tipc/socket.c:2770 [inline] tipc_setsockopt+0x5fd/0xcf0 net/tipc/socket.c:2874 SYSC_setsockopt net/socket.c:1850 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1829 do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x26/0x9b -> #3 (&(&sub->lock)->rlock){+...}: __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:310 [inline] tipc_sub_report_overlap+0x3ce/0x4f0 net/tipc/subscr.c:97 tipc_nameseq_insert_publ net/tipc/name_table.c:329 [inline] tipc_nametbl_insert_publ+0xf1c/0x1850 net/tipc/name_table.c:489 tipc_nametbl_publish+0x2aa/0x4f0 net/tipc/name_table.c:762 tipc_sk_publish+0x1f5/0x4b0 net/tipc/socket.c:2600 tipc_sk_join net/tipc/socket.c:2770 [inline] tipc_setsockopt+0x5fd/0xcf0 net/tipc/socket.c:2874 SYSC_setsockopt net/socket.c:1850 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1829 do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x26/0x9b -> #2 (&(&nseq->lock)->rlock){+...}: __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:315 [inline] tipc_nametbl_insert_publ+0x2da/0x1850 net/tipc/name_table.c:488 tipc_nametbl_publish+0x2aa/0x4f0 net/tipc/name_table.c:762 tipc_sk_publish+0x1f5/0x4b0 net/tipc/socket.c:2600 tipc_bind+0x1a9/0x2d0 net/tipc/socket.c:647 kernel_bind+0x62/0x80 net/socket.c:3128 tipc_topsrv_create_listener net/tipc/topsrv.c:531 [inline] tipc_topsrv_start+0x9ab/0x1010 net/tipc/topsrv.c:671 tipc_init_net+0x3cc/0x570 net/tipc/core.c:74 ops_init+0xec/0x500 net/core/net_namespace.c:124 __register_pernet_operations net/core/net_namespace.c:926 [inline] register_pernet_operations+0x45e/0xa00 net/core/net_namespace.c:1000 register_pernet_subsys+0x28/0x40 net/core/net_namespace.c:1046 tipc_init+0x83/0x104 net/tipc/core.c:136 do_one_initcall+0xad/0x357 init/main.c:832 do_initcall_level init/main.c:898 [inline] do_initcalls init/main.c:906 [inline] do_basic_setup init/main.c:924 [inline] kernel_init_freeable+0x469/0x521 init/main.c:1072 kernel_init+0x13/0x180 init/main.c:999 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 -> #1 (&(&tn->nametbl_lock)->rlock){+...}: __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:315 [inline] tipc_nametbl_publish+0x1ff/0x4f0 net/tipc/name_table.c:754 tipc_sk_publish+0x1f5/0x4b0 net/tipc/socket.c:2600 tipc_bind+0x1a9/0x2d0 net/tipc/socket.c:647 kernel_bind+0x62/0x80 net/socket.c:3128 tipc_topsrv_create_listener net/tipc/topsrv.c:531 [inline] tipc_topsrv_start+0x9ab/0x1010 net/tipc/topsrv.c:671 tipc_init_net+0x3cc/0x570 net/tipc/core.c:74 ops_init+0xec/0x500 net/core/net_namespace.c:124 __register_pernet_operations net/core/net_namespace.c:926 [inline] register_pernet_operations+0x45e/0xa00 net/core/net_namespace.c:1000 register_pernet_subsys+0x28/0x40 net/core/net_namespace.c:1046 tipc_init+0x83/0x104 net/tipc/core.c:136 do_one_initcall+0xad/0x357 init/main.c:832 do_initcall_level init/main.c:898 [inline] do_initcalls init/main.c:906 [inline] do_basic_setup init/main.c:924 [inline] kernel_init_freeable+0x469/0x521 init/main.c:1072 kernel_init+0x13/0x180 init/main.c:999 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 -> #0 (k-sk_lock-AF_TIPC){+.+.}: lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920 lock_sock_nested+0xc2/0x110 net/core/sock.c:2781 lock_sock include/net/sock.h:1463 [inline] tipc_release+0x103/0xff0 net/tipc/socket.c:572 sock_release+0x8d/0x1e0 net/socket.c:594 tipc_topsrv_stop+0x3c0/0x610 net/tipc/topsrv.c:696 tipc_exit_net+0x15/0x40 net/tipc/core.c:96 ops_exit_list.isra.6+0xae/0x150 net/core/net_namespace.c:148 cleanup_net+0x6ba/0xd20 net/core/net_namespace.c:529 process_one_work+0xbbf/0x1af0 kernel/workqueue.c:2113 worker_thread+0x223/0x1990 kernel/workqueue.c:2247 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 other info that might help us debug this: Chain exists of: k-sk_lock-AF_TIPC --> &(&sub->lock)->rlock --> &(&srv->idr_lock)->rlock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&(&srv->idr_lock)->rlock); lock(&(&sub->lock)->rlock); lock(&(&srv->idr_lock)->rlock); lock(k-sk_lock-AF_TIPC); *** DEADLOCK *** 5 locks held by kworker/u4:3/438: #0: ((wq_completion)"%s""netns"){+.+.}, at: [<00000000cf04ff28>] process_one_work+0xaaf/0x1af0 kernel/workqueue.c:2084 #1: (net_cleanup_work){+.+.}, at: [<00000000981c6e46>] process_one_work+0xb01/0x1af0 kernel/workqueue.c:2088 #2: (net_sem){++++}, at: [<00000000eb4e5a8c>] cleanup_net+0x23f/0xd20 net/core/net_namespace.c:494 #3: (net_mutex){+.+.}, at: [<0000000002eafda5>] cleanup_net+0xa7d/0xd20 net/core/net_namespace.c:496 #4: (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] spin_lock_bh include/linux/spinlock.h:315 [inline] #4: (&(&srv->idr_lock)->rlock){+...}, at: [<0000000036293bd1>] tipc_topsrv_stop+0x231/0x610 net/tipc/topsrv.c:685 stack backtrace: CPU: 0 PID: 438 Comm: kworker/u4:3 Tainted: G W 4.16.0-rc1+ #232 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_circular_bug.isra.38+0x2cd/0x2dc 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+0x30a8/0x3e00 kernel/locking/lockdep.c:3431 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920 lock_sock_nested+0xc2/0x110 net/core/sock.c:2781 lock_sock include/net/sock.h:1463 [inline] tipc_release+0x103/0xff0 net/tipc/socket.c:572 sock_release+0x8d/0x1e0 net/socket.c:594 tipc_topsrv_stop+0x3c0/0x610 net/tipc/topsrv.c:696 tipc_exit_net+0x15/0x40 net/tipc/core.c:96 ops_exit_list.isra.6+0xae/0x150 net/core/net_namespace.c:148 cleanup_net+0x6ba/0xd20 net/core/net_namespace.c:529 process_one_work+0xbbf/0x1af0 kernel/workqueue.c:2113 worker_thread+0x223/0x1990 kernel/workqueue.c:2247 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 xt_connbytes: Forcing CT accounting to be enabled BUG: sleeping function called from invalid context at net/core/sock.c:2772 in_atomic(): 1, irqs_disabled(): 0, pid: 438, name: kworker/u4:3 INFO: lockdep is turned off. CPU: 0 PID: 438 Comm: kworker/u4:3 Tainted: G W 4.16.0-rc1+ #232 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 ___might_sleep+0x2b2/0x470 kernel/sched/core.c:6128 __might_sleep+0x95/0x190 kernel/sched/core.c:6081 lock_sock_nested+0x37/0x110 net/core/sock.c:2772 lock_sock include/net/sock.h:1463 [inline] tipc_release+0x103/0xff0 net/tipc/socket.c:572 sock_release+0x8d/0x1e0 net/socket.c:594 tipc_topsrv_stop+0x3c0/0x610 net/tipc/topsrv.c:696 tipc_exit_net+0x15/0x40 net/tipc/core.c:96 ops_exit_list.isra.6+0xae/0x150 net/core/net_namespace.c:148 cleanup_net+0x6ba/0xd20 net/core/net_namespace.c:529 process_one_work+0xbbf/0x1af0 kernel/workqueue.c:2113 worker_thread+0x223/0x1990 kernel/workqueue.c:2247 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429 dccp_close: ABORT with 1 bytes unread IPv4: Oversized IP packet from 127.0.0.1 nf_conntrack: default automatic helper assignment has been turned off for security reasons and CT-based firewall rule not found. Use the iptables CT target to attach helpers instead. netlink: 224 bytes leftover after parsing attributes in process `syz-executor2'. xt_SECMARK: target only valid in the 'mangle' or 'security' tables, not 'broute'. xt_SECMARK: target only valid in the 'mangle' or 'security' tables, not 'broute'. kernel msg: ebtables bug: please report to author: bad policy kernel msg: ebtables bug: please report to author: bad policy syz-executor1 uses obsolete (PF_INET,SOCK_PACKET) netlink: 'syz-executor2': attribute type 1 has an invalid length. netlink: 'syz-executor2': attribute type 1 has an invalid length. x_tables: ip6_tables: mh match: only valid for protocol 135 x_tables: ip6_tables: mh match: only valid for protocol 135 xt_TCPMSS: Only works on TCP SYN packets xt_TCPMSS: Only works on TCP SYN packets kauditd_printk_skb: 12 callbacks suppressed audit: type=1400 audit(1519105723.208:34): avc: denied { setopt } for pid=6125 comm="syz-executor5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1 device syz7 entered promiscuous mode audit: type=1400 audit(1519105723.289:35): avc: denied { bind } for pid=6153 comm="syz-executor2" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1 xt_connbytes: Forcing CT accounting to be enabled audit: type=1400 audit(1519105723.289:36): avc: denied { relabelto } for pid=6153 comm="syz-executor2" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:udev_var_run_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.289:37): avc: denied { send } for pid=6153 comm="syz-executor2" saddr=fe80::a8aa:aaff:feaa:20c src=55286 daddr=ff01::1 netif=wlan0 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:udev_var_run_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.289:38): avc: denied { send } for pid=6153 comm="syz-executor2" saddr=fe80::a8aa:aaff:feaa:20c src=55286 daddr=ff01::1 netif=wlan0 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:udev_var_run_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.521:39): avc: denied { getopt } for pid=6238 comm="syz-executor7" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1 xt_connbytes: Forcing CT accounting to be enabled PF_BRIDGE: br_mdb_parse() with unknown ifindex PF_BRIDGE: br_mdb_parse() with unknown ifindex audit: type=1400 audit(1519105723.893:40): avc: denied { relabelto } for pid=6379 comm="syz-executor1" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:wtmp_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.894:41): avc: denied { send } for pid=6379 comm="syz-executor1" saddr=172.20.1.11 src=60370 daddr=172.20.1.187 netif=lo scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:wtmp_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.895:42): avc: denied { send } for pid=6379 comm="syz-executor1" saddr=172.20.1.187 daddr=172.20.1.11 dest=60370 netif=lo scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:wtmp_t:s0 tclass=packet permissive=1 audit: type=1400 audit(1519105723.895:43): avc: denied { recv } for pid=6379 comm="syz-executor1" saddr=172.20.1.187 daddr=172.20.1.11 dest=60370 netif=lo scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:wtmp_t:s0 tclass=packet permissive=1 SELinux: unrecognized netlink message: protocol=4 nlmsg_type=17 sclass=netlink_tcpdiag_socket pig=6430 comm=syz-executor4 IPv4: Oversized IP packet from 127.0.0.1 xt_nfacct: accounting object with name `syz0' does not exists xt_nfacct: accounting object with name `syz0' does not exists IPv4: Oversized IP packet from 127.0.0.1 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=6504 comm=syz-executor4 netlink: 16 bytes leftover after parsing attributes in process `syz-executor1'. xt_connbytes: Forcing CT accounting to be enabled netlink: 16 bytes leftover after parsing attributes in process `syz-executor6'. netlink: 16 bytes leftover after parsing attributes in process `syz-executor6'. kernel msg: ebtables bug: please report to author: Valid hook without chain kernel msg: ebtables bug: please report to author: Valid hook without chain xt_connbytes: Forcing CT accounting to be enabled netlink: 3 bytes leftover after parsing attributes in process `syz-executor7'. netlink: 'syz-executor7': attribute type 5 has an invalid length. netlink: 3 bytes leftover after parsing attributes in process `syz-executor7'. netlink: 'syz-executor7': attribute type 5 has an invalid length. x_tables: ip6_tables: TCPOPTSTRIP target: only valid in mangle table, not filter x_tables: ip6_tables: TCPOPTSTRIP target: only valid in mangle table, not filter sctp: [Deprecated]: syz-executor3 (pid 6769) Use of int in maxseg socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor3 (pid 6781) Use of int in maxseg socket option. Use struct sctp_assoc_value instead can: request_module (can-proto-6) failed. can: request_module (can-proto-6) failed. syz-executor5 (6854) used greatest stack depth: 14384 bytes left x_tables: ip_tables: udplite match: only valid for protocol 136 x_tables: ip_tables: udplite match: only valid for protocol 136 sctp: [Deprecated]: syz-executor6 (pid 6968) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead IPv6: NLM_F_REPLACE set, but no existing node found! IPv6: NLM_F_REPLACE set, but no existing node found! SELinux: unrecognized netlink message: protocol=0 nlmsg_type=35 sclass=netlink_route_socket pig=7237 comm=syz-executor2 IPv6: Can't replace route, no match found IPv6: Can't replace route, no match found SELinux: unrecognized netlink message: protocol=0 nlmsg_type=35 sclass=netlink_route_socket pig=7237 comm=syz-executor2 xt_connbytes: Forcing CT accounting to be enabled x_tables: ip6_tables: TCPOPTSTRIP target: only valid in mangle table, not security x_tables: ip6_tables: TCPOPTSTRIP target: only valid in mangle table, not security TCP: request_sock_TCP: Possible SYN flooding on port 20001. Sending cookies. Check SNMP counters. netlink: 'syz-executor2': attribute type 1 has an invalid length. netlink: 'syz-executor2': attribute type 1 has an invalid length. SELinux: unrecognized netlink message: protocol=4 nlmsg_type=61120 sclass=netlink_tcpdiag_socket pig=7576 comm=syz-executor3 SELinux: unrecognized netlink message: protocol=4 nlmsg_type=61120 sclass=netlink_tcpdiag_socket pig=7594 comm=syz-executor3 netlink: 'syz-executor3': attribute type 3 has an invalid length. netlink: 'syz-executor3': attribute type 3 has an invalid length. netlink: 11 bytes leftover after parsing attributes in process `syz-executor5'. sctp: [Deprecated]: syz-executor4 (pid 7991) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead netlink: 11 bytes leftover after parsing attributes in process `syz-executor5'. sctp: [Deprecated]: syz-executor4 (pid 8009) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead netlink: 11 bytes leftover after parsing attributes in process `syz-executor3'. netlink: 11 bytes leftover after parsing attributes in process `syz-executor3'. Cannot find add_set index 1029 as target