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/2026…@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