syzbot


KCSAN: data-race in wg_packet_receive / wg_packet_receive (7)

Status: auto-obsoleted due to no activity on 2024/03/16 22:23
Subsystems: wireguard
[Documentation on labels]
Reported-by: syzbot+fd07f3da9110f5f18b4f@syzkaller.appspotmail.com
First crash: 77d, last: 77d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly wireguard report (Feb 2024) 0 (1) 2024/02/21 10:58
[syzbot] [wireguard?] KCSAN: data-race in wg_packet_receive / wg_packet_receive (7) 0 (1) 2024/02/12 21:26
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (8) wireguard 1 35d 35d 0/26 auto-obsoleted due to no activity on 2024/04/28 08:23
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (5) wireguard 1 526d 526d 0/26 auto-obsoleted due to no activity on 2023/01/02 14:24
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive wireguard 2 879d 896d 0/26 auto-closed as invalid on 2022/01/05 08:53
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (4) wireguard 2 598d 600d 0/26 auto-obsoleted due to no activity on 2022/10/12 22:27
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (3) wireguard 2 692d 696d 0/26 auto-closed as invalid on 2022/07/11 09:31
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (6) wireguard 2 433d 471d 0/26 auto-obsoleted due to no activity on 2023/04/07 02:56
upstream KCSAN: data-race in wg_packet_receive / wg_packet_receive (2) wireguard 1 748d 748d 0/26 auto-closed as invalid on 2022/05/15 18:55

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

read to 0xffff88812bad5c08 of 4 bytes by interrupt on cpu 0:
 wg_cpumask_next_online drivers/net/wireguard/queueing.h:127 [inline]
 wg_queue_enqueue_per_device_and_peer drivers/net/wireguard/queueing.h:173 [inline]
 wg_packet_consume_data drivers/net/wireguard/receive.c:526 [inline]
 wg_packet_receive+0xc51/0x12c0 drivers/net/wireguard/receive.c:576
 wg_receive+0x4e/0x70 drivers/net/wireguard/socket.c:326
 udp_queue_rcv_one_skb+0xad0/0xb60 net/ipv4/udp.c:2113
 udp_queue_rcv_skb+0x20a/0x220 net/ipv4/udp.c:2191
 udp_unicast_rcv_skb+0x1c2/0x1f0 net/ipv4/udp.c:2351
 __udp4_lib_rcv+0xb93/0x1110 net/ipv4/udp.c:2427
 udp_rcv+0x4f/0x60 net/ipv4/udp.c:2609
 ip_protocol_deliver_rcu+0x356/0x6d0 net/ipv4/ip_input.c:205
 ip_local_deliver_finish+0x13c/0x1b0 net/ipv4/ip_input.c:233
 NF_HOOK include/linux/netfilter.h:314 [inline]
 ip_local_deliver+0xec/0x1c0 net/ipv4/ip_input.c:254
 dst_input include/net/dst.h:461 [inline]
 ip_rcv_finish net/ipv4/ip_input.c:449 [inline]
 NF_HOOK include/linux/netfilter.h:314 [inline]
 ip_rcv+0x18a/0x260 net/ipv4/ip_input.c:569
 __netif_receive_skb_one_core net/core/dev.c:5534 [inline]
 __netif_receive_skb+0x90/0x1b0 net/core/dev.c:5648
 process_backlog+0x21f/0x380 net/core/dev.c:5976
 __napi_poll+0x60/0x3c0 net/core/dev.c:6576
 napi_poll net/core/dev.c:6645 [inline]
 net_rx_action+0x32b/0x750 net/core/dev.c:6778
 __do_softirq+0xc4/0x27b kernel/softirq.c:553
 do_softirq+0x5e/0x90 kernel/softirq.c:454
 __local_bh_enable_ip+0x66/0x70 kernel/softirq.c:381
 __raw_read_unlock_bh include/linux/rwlock_api_smp.h:257 [inline]
 _raw_read_unlock_bh+0x1b/0x20 kernel/locking/spinlock.c:284
 wg_socket_send_skb_to_peer+0x109/0x130 drivers/net/wireguard/socket.c:184
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x127/0x360 drivers/net/wireguard/send.c:276
 process_one_work kernel/workqueue.c:2633 [inline]
 process_scheduled_works+0x5b8/0xa40 kernel/workqueue.c:2706
 worker_thread+0x525/0x730 kernel/workqueue.c:2787
 kthread+0x1d7/0x210 kernel/kthread.c:388
 ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

