Re: [PATCH net 1/2] udp: fix reuseport rescore fallback

From
Alexei Starovoitov <hidden>
Date
2026-11-16 04:51:51
Also in
bpf, linux-kselftest
Reply to
Zihan Xi, 2026-11-16
On Sun, Nov 15, 2026 at 07:55 PM Zihan Xi [off-list ref] wrote:
When a reuseport group contains connected sockets, UDP lookup rescored the
socket selected by the reuseport program. If that socket did not match the
packet, lookup retained the stale selection while continuing the scan. This
could deliver a packet to a socket connected to a different peer.
Not since 6.13, unless CONFIG_BASE_SMALL=y.
Link: https://bugtracker.nebusec.ai/f/net/ipv6/udp.c||udp6_lib_lookup2||socket-hijack||m7q
That's not a hijack.
udp_reuseport_add_sock() lets only sockets of one uid into a group.
A member of the group attaches the prog.
The prog picks a wrong socket of its own user.
quoted hunk ↗ jump to hunk
+		if (need_rescore) {
+			if (score > badness)
+				badness = score;
+			else
+				result = sk;
+			continue;
+		}
This makes it worse.
The unconnected sockets of a group have the same score.
So the score of the picked socket is equal to badness, and the patch
replaces the picked socket with sk.

Sockets A, B, C are not connected. A is the first one in hslot2.
has_conns is set:

  reuseport picks   today   with the patch
  ---------------   -----   --------------
  A                 A       A
  B                 B       A
  C                 C       A

Nack.
Thread (5 messages) 5 messages, 2 authors, last reply 2d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help