syzbot


possible deadlock in xt_find_revision

Status: closed as dup on 2018/01/30 09:08
Subsystems: netfilter
[Documentation on labels]
Reported-by: syzbot+0f8d41363dab80c9a3e9@syzkaller.appspotmail.com
First crash: 2288d, last: 2288d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
possible deadlock in do_ip_getsockopt netfilter 22 2283d 2288d
Discussions (1)
Title Replies (including bot) Last reply
possible deadlock in xt_find_revision 1 (2) 2018/01/30 09:05
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in xt_find_revision C error 4117 602d 1580d 0/1 upstream: reported C repro on 2020/01/06 20:11

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.15.0-rc9+ #213 Not tainted
------------------------------------------------------
syz-executor2/5329 is trying to acquire lock:
 (&xt[i].mutex){+.+.}, at: [<00000000fe107ac6>] xt_find_revision+0xc9/0x2b0 net/netfilter/x_tables.c:367

but task is already holding lock:
 (sk_lock-AF_INET6){+.+.}, at: [<00000000dbb8a414>] lock_sock include/net/sock.h:1463 [inline]
 (sk_lock-AF_INET6){+.+.}, at: [<00000000dbb8a414>] ipv6_getsockopt+0x1c5/0x2e0 net/ipv6/ipv6_sockglue.c:1377

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sk_lock-AF_INET6){+.+.}:
       lock_sock_nested+0xc2/0x110 net/core/sock.c:2780
       lock_sock include/net/sock.h:1463 [inline]
       do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167
       ipv6_setsockopt+0xd7/0x150 net/ipv6/ipv6_sockglue.c:922
       sctp_setsockopt+0x2b6/0x61d0 net/sctp/socket.c:4141
       sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
       SYSC_setsockopt net/socket.c:1849 [inline]
       SyS_setsockopt+0x189/0x360 net/socket.c:1828
       entry_SYSCALL_64_fastpath+0x29/0xa0

-> #1 (rtnl_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
       rtnl_lock+0x17/0x20 net/core/rtnetlink.c:74
       unregister_netdevice_notifier+0x91/0x4e0 net/core/dev.c:1673
       clusterip_config_entry_put net/ipv4/netfilter/ipt_CLUSTERIP.c:114 [inline]
       clusterip_tg_destroy+0x389/0x6e0 net/ipv4/netfilter/ipt_CLUSTERIP.c:508
       cleanup_entry+0x218/0x350 net/ipv4/netfilter/ip_tables.c:659
       __do_replace+0x79d/0xa50 net/ipv4/netfilter/ip_tables.c:1094
       do_replace net/ipv4/netfilter/ip_tables.c:1150 [inline]
       do_ipt_set_ctl+0x40f/0x5f0 net/ipv4/netfilter/ip_tables.c:1680
       nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
       nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
       ip_setsockopt+0xa1/0xb0 net/ipv4/ip_sockglue.c:1260
       tcp_setsockopt+0x82/0xd0 net/ipv4/tcp.c:2872
       sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
       SYSC_setsockopt net/socket.c:1849 [inline]
       SyS_setsockopt+0x189/0x360 net/socket.c:1828
       entry_SYSCALL_64_fastpath+0x29/0xa0

-> #0 (&xt[i].mutex){+.+.}:
       lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
       xt_find_revision+0xc9/0x2b0 net/netfilter/x_tables.c:367
       do_ip6t_get_ctl+0x963/0xaf0 net/ipv6/netfilter/ip6_tables.c:1742
       nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
       nf_getsockopt+0x6a/0xc0 net/netfilter/nf_sockopt.c:122
       ipv6_getsockopt+0x1df/0x2e0 net/ipv6/ipv6_sockglue.c:1378
       tcp_getsockopt+0x82/0xd0 net/ipv4/tcp.c:3326
       sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2937
       SYSC_getsockopt net/socket.c:1880 [inline]
       SyS_getsockopt+0x178/0x340 net/socket.c:1862
       entry_SYSCALL_64_fastpath+0x29/0xa0

other info that might help us debug this:

Chain exists of:
  &xt[i].mutex --> rtnl_mutex --> sk_lock-AF_INET6

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_INET6);
                               lock(rtnl_mutex);
                               lock(sk_lock-AF_INET6);
  lock(&xt[i].mutex);

 *** DEADLOCK ***

1 lock held by syz-executor2/5329:
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<00000000dbb8a414>] lock_sock include/net/sock.h:1463 [inline]
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<00000000dbb8a414>] ipv6_getsockopt+0x1c5/0x2e0 net/ipv6/ipv6_sockglue.c:1377

