🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7123

Re: [PATCH net v3 4/4] selftests: drv-net: psp: test ipv6 tcp socket with extension headers

#7123
From: netdev-bot+sashiko
Date: Sat, 24 Oct 2026 23:48
150 lines
13880 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In data_send_ipv6_exthdr()
  (tools/testing/selftests/drivers/net/psp.py), a missing remote UDP…
- [Low] The new test does not exercise two code paths that earlier
  patches in this series fix, so a regression in either would still pass.

--

selftests: drv-net: psp: test ipv6 tcp socket with extension headers

This adds a data_send_ipv6_exthdr test to psp.py. It sends on a PSP TCP
socket in three phases: with no option, with an IPv6 extension header set
via setsockopt, and with the option removed. After each phase it checks
tx-packets, the received data, and that no plain UDP reaches the peer.
There is a variant each for dstopts, hopopts and rthdr, and the test is
meant to skip if the peer can't install the tc flower filter used for
counting UDP.

> diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py
> index 473500901879b..ddf69c0397da1 100755
> --- a/tools/testing/selftests/drivers/net/psp.py
> +++ b/tools/testing/selftests/drivers/net/psp.py

[ ... ]

> @@ -658,6 +709,85 @@ def removal_device_bi(cfg):
>          _close_conn(cfg, s)
>  
>  
> +def _ipv6_exthdr_variants():
> +    padn = bytes([0, 0, 1, 4, 0, 0, 0, 0])  # one PadN option
> +
> +    def srh(peer):
> +        """ segment routing header, with @peer as its only segment """
> +        return (bytes([0, 2, 4, 0, 0, 0, 0, 0]) +
> +                socket.inet_pton(socket.AF_INET6, peer))
> +
> +    yield KsftNamedVariant("dstopts", socket.IPV6_DSTOPTS, lambda peer: padn)
> +    yield KsftNamedVariant("hopopts", socket.IPV6_HOPOPTS, lambda peer: padn)
> +    yield KsftNamedVariant("rthdr", socket.IPV6_RTHDR, srh)

[Severity: Low]
This isn't a bug, but two code paths fixed earlier in the series are not
exercised by these variants.

