[PATCH net 0/4] udp: Fix bind conflict check bypasses
From: Juan Agustin Niccolini
Date: Fri Nov 20 2026 - 12:44:29 EST
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 three bugs that
allow that 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"). The one in patch 1 has the same kind of cause: a
SO_REUSEPORT shortcut that lets one matching socket stand for every
socket on the port. The other two predate git. All were discovered
during an LLM-based audit.
Juan Agustin Niccolini (4):
udp: Fix bind conflict check stopping at the first reuseport socket
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/sock.h | 4 +
net/core/sock.c | 3 +
net/ipv4/udp.c | 69 +++++-
net/ipv6/datagram.c | 25 +-
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 1 +
.../testing/selftests/net/udp_bind_conflict.c | 228 ++++++++++++++++++
7 files changed, 317 insertions(+), 14 deletions(-)
base-commit: 19a227903e65c7a9c179156485660a4e017575fe
--
2.43.0