syzbot


KCSAN: data-race in tcp_add_backlog / tcp_try_rmem_schedule

Status: fixed on 2020/06/30 18:57
Subsystems: net
[Documentation on labels]
Fix commit: ebb3b78db7bf tcp: annotate sk->sk_rcvbuf lockless reads
First crash: 1690d, last: 1686d

Sample crash report:
==================================================================
BUG: KCSAN: data-race in tcp_add_backlog / tcp_try_rmem_schedule

read to 0xffff88812643a14c of 4 bytes by interrupt on cpu 1:
 tcp_add_backlog+0x43/0xcc0 net/ipv4/tcp_ipv4.c:1628
 tcp_v4_rcv+0x1aba/0x1bf0 net/ipv4/tcp_ipv4.c:1925
 ip_protocol_deliver_rcu+0x51/0x470 net/ipv4/ip_input.c:204
 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231
 NF_HOOK include/linux/netfilter.h:305 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252
 dst_input include/net/dst.h:442 [inline]
 ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413
 NF_HOOK include/linux/netfilter.h:305 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523
 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5004
 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5118
 netif_receive_skb_internal+0x59/0x190 net/core/dev.c:5208
 napi_skb_finish net/core/dev.c:5671 [inline]
 napi_gro_receive+0x28f/0x330 net/core/dev.c:5704
 receive_buf+0x284/0x30b0 drivers/net/virtio_net.c:1061
 virtnet_receive drivers/net/virtio_net.c:1323 [inline]
 virtnet_poll+0x436/0x7d0 drivers/net/virtio_net.c:1428
 napi_poll net/core/dev.c:6352 [inline]
 net_rx_action+0x3ae/0xa50 net/core/dev.c:6418

write to 0xffff88812643a14c of 4 bytes by task 7268 on cpu 0:
 tcp_clamp_window net/ipv4/tcp_input.c:486 [inline]
 tcp_prune_queue net/ipv4/tcp_input.c:5074 [inline]
 tcp_try_rmem_schedule+0x294/0xb90 net/ipv4/tcp_input.c:4484
 tcp_data_queue+0x7ba/0x2000 net/ipv4/tcp_input.c:4740
 tcp_rcv_established+0x517/0xf50 net/ipv4/tcp_input.c:5661
 tcp_v4_do_rcv+0x381/0x4e0 net/ipv4/tcp_ipv4.c:1542
 sk_backlog_rcv include/net/sock.h:945 [inline]
 __release_sock+0x135/0x1e0 net/core/sock.c:2427
 release_sock+0x61/0x160 net/core/sock.c:2943
 tcp_recvmsg+0x63b/0x1a30 net/ipv4/tcp.c:2181
 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838
 sock_recvmsg_nosec net/socket.c:871 [inline]
 sock_recvmsg net/socket.c:889 [inline]
 sock_recvmsg+0x92/0xb0 net/socket.c:885
 sock_read_iter+0x15f/0x1e0 net/socket.c:967
 call_read_iter include/linux/fs.h:1864 [inline]
 new_sync_read+0x389/0x4f0 fs/read_write.c:414
 __vfs_read+0xb1/0xc0 fs/read_write.c:427
 vfs_read fs/read_write.c:461 [inline]
 vfs_read+0x143/0x2c0 fs/read_write.c:446

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 7268 Comm: syz-fuzzer Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/12 16:07 https://github.com/google/ktsan.git kcsan d724f94f63de 426631dd .config console log report ci2-upstream-kcsan-gce
2019/10/10 13:27 https://github.com/google/ktsan.git kcsan d724f94f63de d52eff28 .config console log report ci2-upstream-kcsan-gce
2019/10/08 03:15 https://github.com/google/ktsan.git kcsan c1c7521f03c7 28ac6e64 .config console log report ci2-upstream-kcsan-gce
* Struck through repros no longer work on HEAD.