All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH net] ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
Date: Wed, 18 Oct 2023 15:49:00 +0200	[thread overview]
Message-ID: <20231018134900.GO1940501@kernel.org> (raw)
In-Reply-To: <20231017192304.82626-1-edumazet@google.com>

On Tue, Oct 17, 2023 at 07:23:04PM +0000, Eric Dumazet wrote:
> 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>


  reply	other threads:[~2023-10-18 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 19:23 [PATCH net] ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr Eric Dumazet
2023-10-18 13:49 ` Simon Horman [this message]
2023-10-18 14:41 ` David Ahern
2023-10-19  1:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231018134900.GO1940501@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.