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=1796516592; b=wfqdCs6WXec1jejWXfLnA7rJx56NnYDuyEi+H895yg18hnGEcgUlucmQWlLRwefAZ1pJ h0VYAakiuvE0Uur4nXmI+AMol1KJG3XtkSjqU4a7wR6CpsmOpmXw6xgh29FesTkdKPKf5 WrzD0gcZcUZXZ+5p3WxeV8JXkqNqCuj+pExmzZ6d0axoBrWGqFXBJ6dxZ9FTv0rfTSD+c z0+N8BfLZCJUvPVlPPpZSTxc3arBmzBi9W0Pd/cOrQhZl1Nu9LedIfajMv0kGt7zbBwEJ wPyzqtuc3jw7aEK4z2gPqK9PoFFYm6c3n1e27DMaw1Jqu0QUoqmiq3M4PispX10qSig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796516592; 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=yj8lbIQThBmsXKg+cV8jtrZSdxTbknbCiku1aJOuHW0=; b=GWr1Ol+Gpv6moARa7wTphkjfQ2veZ1+IyOKQ9KryV3zouGNcCiJ4ZyT6JwaFCeza2O/9 rU2ejjW32pqrSWgFYK15af/4ZymCTSaZUswUeAREs2/7SGUrB30Ivs2/2fPGu/aid0Dya /JQmat4yz0P1/uDoYrCCY6cs/5dbQuhoyzzgzL0vt/SihstbxIIWV5j5xB2Je4tQ/0Y0S IjZ0+arqMTx9dpW+ugx4yP4/tCRw1vx+ZOjcB4DVAHaj2OEC7PCHzrEWWVFX6dQLb3C/k yShD3D+voD5r4cEgfnf7ls3p8P7vSNnV03u2jwwtnLNvSCCRICyVei4h3xOmgbwfmOw== 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=dl12W5Bq; 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 4960D606A31F; Sun, 6 Dec 2026 00:23:12 +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=dl12W5Bq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 382841F00A12; Sun, 6 Dec 2026 00:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796516592; bh=yj8lbIQThBmsXKg+cV8jtrZSdxTbknbCiku1aJOuHW0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dl12W5BqGCTq2ZDJae2nB2ErYUGuOP/5v777kyz/4L8FrUFbSt8R12p7C7DRZmBNz 7/1ykuMmYzzFfFIcAQpPv1A/UsIMaNp5stLwUUeKUQfBMfXMTSACmkMXcRsUhR6p+H 6irHrqzRWASVm9H3OBP+lyfXzNNZfkmu32Fo9LlfBGuyIMma8FlqyOxMOcBpnkm6f3 WZI+SirJHsuaw+K7tsOONneUbA3kXPSL/YwhmmAnikUPWn0N8J/LRZwJNDJAcYN9hO rHoiNjTjzdm0DpjNBz5oVhjiKByACYOkV8MAmasDyZO2HzZVJEu/SMN+bwnceGLoxb /Dnaa48t0kRSg== Subject: Re: [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests From: netdev-bot+sashiko@kernel.org To: rjethwani@purestorage.com Cc: netdev@vger.kernel.org, stable@vger.kernel.org, john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, alice.kernel@fastmail.im, tariqt@nvidia.com Date: Sun, 06 Dec 2026 00:23:10 +0000 Message-ID: <179651659076.3148.8947258780575987752@kernel.org> In-Reply-To: <20261204235642.36653-8-rjethwani@purestorage.com> References: <20261204235642.36653-8-rjethwani@purestorage.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 3 · Low: 4 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] The commit message says the test will "Skip configurations the test cannot safely restore", but the restorability checks only look at… - [Medium] The comment on PAUSE_IO_TIMEOUT_S (tls_hw_offload.py:41) says 45s is "long enough for a bounced NIC to retrain". - [Medium] selftests/net: run_tls_test() stalls teardown by resuming paused client - [Low] The comment above HELPER_TIMEOUT_S (tls_hw_offload.c:94) says "-T raises both, keeping the lifetime above the I/O timeout". - [Low] The INFLIGHT_LINK_UP script wraps its `ip link set dev up` in try/finally under the comment "Bring the slave back however… - [Low] bounce_inflight() starts its link-up helper with bkg([sys.executable, '-c', INFLIGHT_LINK_UP, ...], exit_wait=True)… - [Low] selftests/net: tls_hw_offload -T uses atoi() instead of parse_int_arg() -- selftests: net: add TLS offload over bond tests This adds kselftest cases that run the kTLS echo test over a single-slave balance-xor bond with layer3+4 hashing. They also bounce the slave midway through an echo to exercise the TX software fallback. The C helper gains a -P option to pause the client halfway and a -T option to change the I/O timeout and the helper lifetime. > diff --git a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c > index 5b3887f32b689..9c1c546d36cf6 100644 > --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c > +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c [ ... ] > @@ -797,6 +815,17 @@ int main(int argc, char *argv[]) > case 'V': > verbose = 1; > break; > + case 'P': > + pause_mid = 1; > + break; > + case 'T': > + io_timeout_s = atoi(optarg); > + if (io_timeout_s < 1 || io_timeout_s > 120) { > + printf("ERROR: -T out of range 1..120\n"); > + return 1; > + } > + helper_timeout_s = 2 * io_timeout_s + 15; > + break; [Severity: Low] Is there a reason -T uses atoi() here rather than parse_int_arg()? Every other numeric option in main() (-p, -b, -r, -t and -n) goes through parse_int_arg(). That helper uses strtol(), rejects empty strings and trailing characters, and checks the range itself. atoi() takes "-T 10abc" as 10. Its behaviour on an out-of-range string is undefined, so the 1..120 check that follows does not reliably catch bad input either. The harness always passes a plain integer, so this only matters for manual runs. Something like parse_int_arg(optarg, 1, 120, "timeout", &io_timeout_s) would drop the ad-hoc check and keep the error messages consistent with the other options. [Severity: Low] This isn't a bug, but the comment above HELPER_TIMEOUT_S says: -T raises both, keeping the lifetime above the I/O timeout. This case accepts any value from 1 to 120. Wouldn't -T 1 through -T 7 lower the I/O timeout below IO_TIMEOUT_S rather than raise it? The help text in print_usage() also puts the formula next to defaults that the formula does not produce: -T Send/recv timeout (default: 8); lifetime bound becomes 2 * + 15 (default: 15) Passing -T 8 explicitly gives a 31s lifetime, not the default 15s. Could the comment and the help text be updated to match the code? [ ... ] > diff --git a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py > index e720ce6547610..7d90f1c2024a1 100755 > --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py > +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py [ ... ] > @@ -19,9 +31,18 @@ from lib.py import ( [ ... ] > +BOND_IFNAME = "tlsbond0" > + > +# -T for -P cases, long enough for a bounced NIC to retrain. > +PAUSE_IO_TIMEOUT_S = 45 [Severity: Medium] Is 45s really long enough, given the other deadlines in this file? run_tls_test() passes -T 45 to both helpers, so set_io_timeouts() sets SO_RCVTIMEO to 45s on the server socket. The server then waits in recv() for the whole pause. In the idle variant, the pause covers wait_hw_stats_settle(), the link down/up and wait_bond_ready(). wait_bond_ready() allows: wait_carrier(cfg.ifname) up to 30s wait_carrier(BOND_IFNAME) up to 30s wait_reachable(BOND_IFNAME, peer) up to 30s per peer Take a NIC that gets carrier at 20s and first answers ping at 47s, for example behind a switch port with an STP forwarding delay. It passes each of these deadlines, but the server's recv() has already timed out by then. Wouldn't that end in the bare helper recv timeout that wait_reachable()'s docstring says it is meant to avoid? In the inflight variant, nothing waits for carrier after the background "ip link set up". The resumed segment only gets through on a later RTO retransmission. With exponential backoff (roughly 0.2, 0.6, 1.4, 3.0, 6.2, 12.6, 25.4, 51s), a NIC that needs more than about 23s to retrain after the roughly 2s outage misses the 25.4s retransmission. The next retransmission comes after both helpers' 45s timeout, even though wait_carrier() itself would accept up to 30s. Should PAUSE_IO_TIMEOUT_S be derived from these deadlines? Or should the deadlines be tightened to fit inside it? [ ... ] > @@ -305,6 +357,439 @@ def test_tls_offload_record_type(cfg, record_type): [ ... ] > +def setup_bond(cfg): > + """Enslave the DUT NIC to a single-slave bond for the rest of the case. [ ... ] > + # Deleting a primary IPv4 address can take its secondaries with it. > + ip(f"addr flush dev {cfg.ifname} scope global") > + ip(f"link set dev {cfg.ifname} down") [Severity: Medium] The commit message says: Skip configurations the test cannot safely restore. What happens if the NIC has 802.1Q VLAN uppers? setup_bond() and require_restorable() check for: - an existing master - nexthop objects - multipath and prefsrc routes - the NIC's IPv6 addresses and IPv6 local table - permanent or proxy neighbours None of these checks looks at devices stacked on top of the NIC. Taking the NIC down here, and again in bounce_idle() and bounce_inflight(), makes vlan_device_event() schedule VLAN_WORK_LINK_STATE. vlan_dev_work() then closes every VLAN that does not use loose binding: net/8021q/vlan_dev.c:vlan_dev_work() { ... } else if ((flgs & IFF_UP) && !loose) { netif_change_flags(vlandev, flgs & ~IFF_UP, NULL); ... } The VLANs come back up with the NIC, but closing them has already: - removed their IPv6 addresses (keep_addr_on_down defaults to 0) - deleted routes through them - flushed their permanent neighbours save_nic(), route_keys() and check_routes() only cover dev {ifname}, so none of this is saved, restored or checked. ksft_disruptive cases run by default. On a DUT like this, wouldn't the test silently drop the VLAN configuration instead of skipping? Should require_restorable() also skip when the NIC has upper devices? [ ... ] > +found = [] > +# Bring the slave back however polling ends. > +try: > + end = time.monotonic() + float(wait_s) > + while time.monotonic() < end: > + found = client_retransmits() > + if len(found) == 1 and found[0] > int(base): > + time.sleep(float(outage_s)) > + break > + time.sleep(0.1) > +finally: > + up = subprocess.run(["ip", "link", "set", "dev", ifname, "up"]) [Severity: Low] Does this finally block run on run_tls_test()'s exception path? tls_hw_offload.py:run_tls_test() { ... except BaseException: if pending: pending.process(terminate=True, fail=False, timeout=reap_timeout) ... } bounce_inflight() starts this script without ksft_ready/ksft_wait, so it does not lead its own process group. cmd._process_terminate() therefore falls back to self.proc.terminate() and sends SIGTERM to the interpreter. The script installs no SIGTERM handler, so CPython exits without unwinding and this "ip link set up" never runs. The deferred restore_nic() brings the NIC up later, but the guarantee in the comment does not hold on that path. > +def bounce_inflight(cfg, port): [ ... ] > + base = client_retransmits(cfg, port) > + ip(f"link set dev {cfg.ifname} down") > + return bkg([sys.executable, "-c", INFLIGHT_LINK_UP, > + client_proc_rem(cfg, port), str(base), cfg.ifname, > + str(INFLIGHT_SEND_WAIT_S), str(INFLIGHT_OUTAGE_S)], > + exit_wait=True) [Severity: Low] What happens to this helper if pending.process() in run_tls_test() times out? The handle is never used as a context manager, and it does not own a process group. It is only reaped through pending.process(..., timeout=reap_timeout). On TimeoutExpired, Popen does not kill the child, and cmd._kill_leftovers() returns early: if not self._own_pgrp: return So the helper keeps running unreaped. After the SIGTERM above, so can an "ip link set up" grandchild that still holds the inherited stdout/stderr pipes. The TimeoutExpired also replaces the original test exception. Could that leftover process still change the slave's link state while the defers delete tlsbond0 and run restore_nic(), or during the next case? [ ... ] > @@ -244,26 +274,48 @@ def run_tls_test(cfg, cipher="128", tls_version="1.2", > client_parts.append(f"-b {buffer_size}") > if record_type: > client_parts.append(f"-t {record_type}") > + if pause: > + client_parts += ["-P", io_opt] > client_cmd = " ".join(client_parts) > > stats_before_local = read_tls_stats() > stats_before_remote = read_tls_stats(host=cfg.remote) > nic_before = read_nic_stats(cfg) > + nic_paused = None > > # The remote server runs under bkg(), whose stdout pipe is only drained > # once it exits, so the helper keeps its per-connection output small > # (see the note on verbose in tls_hw_offload.c); do not pass -V. > # > - # Both helpers exit on their own within HELPER_TIMEOUT_S (see > + # Both helpers exit on their own within their SIGALRM lifetime (see > # tls_hw_offload.c), so nothing outlives the variant even on failure. > - with bkg(server_cmd, host=cfg.remote, exit_wait=True): > + with bkg(server_cmd, host=cfg.remote, exit_wait=True, **budget): > wait_port_listen(port, host=cfg.remote) > - cmd(client_cmd) > + if pause: > + # bkg() returns once the client pauses; leaving resumes it. > + pending = None > + reap_timeout = INFLIGHT_SEND_WAIT_S + INFLIGHT_OUTAGE_S + 10 > + try: > + with bkg(client_cmd, ksft_wait=30, **budget): > + # pause() may take the socket off the NIC. > + cfg.wait_hw_stats_settle() > + nic_paused = read_nic_stats(cfg) > + pending = pause(cfg, port) > + except BaseException: > + if pending: > + pending.process(terminate=True, fail=False, > + timeout=reap_timeout) > + raise > + if pending: > + pending.process(terminate=False, fail=True, > + timeout=reap_timeout) > + else: > + cmd(client_cmd) > > cfg.wait_hw_stats_settle() > stats_after_local = read_tls_stats() > stats_after_remote = read_tls_stats(host=cfg.remote) > - nic_after = read_nic_stats(cfg) > + nic_after = nic_paused if pause else read_nic_stats(cfg) > > verify_tls_counters(stats_before_local, stats_after_local, is_dut=True, > hw_directions=hw_directions) [Severity: Medium] What happens to the paused client if pause() raises? The client bkg() gets ksft_wait=30 but not exit_wait=True, so its _exit_wait stays False. Suppose bounce_idle() fails in wait_carrier() or wait_reachable(), bounce_inflight() fails in client_retransmits(), read_nic_stats() fails, or KsftTerminate arrives inside the block. bkg.__exit__() then leaves terminate False and calls _reap_cancelled() with the 120s budget timeout. _reap_cancelled() writes to ksft_term_fd, which releases the client from ksft_wait(). It then waits for the client without sending SIGTERM. do_client() does not exit after ksft_wait(). It carries on with the second half of the iterations, with 45s socket timeouts from -T 45 and a 105s alarm(). If the slave is still down or the peer is unreachable, the error from pause() is held up until the client times out or its alarm fires. That also delays the defers that delete tlsbond0 and run restore_nic(). If the runner kills the test in that window, the DUT NIC stays enslaved to tlsbond0 without its addresses and routes. Would adding exit_wait=True next to ksft_wait=30 be enough here? The normal exit path should not change. A cancelled block would then send SIGTERM to the client's process group instead of resuming it. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com