From: Juan Agustin Niccolini <juanagusnicco@gmail.com>
To: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com
Cc: horms@kernel.org, kuniyu@google.com, willemb@google.com,
willemdebruijn.kernel@gmail.com, dsahern@kernel.org,
idosch@nvidia.com, shuah@kernel.org, tpluszz77@gmail.com,
brauner@kernel.org, alice.kernel@fastmail.im, kylebot@openai.com,
joe@dama.to, leitao@debian.org, xudu@redhat.com,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net v2 0/3] udp: Fix bind conflict check bypasses
Date: Mon, 30 Nov 2026 00:07:26 -0500 [thread overview]
Message-ID: <20261130050729.893-1-juanagusnicco@gmail.com> (raw)
An unprivileged user can get a UDP socket bound to an address and port
that another user's socket holds, in a state bind() would have refused,
and receive that socket's datagrams. This series fixes two bugs that
allow that, both through the bound device, and adds a selftest.
These are sibling vulnerabilities of the TCP one fixed by my
commit f675070191f2 ("tcp: Fix the SO_REUSEPORT bind cache admitting a
conflicting socket"). Both predate git. They were discovered during an
LLM-based audit.
v2:
- Drop v1 patch 1, which commit d77700039d09 ("udp: only quit inuse
scan early on identical SO_REUSEPORT sockets") fixed, and rebase on
it (Willem).
- Patch 1: take the socket lock on IPv6 ping, raw and L2TP disconnect,
which now writes sk_userlocks (Willem).
- Patch 1: move the VRF behaviour change from the notes into the
commit message (Willem).
- Patch 2: read the device of the socket being bound directly and load
the other socket's device once (Willem).
- Patch 3: keep the SO_REUSEPORT tests and update the commit message
(Willem).
- v1: https://lore.kernel.org/netdev/20261120174341.35873-1-juanagusnicco@gmail.com/
Juan Agustin Niccolini (3):
udp: Keep the bound device on disconnect unless connect() set it
udp: Ignore a connect()-set device in the bind conflict check
selftests: net: Add UDP bind conflict tests
include/net/ipv6.h | 1 +
include/net/sock.h | 4 +
net/core/sock.c | 3 +
net/ipv4/udp.c | 55 ++++-
net/ipv6/datagram.c | 35 ++-
net/ipv6/ping.c | 2 +-
net/ipv6/raw.c | 2 +-
net/l2tp/l2tp_ip6.c | 2 +-
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 1 +
.../testing/selftests/net/udp_bind_conflict.c | 228 ++++++++++++++++++
11 files changed, 317 insertions(+), 17 deletions(-)
create mode 100644 tools/testing/selftests/net/udp_bind_conflict.c
base-commit: fad0d57b12f6979bc0127f0a4f704c6d7177ca78
--
2.43.0
next reply other threads:[~2026-11-30 5:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 5:07 Juan Agustin Niccolini [this message]
2026-11-30 5:07 ` [PATCH net v2 1/3] udp: Keep the bound device on disconnect unless connect() set it Juan Agustin Niccolini
2026-11-30 5:07 ` [PATCH net v2 2/3] udp: Ignore a connect()-set device in the bind conflict check Juan Agustin Niccolini
2026-11-30 5:07 ` [PATCH net v2 3/3] selftests: net: Add UDP bind conflict tests Juan Agustin Niccolini
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=20261130050729.893-1-juanagusnicco@gmail.com \
--to=juanagusnicco@gmail.com \
--cc=alice.kernel@fastmail.im \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=joe@dama.to \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=kylebot@openai.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=tpluszz77@gmail.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xudu@redhat.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