From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796418579; b=F7FNjPNozCP0gQ7kceSNzy9ZgcyG2WJwrUp4pLWmYjKiPnFrksSnOx1sriFygCaQyj0g EmnjuGw7QCY2+AcepSeDuao9Lp/afI2z7P/TSQEljMY5gDVv9rjt5csIJFCkc2tPSEN/o wBvOEKRhCaNfJCwxUP+7c85lRGh6mefERxa1Jaj8fN39O9OX+IUbz21XpUAhASIuVJ3u5 i42NoVektEwJqHThZES5RcWvAFQ3ZL4KspVqbxnistk8xgDlsTiBZCMbZYbR1sXqjMjMQ qx0xSx7xAOIl1+XMjAY09Az1IznW0tFGTQRlau+Upq6sE6RQkP8dEDzIIwfXWM1dXSw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796418579; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=iaPFFrJyO6V1EEQd2jYGq3DhBstY507wgaiSKXHgTIA=; b=R3Yo6/HxezyS571Th4coTL8MzR2ps28blL6krp3bsJstaCuwnoR9DiYBzN1e5ROUpbeo gxBHrx5FMsY9ZO470riyQQDNqnBMSQUtb/bXg/fzcZRC/RCrS76OE1b2rgk0+FoteHKCz DAuNFWGRMXpP/j5iqpitJ6k7gSxeIgTv4Nb0f2eaqUj0/r4YZqyxOz5mTJEf6fcvd/UBq ru1UrKmGl8DDWsj32kGrCtxH7Df2/Qq8gMbqnayPo3tAzFoKjmOeRRl+x6sCdjroPucIi gRSqrEQp0J6c0CVqlALHix8VPsS3SWR5cglr5TH9+06tc4/g8l2r2AEBzjah2FOgP/Q== 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=iQfTP1Xm; arc=none smtp.remote-ip=100.103.45.18 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 8AB40606A336 for ; Fri, 4 Dec 2026 21:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iQfTP1Xm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6BD1F00A06; Fri, 4 Dec 2026 21:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796418579; bh=iaPFFrJyO6V1EEQd2jYGq3DhBstY507wgaiSKXHgTIA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=iQfTP1XmKQ3cWPYOAPW1v2pOovy83AqeVZk/LFRk7nH5Q0OvgfVxZE1MTOi6R2WcT Y2a3lXPYShQC+fd4T6tbPUrQfMlSObQd2oZOa4l93TilhjfevwEYus8PyFTYsUK5wC p9qqZx5CzD/QkoJJTOGJjo/RNILQz1j28GA4uf40D6YpJWixL5i7VO8CgV4ZRpzyX1 NdOvdEX0dXmzqpPk9Df0aQNlZLRg66nYZrVGAQ+A8LiXVM/l4L+MDdgiu9y3XSsZgE fUwATPankLuv0svoVvtJthlfEMmPM2Trk8PAOrr4/TT10LTtYREzJvOuScvArZYUqO 8EsnCctZFX6vQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net 10/10] selftests: drv-net: devmem: test unreadable skbs on TCP-MD5 and TCP-AO Reply-To: sashiko-reviews@lists.linux.dev To: "Octavian Purdila" Cc: bpf@vger.kernel.org In-Reply-To: <52f84807018ab3f05cc1b55e58aef6feeba01d50.1796329894.git.tavip@google.com> References: <52f84807018ab3f05cc1b55e58aef6feeba01d50.1796329894.git.tavip@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 21:09:38 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [Low] selftests/drv-net: missing ksft_disruptive on check_tcp_auth() - [Low] selftests: drv-net: run_tcp_auth() uses remote socat without require_cmd() - [Low] selftests: drv-net: hardcoded asm-generic SO_ZEROCOPY and SCM_DEVMEM_DMABUF - [Low] selftests: devmem: run_tcp_auth() aborts sender below TCP_RTO_MIN (150ms) - [Low] selftests: devmem: run_tcp_auth() sends local-endian structs to remote - [Low] selftests: drv-net: devmem: TCP_CORK 200ms probe timer races run_tcp_auth() -- commit 7c6c1d51d9efdb69a8ea4cff34ab61665639eca4 Author: Octavian Purdila selftests: drv-net: devmem: test unreadable skbs on TCP-MD5 and TCP-AO This commit adds a devmem.py test case for TCP-MD5 and TCP-AO sockets, verifying that devmem TX sends and key additions with queued unreadable skbs fail with EOPNOTSUPP while unreadable incoming authenticated segments are dropped. > diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/tes= ting/selftests/drivers/net/hw/devmem.py > index d15118060d261..d7e3915e4ee36 100755 > --- a/tools/testing/selftests/drivers/net/hw/devmem.py > +++ b/tools/testing/selftests/drivers/net/hw/devmem.py [ ... ] > @@ -41,12 +41,18 @@ def check_rx_tls(cfg) -> None: > run_rx_tls(cfg) > =20 > =20 > +@ksft_variants(["md5", "ao"]) > +def check_tcp_auth(cfg, mode) -> None: > + """Run the TCP-MD5 or TCP-AO unreadable RX/TX test.""" > + run_tcp_auth(cfg, mode) [Severity: Low] Should check_tcp_auth() carry @ksft_disruptive below @ksft_variants()? run_tcp_auth() calls _setup_devmem_rx_queue(), which reconfigures HDS rings via ethnl.rings_set(), changes the RSS indirection table, and binds a devmem RX queue. Without @ksft_disruptive, running devmem.py with DISRUPTIVE=3DFalse on a single-interface system will still execute this test and can disconnect NETIF. > diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools= /testing/selftests/drivers/net/hw/devmem_lib.py > index 75199a01ca3fc..13dd2c9482683 100644 > --- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py > +++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py [ ... ] > @@ -322,11 +324,19 @@ def run_rx_hds(cfg): > ksft_eq(ncdevmem.ret, 0, f"HDS failed for payload size {size}") > =20 > =20 > +MSG_ZEROCOPY =3D 0x4000000 > +SO_ZEROCOPY =3D 60 > +SCM_DEVMEM_DMABUF =3D 79 [Severity: Low] Will these hardcoded asm-generic values break on SPARC and PA-RISC? On SPARC, SO_ZEROCOPY is 0x003e (62) and SCM_DEVMEM_DMABUF is 0x0058 (88), while 60 is SCM_TIMESTAMPING_PKTINFO; PA-RISC uses 0x4035 and 0x404f. Passing the wrong constants makes setsockopt() and _sendmsg_devmem_tx() target unrelated options or fail instead of exercising devmem TX. [ ... ] > + try: > + if mode =3D=3D "md5": > + opt =3D _pack_md5sig(af, cfg.remote_addr, key) > + remote_opt =3D _pack_md5sig(af, cfg.addr, key) > + opt_num =3D TCP_MD5SIG_EXT > + else: > + opt =3D _pack_tcp_ao_add(af, cfg.remote_addr, key) > + remote_opt =3D _pack_tcp_ao_add(af, cfg.addr, key) > + opt_num =3D TCP_AO_ADD_KEY > + srv.setsockopt(socket.IPPROTO_TCP, opt_num, opt) > + except OSError as e: > + if e.errno in (errno.ENOPROTOOPT, errno.EOPNOTSUPP, errno.ENOENT= ): > + raise KsftSkipEx(f"{mode} unsupported on local kernel") from= e > + raise > + > + opt_hex =3D remote_opt.hex() > + probe_script =3D ( > + f"import socket\n" > + f"with socket.socket({int(af)}, socket.SOCK_STREAM) as s:\n" > + f" s.setsockopt(socket.IPPROTO_TCP, {opt_num}, " > + f"bytes.fromhex('{opt_hex}'))\n" > + ) > + if _remote_py(cfg, probe_script, fail=3DFalse).ret !=3D 0: > + raise KsftSkipEx(f"{mode} unsupported on remote kernel") [Severity: Low] Can remote_opt fail with EINVAL when the local and remote hosts have different endianness? _pack_md5sig() and _pack_tcp_ao_add() serialize sa_family, tcpm_keylen, and the _TcpAoAdd bitfields in local host byte and bit order. On a mixed-endian SSH setup (for example, a big-endian DUT with a little-endian remote endpoint), the remote kernel rejects the swapped option with EINVAL and probe_script silently turns that into a skip. Packing the struct inside the remote Python script avoids the mismatch. [ ... ] > +s.recv(1) > +s.sendall(b"authenticated-payload") > +time.sleep(0.15) > +s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0= )) > +s.close() [Severity: Low] Could this 0.15s sleep cause ksft_busy_wait() to time out if the payload segment is dropped? Linux TCP_RTO_MIN is 200ms, so neither the normal RTO nor a single-packet tail loss probe can fire before sender_script aborts the socket with SO_LINGER (1, 0) and purges the retransmit queue. Blocking on s.recv(1) with a safety timeout until the local side closes conn, as run_rx_tls() does, allows retransmissions and avoids the fixed 150ms idle delay. [ ... ] > + cork_port =3D rand_port() > + with bkg(socat_listen(cfg, cork_port), host=3Dcfg.remote): > + wait_port_listen(cork_port, host=3Dcfg.remote) [Severity: Low] Is cfg.require_cmd("socat", local=3DFalse, remote=3DTrue) missing here? Neither run_tcp_auth() nor socat_listen() checks for socat on the remote host, so if socat is not installed on cfg.remote the test fails with a 5-second wait_port_listen() timeout instead of skipping cleanly. [ ... ] > + conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_CORK, 1) > + ksft_eq(_sendmsg_devmem_tx(conn, tx_dmabuf_id, 64), 64) > + if opt_num =3D=3D TCP_AO_ADD_KEY: > + with ksft_raises(OSError) as cm: > + conn.setsockopt(socket.IPPROTO_TCP, opt_num, opt) > + ksft_eq(cm.exception.errno, errno.EISCONN) > + conn.setsockopt(socket.IPPROTO_TCP, TCP_REPAIR, TCP_REPAIR_O= N) > + try: > + with ksft_raises(OSError) as cm: > + conn.setsockopt(socket.IPPROTO_TCP, opt_num, opt) > + ksft_eq(cm.exception.errno, errno.EOPNOTSUPP) [Severity: Low] Can the TCP_CORK probe timer flush the 64-byte skb before the final setsockopt() runs? Holding back the partial skb under TCP_CORK arms ICSK_TIME_PROBE0 for 200ms via __tcp_push_pending_frames() -> tcp_check_probe_timer(), and TCP_REPAIR_ON does not cancel that timer: test thread _sendmsg_devmem_tx(..., 64) tcp_check_probe_timer() [>=3D 200ms delay] tcp_probe_timer() tcp_write_wakeup() tcp_transmit_skb() <-- flushes skb [peer ACKs, tcp_clean_rtx_queue() frees] setsockopt(..., opt_num, opt) tcp_tx_has_unreadable_skb() =3D=3D false <-- succeeds instead of EOPNOTS= UPP Under a loaded CI VM or debug kernel, setsockopt() then succeeds, leaving cm.exception as None and failing on cm.exception.errno with AttributeError. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796329894.gi= t.tavip@google.com?part=3D10