Jason A. Donenfeld
381a7d453f
wireguard: send: annotate intentional data race in checking empty queue
KCSAN reports a race in wg_packet_send_keepalive, which is intentional:
BUG: KCSAN: data-race in wg_packet_send_keepalive / wg_packet_send_staged_packets
write to 0xffff88814cd91280 of 8 bytes by task 3194 on cpu 0:
__skb_queue_head_init include/linux/skbuff.h:2162 [inline]
skb_queue_splice_init include/linux/skbuff.h:2248 [inline]
wg_packet_send_staged_packets+0xe5/0xad0 drivers/net/wireguard/send.c:351
wg_xmit+0x5b8/0x660 drivers/net/wireguard/device.c:218
__netdev_start_xmit include/linux/netdevice.h:4940 [inline]
netdev_start_xmit include/linux/netdevice.h:4954 [inline]
xmit_one net/core/dev.c:3548 [inline]
dev_hard_start_xmit+0x11b/0x3f0 net/core/dev.c:3564
__dev_queue_xmit+0xeff/0x1d80 net/core/dev.c:4349
dev_queue_xmit include/linux/netdevice.h:3134 [inline]
neigh_connected_output+0x231/0x2a0 net/core/neighbour.c:1592
neigh_output include/net/neighbour.h:542 [inline]
ip6_finish_output2+0xa66/0xce0 net/ipv6/ip6_output.c:137
ip6_finish_output+0x1a5/0x490 net/ipv6/ip6_output.c:222
NF_HOOK_COND include/linux/netfilter.h:303 [inline]
ip6_output+0xeb/0x220 net/ipv6/ip6_output.c:243
dst_output include/net/dst.h:451 [inline]
NF_HOOK include/linux/netfilter.h:314 [inline]
ndisc_send_skb+0x4a2/0x670 net/ipv6/ndisc.c:509
ndisc_send_rs+0x3ab/0x3e0 net/ipv6/ndisc.c:719
addrconf_dad_completed+0x640/0x8e0 net/ipv6/addrconf.c:4295
addrconf_dad_work+0x891/0xbc0
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x5b8/0xa30 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
read to 0xffff88814cd91280 of 8 bytes by task 3202 on cpu 1:
skb_queue_empty include/linux/skbuff.h:1798 [inline]
wg_packet_send_keepalive+0x20/0x100 drivers/net/wireguard/send.c:225
wg_receive_handshake_packet drivers/net/wireguard/receive.c:186 [inline]
wg_packet_handshake_receive_worker+0x445/0x5e0 drivers/net/wireguard/receive.c:213
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x5b8/0xa30 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: 0xffff888148fef200 -> 0xffff88814cd91280
Mark this race as intentional by using the skb_queue_empty_lockless()
function rather than skb_queue_empty(), which uses READ_ONCE()
internally to annotate the race.
Cc: stable@vger.kernel.org
Fixes: e7096c131e ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://patch.msgid.link/20240704154517.1572127-5-Jason@zx2c4.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-07-05 17:21:10 -07:00
..
2024-05-19 09:21:03 -07:00
2024-05-24 08:43:25 -07:00
2024-06-21 12:55:12 +02:00
2024-05-04 18:59:47 +02:00
2024-06-30 22:23:39 +02:00
2024-05-06 18:26:47 -07:00
2024-05-22 10:45:12 -07:00
2024-06-04 18:14:51 +02:00
2024-06-14 06:21:25 -06:00
2024-06-28 14:30:37 -04:00
2024-05-22 20:14:47 -04:00
2024-05-15 12:59:55 -06:00
2024-06-05 04:55:04 +03:00
2024-06-12 16:58:05 -07:00
2024-05-22 09:56:00 -07:00
2024-06-22 13:48:11 +09:00
2024-06-24 20:55:11 +02:00
2024-05-16 08:50:32 -07:00
2024-06-27 17:43:15 -07:00
2024-06-25 14:45:27 -07:00
2024-05-19 09:21:03 -07:00
2024-05-09 00:30:37 +09:00
2024-06-11 23:39:26 +05:30
2024-05-28 22:21:34 +02:00
2024-05-13 16:53:53 -07:00
2024-06-04 11:29:52 +02:00
2024-05-03 22:09:50 +02:00
2024-05-09 01:03:39 +09:00
2024-06-15 14:59:26 +09:00
2024-06-22 07:58:21 -07:00
2024-05-22 12:26:46 -07:00
2024-06-27 17:21:28 +02:00
2024-06-28 08:56:26 +10:00
2024-05-04 18:59:41 +02:00
2024-06-08 10:48:11 -07:00
2024-06-06 06:03:29 +00:00
2024-05-30 09:05:19 -07:00
2024-05-22 12:26:46 -07:00
2024-06-28 20:44:38 +02:00
2024-05-23 00:29:19 +02:00
2024-06-09 12:02:34 +01:00
2024-06-21 10:19:36 -03:00
2024-06-24 14:36:11 -04:00
2024-05-22 20:14:47 -04:00
2024-06-27 12:14:19 +02:00
2024-06-23 17:09:26 +02:00
2024-06-16 09:33:28 -07:00
2024-05-17 09:05:46 -07:00
2024-05-31 12:39:15 -05:00
2024-04-29 10:53:31 +02:00
2024-05-28 06:55:59 -06:00
2024-07-03 10:10:45 -07:00
2024-05-17 08:53:47 -07:00
2024-04-25 11:58:52 +02:00
2024-05-14 18:25:53 -07:00
2024-06-14 08:43:39 +01:00
2024-06-04 18:08:39 +02:00
2024-06-20 16:42:30 +02:00
2024-05-27 13:42:25 +02:00
2024-04-29 08:20:07 -07:00
2024-07-05 17:21:10 -07:00
2024-05-29 13:08:31 +01:00
2024-04-25 12:53:30 -05:00
2024-05-23 12:04:36 -07:00
2024-06-26 10:13:04 -07:00
2024-05-03 07:26:39 +02:00
2024-05-30 19:43:47 -05:00
2024-05-17 13:01:24 +02:00
2024-04-25 20:55:53 -07:00
2024-06-04 18:08:31 +02:00
2024-06-24 23:33:38 +02:00
2024-05-23 12:09:22 -07:00
2024-06-03 19:30:47 +05:30
2024-06-17 10:36:56 +02:00
2024-07-02 16:01:45 +02:00
2024-05-27 08:18:31 -07:00
2024-05-28 21:53:51 +02:00
2024-05-20 08:55:18 -07:00
2024-04-30 21:10:37 +02:00
2024-04-29 08:20:06 -07:00
2024-06-18 13:26:44 -07:00
2024-06-22 16:13:19 +02:00
2024-05-14 23:36:19 +09:00
2024-06-16 11:22:57 +02:00
2024-06-12 21:30:43 +01:00
2024-05-06 13:34:12 -06:00
2024-06-21 13:49:25 +02:00
2024-05-23 12:04:36 -07:00
2024-05-07 23:40:46 +02:00
2024-07-03 16:27:06 +02:00
2024-07-01 22:57:03 -07:00
2024-05-08 19:21:51 +01:00
2024-06-27 16:33:39 +02:00
2024-06-03 17:35:24 +05:30
2024-06-19 14:07:13 +01:00
2024-05-08 19:46:11 +01:00
2024-06-27 15:47:30 +02:00
2024-05-21 13:11:44 -07:00
2024-06-27 17:10:38 +02:00
2024-06-25 14:37:05 +02:00
2024-05-31 13:13:39 +03:00
2024-06-30 08:57:43 -07:00
2024-06-13 21:00:25 -04:00
2024-06-30 08:54:24 -07:00
2024-05-22 08:32:48 -04:00
2024-06-12 15:40:39 -06:00
2024-05-23 12:04:36 -07:00
2024-05-22 10:45:12 -07:00
2024-05-19 09:21:03 -07:00
2024-05-23 12:04:36 -07:00
2024-06-15 12:49:57 +02:00
2024-05-24 10:24:49 -07:00
2024-04-29 16:45:53 +02:00
2024-05-10 04:34:52 +09:00