Each variant sets exactly one sticky option, so this loop in
psp_ipv6_nexthdr_off() in net/psp/psp_main.c only ever runs once:

    while (off < len) {

A version that rewrote only the first extension header's nexthdr would
still pass all three variants. A TCP socket can emit two headers here, for
example IPV6_HOPOPTS plus IPV6_DSTOPTS. ip6_xmit() pushes those through
ipv6_push_nfrag_opts() and ipv6_push_frag_opts().

Also, srh() builds an SRH with segments_left=0 and the peer as its only
segment. In ipv6_push_rthdr4():

    sr_phdr->segments[0] = **addr_p;
    *addr_p = &sr_ihdr->segments[sr_ihdr->segments_left];

So the L3 daddr ends up equal to the final destination. As a result, the
intermediate-hop case fixed in mlx5e_psp_handle_tx_skb() by "net/mlx5e:
psp: tso: replace only the length in checksum seed" never comes up here.

Would it be worth adding a variant that sets two sticky options? The
intermediate-hop case probably needs more topology setup.

> +
> +
> +def _remote_seg6_enable(cfg):

[ ... ]

> +@ksft_variants(_ipv6_exthdr_variants())
> +def data_send_ipv6_exthdr(cfg, opt, val):
> +    """ Test PSP on IPv6 packets with an extension header """
> +    cfg.require_ipver("6")
> +    _init_psp_dev(cfg)
> +    if opt == socket.IPV6_RTHDR:
> +        _remote_seg6_enable(cfg)
> +
> +    s = _make_psp_conn(cfg, 0, "6")
> +    try:
> +        # In happy path, PSP traffic arrives at the remote decrypted as TCP
> +        remote_udp = _remote_udp_from(cfg, s.getsockname()[0],
> +                                      s.getpeername()[0])
> +        if not remote_udp:
> +            raise KsftSkipEx("can't count UDP on the remote")

[Severity: Medium]
Can this skip path end up reported as a failure?

_make_psp_conn() has already opened the data connection by the time
_remote_udp_from() runs. psp_responder then runs conn_setup_psp() inline
from run_session(). It sends its key and then blocks waiting for the
client's key:

tools/testing/selftests/drivers/net/psp_responder.c:conn_setup_psp() {
    ...
	sz = recv(data_sock, info, sz, MSG_WAITALL);
    ...
}

The tc filter install can fail, for example when cls_flower or act_gact
is missing on the remote. In that case KsftSkipEx is raised before
_spi_xchg() sends the client key, and the finally block runs:

_close_psp_conn()
  _close_conn()
    _send_with_ack(cfg, b'data close\0')

The responder is still blocked in conn_setup_psp() and never reads the
'data close' command. The recv(4) on comm_sock, which was created with
timeout=1, then raises TimeoutError. That replaces the KsftSkipEx, and
ksft_run() records a FAIL instead of a SKIP.

In _close_conn(), s.close() comes after _send_with_ack(), so the data
socket is not closed explicitly either.

What happens when the socket is eventually closed? The responder might
see the data socket EOF before the queued 'data close', hit the
race_close path with data_sock == -1, and leave a stale 'err' reply on
the control channel. Later tests, including the next variants that take
the same skip path, could then fail with "Unexpected server response".

Could the remote filter be installed before _make_psp_conn() is called?
Another option would be to finish the key exchange before any early exit.

> +
> +        rx_assoc = cfg.pspnl.rx_assoc({"version": 0,

[ ... ]

> +    finally:
> +        _close_psp_conn(cfg, s)

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023234640.1459291-1-toddfreed%40meta.com
Technical Details
Message-ID: <179288570316.3134.17338958323067090592@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351460-linux-kernel-netdev=dewy.ru
References: <20261023234640.1459291-5-toddfreed@meta.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351460-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 4/4] selftests: drv-net: psp: test ipv6 tcp socket
 with extension headers
Date: Sat, 24 Oct 2026 23:48:23 +0000
Organization: Usenet Network
Message-ID: <179288570316.3134.17338958323067090592@kernel.org>
References: <20261023234640.1459291-5-toddfreed@meta.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="894469"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QSk2hMs2UmI+kwu6b7xkjEgkK+E= sha256:7ZP+8RQRqvzWDH5LM7xepOvfWF5eB14G2Favws5OV/A=
	sha1:m8LS+K5H0WJNPtPoWXUYr9s3EtE= sha256:+4MQGkfitnIFbTnmrbayG48IMlSFPKGfY9PJlpdj05Y=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 68397DF828; Sun, 25 Oct 2026 02:49:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.839
X-Spam-Status: No, score=-3.839 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 92Ut8Ux72BDx;
	Sun, 25 Oct 2026 02:48:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-351460-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id CF7ED111596; Sun, 25 Oct 2026 02:48:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id BD96C602CBF; Sat, 24 Oct 2026 23:48:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792885721;
	b=CJ+FrPJLlcLoUzCbIFipRKi27xebdJVhRb9Xc9BPNTM7N8gUOV5g4pBIfbr0VdVFeu2h
	 H60RYy65BDmbexlYTWh9nF1Auncc51Xc6wnWUcFL4njVRQcqlyFLi0Tb8hbGi/O9uTT1A
	 ZicotphkPsojVVlu37xgyxcW1o2tuKJ0AugB9O+RMI1RAkwc5VDJTLUt1ncT34NrFZ40H
	 YLBUNLe56IPdSCTp+xXM12cK8gBZHh+RobgZy2nnHuANyXUjILiVnK1qwpULvz5MmA8c0
	 88VnbPnk13bw+6z28RcMpSarGpAKxxbaCL9seEWI7TsRUZRMs7fUnZlVh2nI0t420XQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792885721;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=TeJm7zc7lEIpBVq9wFNx6l6n9j2IH2aj6mrm2Pb6m0Y=;
	b=QWdnsXaeLKoUiRe4X5QXYOAqOoWfufrFfWbrNkT3j25jkI9oX2NCmPHEwBYsuaKn8gDI
	 BqsHgZOmk/mnkjhhSIm/jHBakJgkSF65nRxRKky4Shv0hlq79tMYKlPc/7cx3LqiHIpsy
	 Nc5SITsJLr6L/0epEr5uelhk1Xl0SoztI05o8ju2pev7xJN2hTrUx957lSvS5rbwgeFN/
	 ngvwPKLYY03M/uo6NKQSAP6t+qFQmwVcf2yRKgGvknznXThQbl6OZjK+zNQwZZ0QInclT
	 GJOs82dImgXddfj/lk+dPrgLtYR1fb9zvfjOA9EQs3DNDY/BKMHBaIB9MWIHMDTf6nw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gHLRXUBe;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 7824E606A323;
	Sat, 24 Oct 2026 23:48:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gHLRXUBe
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792885705;
	b=m4T3Y5d2SyfDGQvAqVjTNn7rqUY9UkvdCxI30vR51FGc0XtC65J47Wcjd7ETMVM0U8A/
	 dTGMpCNeS5u0uoojZKlrCB7FdS+dx4j16KsTLKPzx1O2IPXRKy3YOOKeCotgbH9Mja9kx
	 DUhfy8LLcCQ3BmOHtodGzlJpbl5r+XOPEZUnnGhKVMIeKuwjcNrnElKb1ul+IsiWJJgCj
	 dLIqGeVVmc4imOsr5fdxZ3kX13QiKZwDdeKC9ZtM994XRa2owWG5n+tFKTVXYkklgKCvf
	 Lz2sFdKZjVgxjFgBhuQ9a2mx8peH2YQhkLB/03ZslbHcmgV1oGdjoJq50fp1jlYXNFg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792885705;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=TeJm7zc7lEIpBVq9wFNx6l6n9j2IH2aj6mrm2Pb6m0Y=;
	b=BDwHVq9qFt1L8cbG0w8GfHeoCpfL0dWfeN7LDZa1LauEh4lu+kOFG4zCYFQYoJfGu4LE
	 2FwZpZsmRH6g64KnHnv0UWo17HutDRiHriFnfDKIvCTQErSCj0FDyYJein534/6FWfWFj
	 lCxjjBs93YAdDLD0+/vHsRETzvkBwtOUHoYwL3ncjYwp8DMClrysFRzQtcBFeeMKvxHO5
	 Gfghx82a2PtNlxmX+De5evBmOb4bdor/k5ixhVJ/QjqzV3Lj6oJ0T+/kmWKgXemEXr2h7
	 0Xixmlu9VXjNQoqYBLVJV03F5uuX46CHKh7StnKKpdP9TBGXguqXL6J3uwhdJV4z+Tg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gHLRXUBe;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A078606A31E;
	Sat, 24 Oct 2026 23:48:25 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 949891F01828;
	Sat, 24 Oct 2026 23:48:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792885704;
	bh=TeJm7zc7lEIpBVq9wFNx6l6n9j2IH2aj6mrm2Pb6m0Y=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=gHLRXUBeutqrRN8mV/yRzcuSHfB7iPhstEZ7Mw1YneQuPX8guBC0Fs8Sd5W+S6qUF
	 tlh5GnFDZ+s5RbPh5z6gC4WmK7EqUCjKhjXG3aLBOLKN8+GcdZikmVGFnpjlASWojC
	 FcSw7vBzACTKeZUnJ4w03QUr4+eLEZsOJJmr3HuQoBhDVZ8o98sjUy8UQ1OvchLWxn
	 auBJ8oaoY5dQvOUvZ1b96wMifDlnb0pcLC9gsO8m81V2zY111tviuvo357AAZXvZN5
	 x1qxDBqp3pqT+/js6JI/1lKttO/2cBZ4LdPJdif+ES1iFbYi7MRIDHsG7Bcl1tSM+I
	 8rSBtl+pwbG9g==
X-Cc: netdev@vger.kernel.org, borisp@nvidia.com, saeedm@nvidia.com,
 leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 daniel.zahka@gmail.com, willemdebruijn.kernel@gmail.com, horms@kernel.org,
 shuah@kernel.org, cratiu@nvidia.com, raeds@nvidia.com, rrameshbabu@nvidia.com,
 linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
 linux-kselftest@vger.kernel.org, bjorn@kernel.org, dtatulea@nvidia.com
X-In-Reply-To: <20261023234640.1459291-5-toddfreed@meta.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list