Netdev List
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: Nikolay Aleksandrov <razor@blackwall.org>, bpf@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Martin KaFai Lau <kafai@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH bpf 1/2] bpf, net: validate assigned socket on receive
Date: Mon, 23 Nov 2026 17:41:07 +0800	[thread overview]
Message-ID: <3c96d878-0326-43c2-9869-e941cae675f4@linux.dev> (raw)
In-Reply-To: <20261123084138.723275-2-razor@blackwall.org>



On 11/23/26 4:41 PM, Nikolay Aleksandrov wrote:
> bpf_sk_assign accepts any hashed socket and the rx path uses it without
> checking against the packet which can also be rewritten after the
> assignment. A TCP socket can then reach UDP receive, AF_INET socket
> IPv6 receive, a v6only AF_INET6 socket IPv4 receive etc. A queued skb can
> also be delivered in another netns than the one checked at assignment, e.g.
> after an rx_handler forwards it to an upper device there.
>
> Check the socket where it is consumed: inet_steal_sock and
> inet6_steal_sock take the protocol of the caller and drop a prefetched
> socket on a mismatch. Like bpf_sk_lookup_assign, IPv4 also rejects v6only
> sockets which tcp_v6_conn_request would otherwise accept through
> tcp_v4_conn_request. A syncookie request socket left on the skb is released
> as well.


Some old discussion is here:
https://lore.kernel.org/netdev/20260403015851.148209-1-jiayuan.chen@linux.dev/
https://lore.kernel.org/netdev/20260608125846.157004-1-jiayuan.chen@linux.dev/

But the situation will change as time goes on. Hope the issue can be fixed.


  parent reply	other threads:[~2026-11-23  9:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  8:41 [PATCH bpf 0/2] bpf, net: fix assigned socket mismatches Nikolay Aleksandrov
2026-11-23  8:41 ` [PATCH bpf 1/2] bpf, net: validate assigned socket on receive Nikolay Aleksandrov
2026-11-23  9:38   ` bot+bpf-ci
2026-11-23  9:41   ` Jiayuan Chen [this message]
2026-11-23  9:46     ` Nikolay Aleksandrov
2026-11-23  8:41 ` [PATCH bpf 2/2] selftests/bpf: test assigning a TCP listener to a UDP datagram Nikolay Aleksandrov
2026-11-23  9:40 ` [PATCH bpf 0/2] bpf, net: fix assigned socket mismatches Nikolay Aleksandrov

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=3c96d878-0326-43c2-9869-e941cae675f4@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=willemdebruijn.kernel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox