Eric Dumazet
250cd610f8
ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
...
commit 195374d893681da43a39796e53b30ac4f20400c4 upstream.
syzbot reported a data-race while accessing nh->nh_saddr_genid [1]
Add annotations, but leave the code lazy as intended.
[1]
BUG: KCSAN: data-race in fib_select_path / fib_select_path
write to 0xffff8881387166f0 of 4 bytes by task 6778 on cpu 1:
fib_info_update_nhc_saddr net/ipv4/fib_semantics.c:1334 [inline]
fib_result_prefsrc net/ipv4/fib_semantics.c:1354 [inline]
fib_select_path+0x292/0x330 net/ipv4/fib_semantics.c:2269
ip_route_output_key_hash_rcu+0x659/0x12c0 net/ipv4/route.c:2810
ip_route_output_key_hash net/ipv4/route.c:2644 [inline]
__ip_route_output_key include/net/route.h:134 [inline]
ip_route_output_flow+0xa6/0x150 net/ipv4/route.c:2872
send4+0x1f5/0x520 drivers/net/wireguard/socket.c:61
wg_socket_send_skb_to_peer+0x94/0x130 drivers/net/wireguard/socket.c:175
wg_socket_send_buffer_to_peer+0xd6/0x100 drivers/net/wireguard/socket.c:200
wg_packet_send_handshake_initiation drivers/net/wireguard/send.c:40 [inline]
wg_packet_handshake_send_worker+0x10c/0x150 drivers/net/wireguard/send.c:51
process_one_work kernel/workqueue.c:2630 [inline]
process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2703
worker_thread+0x525/0x730 kernel/workqueue.c:2784
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:304
read to 0xffff8881387166f0 of 4 bytes by task 6759 on cpu 0:
fib_result_prefsrc net/ipv4/fib_semantics.c:1350 [inline]
fib_select_path+0x1cb/0x330 net/ipv4/fib_semantics.c:2269
ip_route_output_key_hash_rcu+0x659/0x12c0 net/ipv4/route.c:2810
ip_route_output_key_hash net/ipv4/route.c:2644 [inline]
__ip_route_output_key include/net/route.h:134 [inline]
ip_route_output_flow+0xa6/0x150 net/ipv4/route.c:2872
send4+0x1f5/0x520 drivers/net/wireguard/socket.c:61
wg_socket_send_skb_to_peer+0x94/0x130 drivers/net/wireguard/socket.c:175
wg_socket_send_buffer_to_peer+0xd6/0x100 drivers/net/wireguard/socket.c:200
wg_packet_send_handshake_initiation drivers/net/wireguard/send.c:40 [inline]
wg_packet_handshake_send_worker+0x10c/0x150 drivers/net/wireguard/send.c:51
process_one_work kernel/workqueue.c:2630 [inline]
process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2703
worker_thread+0x525/0x730 kernel/workqueue.c:2784
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:304
value changed: 0x959d3217 -> 0x959d3218
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 6759 Comm: kworker/u4:15 Not tainted 6.6.0-rc4-syzkaller-00029-gcbf3a2cb156a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Workqueue: wg-kex-wg1 wg_packet_handshake_send_worker
Fixes: 436c3b66ec98 ("ipv4: Invalidate nexthop cache nh_saddr more correctly.")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20231017192304.82626-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 11:54:20 +02:00
..
2020-08-10 12:06:44 -07:00
2023-10-10 21:53:29 +02:00
2023-06-09 10:30:05 +02:00
2021-04-14 08:42:05 +02:00
2022-04-13 21:00:57 +02:00
2020-09-25 13:58:01 -07:00
2022-07-21 21:20:08 +02:00
2022-10-30 09:41:19 +01:00
2023-09-19 12:20:29 +02:00
2023-06-28 10:28:11 +02:00
2023-10-25 11:54:19 +02:00
2023-03-22 13:30:00 +01:00
2021-12-08 09:03:26 +01:00
2023-10-25 11:54:20 +02:00
2023-09-19 12:20:26 +02:00
2020-10-02 19:11:11 -07:00
2021-01-12 20:18:12 +01:00
2020-08-03 15:29:44 -07:00
2023-04-20 12:10:21 +02:00
2023-09-19 12:20:20 +02:00
2023-07-27 08:44:42 +02:00
2021-12-22 09:30:53 +01:00
2022-01-27 10:54:33 +01:00
2023-07-27 08:44:40 +02:00
2023-07-27 08:44:40 +02:00
2022-07-21 21:20:07 +02:00
2022-07-29 17:19:12 +02:00
2022-01-27 10:54:33 +01:00
2023-04-05 11:23:35 +02:00
2023-09-19 12:20:26 +02:00
2020-08-25 06:28:02 -07:00
2023-09-19 12:20:09 +02:00
2023-06-05 09:07:04 +02:00
2023-08-16 18:21:01 +02:00
2023-03-22 13:29:58 +01:00
2023-08-26 15:26:52 +02:00
2020-07-09 12:55:37 +02:00
2021-06-18 10:00:05 +02:00
2020-06-30 12:29:39 -07:00
2022-02-16 12:54:25 +01:00
2022-12-02 17:40:05 +01:00
2020-07-10 13:54:00 -07:00
2023-02-01 08:23:24 +01:00
2020-10-30 12:57:39 +01:00
2022-11-03 23:57:54 +09:00
2022-06-09 10:21:09 +02:00
2021-11-18 14:04:08 +01:00
2023-06-05 09:07:04 +02:00
2023-10-10 21:53:27 +02:00
2023-01-14 10:16:51 +01:00
2023-07-27 08:44:42 +02:00
2021-08-18 08:59:13 +02:00
2023-05-30 12:57:46 +01:00
2022-11-25 17:45:55 +01:00
2021-05-14 09:50:46 +02:00
2021-12-01 09:19:06 +01:00
2023-07-27 08:44:43 +02:00
2020-07-06 13:23:03 -07:00
2020-07-06 13:23:03 -07:00
2023-10-10 21:53:39 +02:00
2023-10-25 11:54:19 +02:00
2023-08-11 11:57:51 +02:00
2023-07-27 08:44:40 +02:00
2021-08-12 13:22:05 +02:00
2023-10-25 11:54:20 +02:00
2022-05-09 09:05:03 +02:00
2023-10-25 11:54:20 +02:00
2020-08-24 17:31:20 -07:00
2023-09-19 12:20:08 +02:00
2023-01-24 07:20:01 +01:00
2020-10-13 17:11:52 -07:00
2020-07-06 13:23:03 -07:00
2023-07-27 08:44:43 +02:00
2020-07-09 12:51:36 +02:00
2021-07-28 14:35:37 +02:00
2020-07-24 15:41:54 -07:00
2021-08-12 13:22:05 +02:00
2023-01-14 10:15:43 +01:00
2022-03-02 11:42:51 +01:00
2020-07-10 13:54:00 -07:00
2023-09-19 12:20:08 +02:00
2023-05-30 12:57:57 +01:00
2023-06-28 10:28:10 +02:00
2022-06-14 18:32:40 +02:00
2020-10-09 12:29:48 +02:00