write to 0xffff88812bad5c08 of 4 bytes by interrupt on cpu 1:
 wg_cpumask_next_online drivers/net/wireguard/queueing.h:130 [inline]
 wg_queue_enqueue_per_device_and_peer drivers/net/wireguard/queueing.h:173 [inline]
 wg_packet_consume_data drivers/net/wireguard/receive.c:526 [inline]
 wg_packet_receive+0xd3a/0x12c0 drivers/net/wireguard/receive.c:576
 wg_receive+0x4e/0x70 drivers/net/wireguard/socket.c:326
 udpv6_queue_rcv_one_skb+0xb37/0xbc0 net/ipv6/udp.c:716
 udpv6_queue_rcv_skb+0x20f/0x230 net/ipv6/udp.c:778
 udp6_unicast_rcv_skb+0x195/0x1b0 net/ipv6/udp.c:921
 __udp6_lib_rcv+0xa24/0xc80 net/ipv6/udp.c:1010
 udpv6_rcv+0x4f/0x60 net/ipv6/udp.c:1124
 ip6_protocol_deliver_rcu+0x92f/0xf30 net/ipv6/ip6_input.c:438
 ip6_input_finish net/ipv6/ip6_input.c:483 [inline]
 NF_HOOK include/linux/netfilter.h:314 [inline]
 ip6_input+0xbd/0x1b0 net/ipv6/ip6_input.c:492
 dst_input include/net/dst.h:461 [inline]
 ip6_rcv_finish+0x1d9/0x2d0 net/ipv6/ip6_input.c:79
 NF_HOOK include/linux/netfilter.h:314 [inline]
 ipv6_rcv+0x74/0x150 net/ipv6/ip6_input.c:310
 __netif_receive_skb_one_core net/core/dev.c:5534 [inline]
 __netif_receive_skb+0x90/0x1b0 net/core/dev.c:5648
 process_backlog+0x21f/0x380 net/core/dev.c:5976
 __napi_poll+0x60/0x3c0 net/core/dev.c:6576
 napi_poll net/core/dev.c:6645 [inline]
 net_rx_action+0x32b/0x750 net/core/dev.c:6778
 __do_softirq+0xc4/0x27b kernel/softirq.c:553
 do_softirq+0x5e/0x90 kernel/softirq.c:454
 __local_bh_enable_ip+0x66/0x70 kernel/softirq.c:381
 __raw_read_unlock_bh include/linux/rwlock_api_smp.h:257 [inline]
 _raw_read_unlock_bh+0x1b/0x20 kernel/locking/spinlock.c:284
 wg_socket_send_skb_to_peer+0x109/0x130 drivers/net/wireguard/socket.c:184
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x127/0x360 drivers/net/wireguard/send.c:276
 process_one_work kernel/workqueue.c:2633 [inline]
 process_scheduled_works+0x5b8/0xa40 kernel/workqueue.c:2706
 worker_thread+0x525/0x730 kernel/workqueue.c:2787
 kthread+0x1d7/0x210 kernel/kthread.c:388
 ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

value changed: 0x00000000 -> 0x00000001

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 5475 Comm: kworker/1:6 Not tainted 6.8.0-rc3-syzkaller-00293-ga5b6244cf87c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/02/10 22:22 upstream a5b6244cf87c 77b23aa1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in wg_packet_receive / wg_packet_receive
* Struck through repros no longer work on HEAD.