Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kuba@kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	shuah@kernel.org, bobbyeshleman@meta.com, sdf@fomichev.me,
	leitao@debian.org, razor@blackwall.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next] selftests: drv-net: devmem: set reuseaddr on the sender's source port
Date: Wed, 09 Sep 2026 18:35:58 +0000	[thread overview]
Message-ID: <178897895866.219967.293435162679292319@kernel.org> (raw)
In-Reply-To: <20260908183420.1369630-1-kuba@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 0

- [Medium] Incomplete fix: the sibling helper socat_listen() in the same
  file still has no reuse option, so the EADDRINUSE/TIME_WAIT flake the…

--

selftests: drv-net: devmem: set reuseaddr on the sender's source port

The devmem selftest's sender has to bind an explicit source port on the
remote host because ncdevmem installs a 5-tuple flow rule. The port is
picked by rand_port() on the DUT, so lingering TIME_WAIT sockets on the
remote can make the bind fail with EADDRINUSE; this adds reuseaddr to the
socat bind option.

> diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> index 3554954a6691..b6e52fa9dda5 100644
> --- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> @@ -201,7 +201,7 @@ def socat_send(cfg, port, buf_size=0):
>      else:
>          addr = cfg.baddr
>  
> -    suffix = f",bind={cfg.remote_baddr}:{port}"
> +    suffix = f",bind={cfg.remote_baddr}:{port},reuseaddr"
>  
>      buf = ""
>      if buf_size:

[Severity: Medium]
Should socat_listen() in the same file get the same treatment?  It builds
the remote listener for the TX tests without any reuse option:

tools/testing/selftests/drivers/net/hw/devmem_lib.py:
    def socat_listen(cfg, port):
        """Socat listen command for TX tests."""
        return f"socat -U - TCP{cfg.addr_ipver}-LISTEN:{port}"

That command also runs on cfg.remote, and the port again comes from
rand_port(), which only binds a probe socket on the DUT.  The RX sub-tests
are what leave the TIME_WAIT sockets described in the changelog, and they
sit on remote_baddr:<port> in the same ephemeral range that rand_port()
draws from.

If run_tx() or run_tx_chunks() then draws a colliding port, the wildcard
bind of the listener conflicts with the lingering TIME_WAIT socket without
SO_REUSEADDR, socat exits, and:

    with bkg(listen_cmd, host=cfg.remote, exit_wait=True) as socat:
        wait_port_listen(port, host=cfg.remote)

times out, failing the sub-test.  Is that the same failure mode the patch
removes for the sender, just on the listener side?

For reference, the other socat listeners under drivers/net (ping.py, tso.py,
uso.py, xdp.py, xdp_metadata.py, ntuple.py) all pass ",reuseport"
explicitly, so devmem_lib.py's socat_listen() looks like the only bare one.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908183420.1369630-1-kuba%40kernel.org

  parent reply	other threads:[~2026-09-09 18:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 18:34 [PATCH net-next] selftests: drv-net: devmem: set reuseaddr on the sender's source port Jakub Kicinski
2026-09-09  9:19 ` Breno Leitao
2026-09-09 18:35 ` netdev-bot+sashiko [this message]
2026-09-09 18:40 ` Bobby Eshleman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178897895866.219967.293435162679292319@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bobbyeshleman@meta.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox