mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] udp: Fix bind conflict check bypasses
@ 2026-11-30  5:07 Juan Agustin Niccolini
  2026-11-30  5:07 ` [PATCH net v2 1/3] udp: Keep the bound device on disconnect unless connect() set it Juan Agustin Niccolini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Juan Agustin Niccolini @ 2026-11-30  5:07 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni
  Cc: horms, kuniyu, willemb, willemdebruijn.kernel, dsahern, idosch,
	shuah, tpluszz77, brauner, alice.kernel, kylebot, joe, leitao,
	xudu, netdev, linux-kselftest, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-30  5:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30  5:07 [PATCH net v2 0/3] udp: Fix bind conflict check bypasses Juan Agustin Niccolini
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®