stack backtrace:
CPU: 0 PID: 5329 Comm: syz-executor2 Not tainted 4.15.0-rc9+ #213
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
 print_circular_bug.isra.37+0x2cd/0x2dc kernel/locking/lockdep.c:1218
 check_prev_add kernel/locking/lockdep.c:1858 [inline]
 check_prevs_add kernel/locking/lockdep.c:1971 [inline]
 validate_chain kernel/locking/lockdep.c:2412 [inline]
 __lock_acquire+0x30a8/0x3e00 kernel/locking/lockdep.c:3426
 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
 xt_find_revision+0xc9/0x2b0 net/netfilter/x_tables.c:367
 do_ip6t_get_ctl+0x963/0xaf0 net/ipv6/netfilter/ip6_tables.c:1742
 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
 nf_getsockopt+0x6a/0xc0 net/netfilter/nf_sockopt.c:122
 ipv6_getsockopt+0x1df/0x2e0 net/ipv6/ipv6_sockglue.c:1378
 tcp_getsockopt+0x82/0xd0 net/ipv4/tcp.c:3326
 sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2937
 SYSC_getsockopt net/socket.c:1880 [inline]
 SyS_getsockopt+0x178/0x340 net/socket.c:1862
 entry_SYSCALL_64_fastpath+0x29/0xa0
