diff options
| author | Ricardo B. Marlière (SUSE) <ricardo@marliere.net> | 2026-09-01 08:31:58 -0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-09-04 18:38:28 -0700 |
| commit | b910d4220d42ed8e67b79adec6349fc7020e118d (patch) | |
| tree | d44704f62653d07e0b4a4e7f7a14744a78653abe /scripts/Makefile.thinlto | |
| parent | 5cce5d29273c817ba18b866671031ec3aa7564c6 (diff) | |
| download | linux-next-b910d4220d42ed8e67b79adec6349fc7020e118d.tar.gz linux-next-b910d4220d42ed8e67b79adec6349fc7020e118d.zip | |
selftests/net: Fix flaky bind_wildcard due to ephemeral port race
bind_wildcard picks an ephemeral port by binding fd[0] with port 0, reads
it back with getsockname(), and then reuses that exact port number for the
other addresses/families in fd[1..7]. This all happens in the default
network namespace, so unrelated processes on the same host are drawing from
the very same ephemeral port range (net.ipv4.ip_local_port_range) at the
same time.
Such a process can independently get assigned that exact port number on a
different, non-conflicting address in the short window between fd[0]'s
bind() and fd[1]'s, making fd[1]'s bind() fail with EADDRINUSE for reasons
that have nothing to do with the wildcard-bind behavior under test, e.g.:
# bind_wildcard.c:775:plain:Expected ret (-1) == 0 (0)
# plain: Test terminated by assertion
not ok N bind_wildcard.v6_local_v4_local.plain
Fix it the same way so_incoming_cpu.c, tcp_port_share.c and
reuseport_dualstack.c already do: unshare into a fresh network namespace
and bring lo up, so there is nobody else to race with for the port.
Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@marliere.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
