BUG: sleeping function called from invalid context at net/core/sock.c:2772 in_atomic(): 1, irqs_disabled(): 0, pid: 185, name: kworker/u4:4 5 locks held by kworker/u4:4/185: #0: ((wq_completion)"%s""netns"){+.+.}, at: [<000000005cc3b032>] process_one_work+0xaaf/0x1af0 kernel/workqueue.c:2084 #1: (net_cleanup_work){+.+.}, at: [<00000000cb83d41d>] process_one_work+0xb01/0x1af0 kernel/workqueue.c:2088 #2: (net_sem){++++}, at: [<000000003529d244>] cleanup_net+0x23f/0xd20 net/core/net_namespace.c:494 #3: (net_mutex){+.+.}, at: [<0000000082c1acdd>] cleanup_net+0xa7d/0xd20 net/core/net_namespace.c:496 #4: (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] spin_lock_bh include/linux/spinlock.h:315 [inline] #4: (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] tipc_topsrv_stop+0x231/0x610 net/tipc/topsrv.c:685 CPU: 1 PID: 185 Comm: kworker/u4:4 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 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 ====================================================== WARNING: possible circular locking dependency detected 4.16.0-rc1+ #232 Tainted: G W ------------------------------------------------------ kworker/u4:4/185 is trying to acquire lock: (k-sk_lock-AF_TIPC){+.+.}, at: [<000000003563c21c>] lock_sock include/net/sock.h:1463 [inline] (k-sk_lock-AF_TIPC){+.+.}, at: [<000000003563c21c>] tipc_release+0x103/0xff0 net/tipc/socket.c:572 but task is already holding lock: (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] spin_lock_bh include/linux/spinlock.h:315 [inline] (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] 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:4/185: #0: ((wq_completion)"%s""netns"){+.+.}, at: [<000000005cc3b032>] process_one_work+0xaaf/0x1af0 kernel/workqueue.c:2084 #1: (net_cleanup_work){+.+.}, at: [<00000000cb83d41d>] process_one_work+0xb01/0x1af0 kernel/workqueue.c:2088 #2: (net_sem){++++}, at: [<000000003529d244>] cleanup_net+0x23f/0xd20 net/core/net_namespace.c:494 #3: (net_mutex){+.+.}, at: [<0000000082c1acdd>] cleanup_net+0xa7d/0xd20 net/core/net_namespace.c:496 #4: (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] spin_lock_bh include/linux/spinlock.h:315 [inline] #4: (&(&srv->idr_lock)->rlock){+...}, at: [<00000000fd2e3664>] tipc_topsrv_stop+0x231/0x610 net/tipc/topsrv.c:685 stack backtrace: CPU: 1 PID: 185 Comm: kworker/u4:4 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 ip6t_rpfilter: unknown options encountered ip6t_rpfilter: unknown options encountered syz-executor4: vmalloc: allocation failure, allocated 2759942144 of 4294971392 bytes, mode:0x14010c0(GFP_KERNEL|__GFP_NORETRY), nodemask=(null) syz-executor4 cpuset=/ mems_allowed=0 CPU: 0 PID: 6053 Comm: syz-executor4 Tainted: G W 4.16.0-rc1+ #232 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 warn_alloc+0x19a/0x2b0 mm/page_alloc.c:3306 __vmalloc_area_node mm/vmalloc.c:1718 [inline] __vmalloc_node_range+0x482/0x650 mm/vmalloc.c:1759 __vmalloc_node mm/vmalloc.c:1804 [inline] __vmalloc_node_flags_caller+0x50/0x60 mm/vmalloc.c:1826 kvmalloc_node+0x82/0xd0 mm/util.c:428 kvmalloc include/linux/mm.h:541 [inline] xt_alloc_table_info+0x63/0xe0 net/netfilter/x_tables.c:1016 do_replace net/ipv4/netfilter/ip_tables.c:1130 [inline] do_ipt_set_ctl+0x29b/0x5f0 net/ipv4/netfilter/ip_tables.c:1675 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115 ip_setsockopt+0x97/0xa0 net/ipv4/ip_sockglue.c:1261 udp_setsockopt+0x45/0x80 net/ipv4/udp.c:2401 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2979 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 RIP: 0033:0x453d69 RSP: 002b:00007f0b1dafac68 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007f0b1dafb6d4 RCX: 0000000000453d69 RDX: 0000000000000040 RSI: 0000000000000000 RDI: 0000000000000015 RBP: 000000000072c010 R08: 0000000000000258 R09: 0000000000000000 R10: 0000000020a4fd58 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000004d6 R14: 00000000006f74b0 R15: 0000000000000002 Mem-Info: active_anon:57278 inactive_anon:63 isolated_anon:0 active_file:3228 inactive_file:2467 isolated_file:0 unevictable:0 dirty:248 writeback:0 unstable:0 slab_reclaimable:7303 slab_unreclaimable:91318 mapped:21061 shmem:70 pagetables:633 bounce:0 free:29272 free_pcp:248 free_cma:0 Node 0 active_anon:229112kB inactive_anon:252kB active_file:12912kB inactive_file:9868kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:84244kB dirty:992kB writeback:0kB shmem:280kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 96256kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no Node 0 DMA free:15908kB min:164kB low:204kB high:244kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB lowmem_reserve[]: 0 2868 6378 6378 Node 0 DMA32 free:44336kB min:30316kB low:37892kB high:45468kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:3129292kB managed:2939940kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB lowmem_reserve[]: 0 0 3510 3510 Node 0 Normal free:56844kB min:37100kB low:46372kB high:55644kB active_anon:229296kB inactive_anon:252kB active_file:12836kB inactive_file:10320kB unevictable:0kB writepending:992kB present:4718592kB managed:3594328kB mlocked:0kB kernel_stack:3904kB pagetables:2532kB bounce:0kB free_pcp:992kB local_pcp:276kB free_cma:0kB lowmem_reserve[]: 0 0 0 0 Node 0 DMA: 1*4kB (U) 0*8kB 0*16kB 1*32kB (U) 2*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15908kB Node 0 DMA32: 3*4kB (UM) 4*8kB (UM) 4*16kB (UM) 3*32kB (M) 3*64kB (UM) 2*128kB (M) 2*256kB (M) 3*512kB (UM) 3*1024kB (M) 1*2048kB (M) 9*4096kB (M) = 44684kB Node 0 Normal: 927*4kB (UME) 502*8kB (UME) 215*16kB (UME) 86*32kB (UME) 225*64kB (UME) 16*128kB (UME) 6*256kB (UME) 17*512kB (ME) 16*1024kB (UM) 0*2048kB 0*4096kB = 56988kB Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB 5784 total pagecache pages 0 pages in swap cache Swap cache stats: add 0, delete 0, find 0/0 Free swap = 0kB Total swap = 0kB 1965969 pages RAM 0 pages HighMem/MovableOnly 328425 pages reserved kauditd_printk_skb: 3 callbacks suppressed audit: type=1400 audit(1519061551.552:29): avc: denied { getopt } for pid=6112 comm="syz-executor6" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_crypto_socket permissive=1 sctp: [Deprecated]: syz-executor7 (pid 6136) Use of int in max_burst socket option deprecated. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor0 (pid 6140) Use of int in max_burst socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor7 (pid 6145) Use of int in max_burst socket option deprecated. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor0 (pid 6140) Use of int in max_burst socket option. Use struct sctp_assoc_value instead xt_nfacct: accounting object with name `syz0' does not exists xt_nfacct: accounting object with name `syz0' does not exists sctp: [Deprecated]: syz-executor4 (pid 6230) Use of int in max_burst socket option deprecated. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor4 (pid 6233) Use of int in max_burst socket option deprecated. Use struct sctp_assoc_value instead syz-executor6 uses obsolete (PF_INET,SOCK_PACKET) xt_connbytes: Forcing CT accounting to be enabled TCP: request_sock_TCP: Possible SYN flooding on port 20001. Sending cookies. Check SNMP counters. sctp: [Deprecated]: syz-executor7 (pid 6315) Use of int in max_burst socket option. Use struct sctp_assoc_value instead audit: type=1400 audit(1519061552.153:30): avc: denied { relabelto } for pid=6325 comm="syz-executor4" 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(1519061552.154:31): avc: denied { send } for pid=6325 comm="syz-executor4" saddr=fe80::4:e src=47955 daddr=fe80:: dest=53232 netif=tunl0 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 sctp: [Deprecated]: syz-executor7 (pid 6337) Use of int in max_burst socket option. Use struct sctp_assoc_value instead audit: type=1400 audit(1519061552.154:32): avc: denied { send } for pid=6325 comm="syz-executor4" saddr=fe80::4:e daddr=fe80::4:e netif=lo 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(1519061552.427:33): avc: denied { prog_run } for pid=6398 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=bpf permissive=1 IPv4: Oversized IP packet from 127.0.0.1 dccp_close: ABORT with 254 bytes unread ip6t_REJECT: TCP_RESET illegal for non-tcp ip6t_REJECT: TCP_RESET illegal for non-tcp syz-executor3 (6455) used greatest stack depth: 14384 bytes left audit: type=1400 audit(1519061552.719:34): avc: denied { map } for pid=6495 comm="syz-executor7" path="socket:[16741]" dev="sockfs" ino=16741 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=tcp_socket permissive=1 openvswitch: netlink: Either Ethernet header or EtherType is required. RDS: rds_bind could not find a transport for 224.0.0.1, load rds_tcp or rds_rdma? ip_tables: error: `{‹ÅÉMà>¿¨ÀƒzýQ°Â “ÿ|,lûL _ 3¸' netlink: 8 bytes leftover after parsing attributes in process `syz-executor7'. xt_connbytes: Forcing CT accounting to be enabled mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium netlink: 8 bytes leftover after parsing attributes in process `syz-executor7'. mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium audit: type=1400 audit(1519061553.091:35): avc: denied { ioctl } for pid=6626 comm="syz-executor3" path="socket:[17946]" dev="sockfs" ino=17946 ioctlcmd=0x8903 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 openvswitch: netlink: Message has 4 unknown bytes.