RIP: 0033:0x453299
RSP: 002b:00007f96e9c0fc58 EFLAGS: 00000212 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000453299
RDX: 0000000000000045 RSI: 0000000000000029 RDI: 0000000000000014
RBP: 00000000000003d6 R08: 00000000200df000 R09: 0000000000000000
R10: 00000000200df000 R11: 0000000000000212 R12: 00000000006f4cb0
R13: 00000000ffffffff R14: 00007f96e9c106d4 R15: 0000000000000000
Cannot find add_set index 0 as target
TCP: request_sock_TCPv6: Possible SYN flooding on port 20030. Sending cookies.  Check SNMP counters.
netlink: 'syz-executor7': attribute type 16 has an invalid length.
netlink: 'syz-executor7': attribute type 16 has an invalid length.
netlink: 'syz-executor1': attribute type 21 has an invalid length.
netlink: 'syz-executor1': attribute type 21 has an invalid length.
RDS: rds_bind could not find a transport for 172.20.0.20, load rds_tcp or rds_rdma?
RDS: rds_bind could not find a transport for 172.20.0.20, load rds_tcp or rds_rdma?
Cannot find add_set index 0 as target
netlink: 1 bytes leftover after parsing attributes in process `syz-executor6'.
raw_sendmsg: syz-executor3 forgot to set AF_INET. Fix it!
netlink: 1 bytes leftover after parsing attributes in process `syz-executor6'.
kauditd_printk_skb: 9 callbacks suppressed
audit: type=1400 audit(1517183496.141:31): avc:  denied  { name_connect } for  pid=5721 comm="syz-executor4" dest=20019 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=dccp_socket permissive=1
dccp_close: ABORT with 253 bytes unread
sit: non-ECT from 0.0.0.0 with TOS=0x2
sit: non-ECT from 0.0.0.0 with TOS=0x2
audit: type=1400 audit(1517183496.466:32): avc:  denied  { map } for  pid=5831 comm="syz-executor5" path="socket:[15498]" dev="sockfs" ino=15498 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_xfrm_socket permissive=1
TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies.  Check SNMP counters.
audit: type=1400 audit(1517183496.574:33): avc:  denied  { map } for  pid=5860 comm="syz-executor0" path="socket:[15524]" dev="sockfs" ino=15524 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
audit: type=1400 audit(1517183496.728:34): avc:  denied  { read } for  pid=5915 comm="syz-executor4" path="socket:[14651]" dev="sockfs" ino=14651 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
netlink: 'syz-executor4': attribute type 1 has an invalid length.
netlink: 'syz-executor4': attribute type 1 has an invalid length.
audit: type=1400 audit(1517183496.932:35): avc:  denied  { setopt } for  pid=6007 comm="syz-executor3" 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
xt_hashlimit: overflow, try lower: 0/0
xt_hashlimit: overflow, try lower: 0/0
xt_connbytes: Forcing CT accounting to be enabled
ipt_REJECT: TCP_RESET invalid for non-tcp
ipt_REJECT: TCP_RESET invalid for non-tcp
xt_CT: netfilter: NOTRACK target is deprecated, use CT instead or upgrade iptables
audit: type=1400 audit(1517183497.307:36): avc:  denied  { accept } for  pid=6130 comm="syz-executor4" 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_nfacct: accounting object with name `syz1' does not exists
netlink: 2 bytes leftover after parsing attributes in process `syz-executor6'.
netlink: 2 bytes leftover after parsing attributes in process `syz-executor6'.
netlink: 'syz-executor2': attribute type 21 has an invalid length.
netlink: 'syz-executor2': attribute type 21 has an invalid length.
Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable
Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable
netlink: 17 bytes leftover after parsing attributes in process `syz-executor5'.
netlink: 5 bytes leftover after parsing attributes in process `syz-executor2'.
netlink: 5 bytes leftover after parsing attributes in process `syz-executor2'.
netlink: 17 bytes leftover after parsing attributes in process `syz-executor5'.
netlink: 16 bytes leftover after parsing attributes in process `syz-executor1'.
audit: type=1400 audit(1517183498.440:37): avc:  denied  { setopt } for  pid=6534 comm="syz-executor1" 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
syz-executor0 (6517) used greatest stack depth: 15648 bytes left
netlink: 16 bytes leftover after parsing attributes in process `syz-executor1'.
audit: type=1400 audit(1517183498.812:38): avc:  denied  { getattr } for  pid=6663 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 syz6 entered promiscuous mode
netlink: 'syz-executor7': attribute type 21 has an invalid length.
netlink: 'syz-executor7': attribute type 21 has an invalid length.
netlink: 'syz-executor3': attribute type 21 has an invalid length.
netlink: 'syz-executor3': attribute type 21 has an invalid length.
sctp: [Deprecated]: syz-executor1 (pid 6876) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
sctp: [Deprecated]: syz-executor1 (pid 6856) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
audit: type=1400 audit(1517183499.519:39): avc:  denied  { getopt } for  pid=6917 comm="syz-executor4" 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.
TCP: request_sock_TCPv6: Possible SYN flooding on port 20026. Sending cookies.  Check SNMP counters.
netlink: 'syz-executor4': attribute type 1 has an invalid length.
netlink: 'syz-executor4': attribute type 1 has an invalid length.
audit: type=1400 audit(1517183499.825:40): avc:  denied  { ioctl } for  pid=7025 comm="syz-executor0" path="socket:[17470]" dev="sockfs" ino=17470 ioctlcmd=0x89a0 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
sctp: [Deprecated]: syz-executor5 (pid 7104) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
dccp_xmit_packet: Payload too large (65423) for featneg.
dccp_xmit_packet: Payload too large (65423) for featneg.
sctp: [Deprecated]: syz-executor5 (pid 7112) Use of int in maxseg socket option.
Use struct sctp_assoc_value instead
ipt_ECN: cannot use TCP operations on a non-tcp rule
ipt_ECN: cannot use TCP operations on a non-tcp rule
xt_SECMARK: invalid mode: 0
xt_SECMARK: invalid mode: 0
Cannot find add_set index 0 as target
Cannot find add_set index 0 as target
xt_cgroup: invalid path, errno=-2
xt_CT: No such helper "pptp"
xt_CT: No such helper "pptp"
sctp: [Deprecated]: syz-executor5 (pid 7548) Use of struct sctp_assoc_value in delayed_ack socket option.
Use struct sctp_sack_info instead
Unknown options in mask 4
sctp: [Deprecated]: syz-executor5 (pid 7560) Use of struct sctp_assoc_value in delayed_ack socket option.
Use struct sctp_sack_info instead
Unknown options in mask 4
kauditd_printk_skb: 1 callbacks suppressed
audit: type=1400 audit(1517183501.455:42): avc:  denied  { write } for  pid=7656 comm="syz-executor4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=socket permissive=1
audit: type=1400 audit(1517183501.485:43): avc:  denied  { ioctl } for  pid=7656 comm="syz-executor4" path="socket:[17029]" dev="sockfs" ino=17029 ioctlcmd=0x5411 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=sock_file permissive=1
device syz7 entered promiscuous mode
dccp_close: ABORT with 254 bytes unread
syz-executor2 (7755) used greatest stack depth: 14976 bytes left
nla_parse: 4 callbacks suppressed
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
ipt_REJECT: TCP_RESET invalid for non-tcp
netlink: 8 bytes leftover after parsing attributes in process `syz-executor0'.
xt_policy: too many policy elements
xt_policy: too many policy elements
ipt_REJECT: TCP_RESET invalid for non-tcp
openvswitch: netlink: Message has 4 unknown bytes.
openvswitch: netlink: Message has 4 unknown bytes.
Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable
Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable
device syz4 entered promiscuous mode
device syz4 left promiscuous mode
validate_nla: 5 callbacks suppressed
netlink: 'syz-executor4': attribute type 1 has an invalid length.
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=1 sclass=netlink_route_socket pig=8278 comm=syz-executor0
netlink: 'syz-executor4': attribute type 1 has an invalid length.
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=1 sclass=netlink_route_socket pig=8289 comm=syz-executor0
audit: type=1400 audit(1517183503.231:44): avc:  denied  { read } for  pid=8310 comm="syz-executor3" 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
DRBG: could not allocate CTR cipher TFM handle: ctr(aes)
dccp_xmit_packet: Payload too large (65423) for featneg.
dccp_xmit_packet: Payload too large (65423) for featneg.
audit: type=1400 audit(1517183504.126:45): avc:  denied  { getattr } for  pid=8599 comm="syz-executor1" 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

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/28 23:51 net-next-old 751c45bd828f 08d47756 .config console log report ci-upstream-net-kasan-gce
2018/01/28 07:08 net-next-old 6bb46bc57c8e 08146b1a .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.