* [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire
@ 2026-12-04 23:53 Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
` (8 more replies)
0 siblings, 9 replies; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev; +Cc: Rishikesh Jethwani
On TX, skb->decrypted marks data that still needs device crypto.
Patches 1-3 fix three paths that can expose plaintext:
1. Reject IPv4 and IPv6 fragmentation of marked skbs. Fragments can
lose the mark, and neither kTLS nor PSP can process them as TCP
segments.
2. Make kTLS software fallback encrypt only marked skbs and clear the
mark on its output. A second pass at a bond slave then leaves the
ciphertext alone.
3. Require the mark for NIC TLS offload so the NIC does not encrypt
fallback output from an upper device a second time.
Patch 4 removes the fallback bypass that patch 2 makes unreachable,
so the dead code does not stay in net. Patches 5-9 add the regression
tests and the helpers they need. The tests use the bond, macvlan and
nftables options added to drivers/net/hw/config, and the fragmentation
test needs bpftrace 0.20 or newer.
We found all three issues by manual inspection. On two mlx5 hosts with
TLS 1.2 AES-GCM-128, IPv4 created fragments before the fix, and the
bond-bounce and macvlan tests returned mismatched echoes. All three
tests pass with the series. Plaintext exposure is inferred from the
code, not a wire capture. PSP and other drivers were checked by
inspection only.
Backport patches 1-3 together, in order; patch 4 is cleanup only. Patch
2 needs fc6d80eb5044, already in 5.10.y, 5.15.y and 6.1.y. Patch 3
relies on patch 2 clearing the mark on fallback output, so do not split
them. Before v6.10, check skb->decrypted under CONFIG_TLS_DEVICE. Before
v6.5, the TLS offload helper takes a socket, so patch 3 must check the
skb at its callers.
Changes in v3:
- Add patch 1: IP fragmentation can strip the mark before TX
validation, so patch 2 needs it, also in stable.
- Patch 2 (v2 1/3): code unchanged apart from comments. Say how the
bug was found, and correct the stable prerequisite to 5.10.x.
- Add patch 3: the NIC re-encrypting fallback output from an upper
device (Sashiko).
- Add patch 4: remove the start marker bypass that patch 2 makes
unreachable.
- Replace v2 2/3 with patches 5 and 6: kill the whole process group
of a command that times out or fails to report ready, not only the
direct child (Sashiko), and add the bkg() timeout as its own patch.
- Patch 7 (v2 3/3): wait for slave and bond carrier and for the peer
after a bounce (Sashiko); check IPv4 before building the bond
(Sashiko); fix the -T help text (Sashiko); verify that the NIC's
routes come back on cleanup; run the bond tests last.
- Add patches 8 and 9: tests for the upper device reroute and the
fragmentation fixes.
- Add this cover letter.
v2: https://lore.kernel.org/netdev/20261119191341.4089157-1-rjethwani@purestorage.com/
Rishikesh Jethwani (9):
net: don't fragment skbs that still need device crypto
tls: device: keep tls_sw_fallback() from encrypting its own output
tls: device: don't let the NIC encrypt fallback output again
tls: device: remove the dead start marker bypass in TX fallback
selftests: net: py: reap commands that fail to report ready
selftests: net: py: add a timeout argument to bkg()
selftests: net: add TLS offload over bond tests
selftests: net: test TLS fallback after rerouting to an upper device
selftests: net: verify that IP refuses to fragment TLS offload data
include/net/tls.h | 3 +-
net/ipv4/ip_output.c | 8 +
net/ipv6/ip6_output.c | 9 +
net/tls/tls_device_fallback.c | 18 +-
tools/testing/selftests/drivers/net/hw/config | 15 +
.../selftests/drivers/net/hw/tls_hw_offload.c | 83 +-
.../drivers/net/hw/tls_hw_offload.py | 839 +++++++++++++++++-
tools/testing/selftests/net/lib/py/utils.py | 256 +++++-
8 files changed, 1191 insertions(+), 40 deletions(-)
--
2.50.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
` (7 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, stable, David Ahern, Ido Schimmel,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Simon Horman, Ilya Lesokhin, Aviad Yehezkel,
Boris Pismenny, Daniel Zahka
IP fragmentation runs before TX validation. Fragments can lose
skb->decrypted, allowing PSP traffic to bypass encapsulation. Copying
the bit would not make kTLS work either: only the first fragment has
the TCP header needed for encryption.
Reject marked skbs before IPv4 or IPv6 builds fragments. In IPv6,
keep the existing Packet Too Big checks ahead of the new guard.
Found by manual inspection. On two mlx5 hosts with TLS 1.2 AES-GCM-128,
IPv4 FragCreates increased by 50 on the NIC and 26 on a macvlan
without the fix, and by zero on both with it. The IPv6 test still got
Packet Too Big. PSP and the remaining IPv6 paths were inspected only.
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Fixes: 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")
Cc: stable@vger.kernel.org
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
net/ipv4/ip_output.c | 8 ++++++++
net/ipv6/ip6_output.c | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d42d776af273..36ae3d08742a 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -770,6 +770,14 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
struct ip_frag_state state;
int err = 0;
+ /* Still needs kTLS encryption or PSP encapsulation, which neither
+ * tls_sw_fallback() nor the NIC can apply to fragments.
+ */
+ if (unlikely(skb_is_decrypted(skb))) {
+ err = -EMSGSIZE;
+ goto fail;
+ }
+
/* for offloaded checksums cleanup checksum before fragmentation */
if (skb->ip_summed == CHECKSUM_PARTIAL) {
err = ip_check_csum_start(skb);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5887e537f662..637a3d23c4c2 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -937,6 +937,15 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
}
if (mtu < hlen + sizeof(struct frag_hdr) + 8)
goto fail_toobig;
+
+ /* Still needs kTLS encryption or PSP encapsulation, which neither
+ * tls_sw_fallback() nor the NIC can apply to fragments. Checked only
+ * now, so that an oversized skb still gets its Packet Too Big above.
+ */
+ if (unlikely(skb_is_decrypted(skb))) {
+ err = -EMSGSIZE;
+ goto fail;
+ }
mtu -= hlen + sizeof(struct frag_hdr);
frag_id = ipv6_select_ident(net, &ipv6_hdr(skb)->daddr,
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
` (6 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, stable, John Fastabend, Jakub Kicinski,
Sabrina Dubroca, David S. Miller, Eric Dumazet, Paolo Abeni,
Willem de Bruijn, Simon Horman, Alice Mikityanska, Tariq Toukan
After the TLS device goes down, TX validation can run the software
fallback at both the bond and its slave. The second pass encrypts
ciphertext with the same keystream and can expose plaintext.
Pass unmarked skbs through tls_sw_fallback() and clear skb->decrypted
on its output. Backport the preceding fragmentation fix first:
otherwise fragments of offload plaintext can also arrive unmarked.
Found by manual inspection. On two mlx5 hosts with TLS 1.2 AES-GCM-128,
both the idle and in-flight bond bounce tests returned a mismatched
echo without the fix and passed with it.
Fixes: c55dcdd435aa ("net/tls: Fix use-after-free after the TLS device goes down and up")
Cc: <stable@vger.kernel.org> # 5.10.x: fc6d80eb5044: tcp: prevent collapsing skbs across boundary in rtx queue
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
net/tls/tls_device_fallback.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
index b547027cc879..42afbe7e60b5 100644
--- a/net/tls/tls_device_fallback.c
+++ b/net/tls/tls_device_fallback.c
@@ -192,6 +192,9 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)
skb->destructor = NULL;
skb->sk = NULL;
+ /* Ciphertext now: don't encrypt it again */
+ nskb->decrypted = 0;
+
update_chksum(nskb, headln);
/* sock_efree means skb must gone through skb_orphan_partial() */
@@ -371,6 +374,10 @@ static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
s32 sync_size = 0;
u64 rcd_sn;
+ /* Pre-offload data or tls_sw_fallback() output */
+ if (!skb_is_decrypted(skb))
+ return skb;
+
/* worst case is:
* MAX_SKB_FRAGS in tls_record_info
* MAX_SKB_FRAGS + 1 in SKB head and frags.
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
` (5 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, stable, John Fastabend, Jakub Kicinski,
Sabrina Dubroca, David S. Miller, Eric Dumazet, Paolo Abeni,
Willem de Bruijn, Simon Horman, Ilya Lesokhin, Aviad Yehezkel,
Boris Pismenny
Software fallback output still belongs to the offloaded socket. A
driver that checks only the socket can therefore encrypt ciphertext
again, exposing plaintext.
Require skb_is_decrypted() in tls_is_skb_tx_device_offloaded().
Fallback output then takes the ordinary TX path, as does data queued
before TLS_TX was enabled. Backport the first three fixes together,
in order.
Found by manual inspection. On two mlx5 hosts with TLS 1.2 AES-GCM-128,
the macvlan reroute test returned a mismatched echo without the fix
and passed with it. The other drivers were checked by inspection only.
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Cc: stable@vger.kernel.org
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
include/net/tls.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/tls.h b/include/net/tls.h
index 0b001b8ab1c3..9998b5582091 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -365,7 +365,8 @@ static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb)
return sk && sk_fullsock(sk) &&
(smp_load_acquire(&sk->sk_validate_xmit_skb) ==
- &tls_validate_xmit_skb);
+ &tls_validate_xmit_skb) &&
+ skb_is_decrypted(skb);
#else
return false;
#endif
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (2 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, John Fastabend, Jakub Kicinski,
Sabrina Dubroca, David S. Miller, Eric Dumazet, Paolo Abeni,
Willem de Bruijn, Simon Horman
Pre-offload skbs now bypass tls_sw_fallback() before record lookup,
and TCP does not merge them with marked data across the start marker.
Remove the unreachable bypass and its special case in fill_sg_in().
Keep the marker itself: record lookup and ACK cleanup still count it.
No functional change.
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
net/tls/tls_device_fallback.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
index 42afbe7e60b5..da875fdf5b54 100644
--- a/net/tls/tls_device_fallback.c
+++ b/net/tls/tls_device_fallback.c
@@ -237,8 +237,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
*sync_size = tcp_seq - tls_record_start_seq(record);
if (*sync_size < 0) {
- int is_start_marker = tls_record_is_start_marker(record);
-
spin_unlock_irqrestore(&ctx->lock, flags);
/* This should only occur if the relevant record was
* already acked. In that case it should be ok
@@ -250,8 +248,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
* on TCP to retransmit a packet that doesn't contain
* already acked payload.
*/
- if (!is_start_marker)
- *sync_size = 0;
return -EINVAL;
}
@@ -394,12 +390,9 @@ static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
sg_init_table(sg_in, sg_in_max_elements);
sg_init_table(sg_out, ARRAY_SIZE(sg_out));
- if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs)) {
- /* bypass packets before kernel TLS socket option was set */
- if (sync_size < 0 && payload_len <= -sync_size)
- nskb = skb_get(skb);
+ /* Its record was acked and freed: drop it */
+ if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs))
goto put_sg;
- }
nskb = tls_enc_skb(tls_ctx, sg_out, sg_in, skb, sync_size, rcd_sn);
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (3 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
` (3 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Willem de Bruijn, Simon Horman, Shuah Khan,
Stanislav Fomichev, Joe Damato, linux-kselftest
A readiness timeout leaves the command running with its pipes open.
Killing only the command can also leave a wrapper's workers behind.
Give readiness-enabled commands their own process group. Kill the
group on timeout; on readiness EOF, allow one second after SIGTERM
before escalating. Drain output, but bound the wait: a worker can
keep a pipe open after its parent exits. Keep the wait FD open until
teardown is complete so EOF does not resume a paused helper.
Clean up the group on interruption without masking the original
exception. Use poll() so readiness also works above FD_SETSIZE.
Found while developing the TLS bond tests. Tested locally with
TERM-ignoring workers, inherited pipes, large output, high-numbered
FDs and Ctrl-C during readiness and teardown.
Fixes: 71477137994f ("selftests: drv-net: add a way to wait for a local process")
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
tools/testing/selftests/net/lib/py/utils.py | 246 ++++++++++++++++++--
1 file changed, 231 insertions(+), 15 deletions(-)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 1727bc418073..9edfc4f88621 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -1,9 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
+import contextlib
import json as _json
+import math
import os
import re
import select
+import signal
import socket
import subprocess
import time
@@ -27,9 +30,28 @@ class CmdExitZeroFailure(CmdExitFailure):
""" Command succeeded (returned zero exit code), but expected failure. """
+def _poll_timeout_ms(timeout):
+ """Convert a timeout in seconds to poll()'s milliseconds.
+
+ None waits forever. poll() takes a negative timeout as forever too,
+ where select() raised, and overflows past INT_MAX milliseconds: refuse
+ both. Also lets cmd() check a timeout before spawning its command.
+ """
+ if timeout is None:
+ return None
+ if (not 0 <= timeout or not math.isfinite(timeout) or
+ math.ceil(timeout * 1000) > 2**31 - 1):
+ raise ValueError(f"timeout must be between 0 and "
+ f"{(2**31 - 1) / 1000}s, not {timeout}")
+ return timeout * 1000
+
+
def fd_read_timeout(fd, timeout):
- rlist, _, _ = select.select([fd], [], [], timeout)
- if rlist:
+ timeout_ms = _poll_timeout_ms(timeout)
+ # poll(), not select(): select() rejects FDs >= FD_SETSIZE.
+ poller = select.poll()
+ poller.register(fd, select.POLLIN)
+ if poller.poll(timeout_ms):
return os.read(fd, 1024)
raise TimeoutError("Timeout waiting for fd read")
@@ -58,6 +80,7 @@ class cmd:
self.stderr = None
self.ret = None
self.ksft_term_fd = None
+ self._own_pgrp = False
self.host = host
self.comm = comm
@@ -74,6 +97,8 @@ class cmd:
# Similarly term_fd tells child it's time to exit.
pass_fds = []
env = os.environ.copy()
+ # Before spawning: fd_read_timeout() would refuse it only after.
+ _poll_timeout_ms(ksft_wait)
if ksft_wait is not None:
wait_fd, self.ksft_term_fd = os.pipe()
pass_fds.append(wait_fd)
@@ -84,26 +109,207 @@ class cmd:
pass_fds.append(ready_fd)
env["KSFT_READY_FD"] = str(ready_fd)
+ # A command that reports ready leads its own process group, so
+ # that _reap_unready() and _kill_leftovers() can stop what it
+ # started too. Terminal signals then no longer reach it: on
+ # Ctrl-C, KeyboardInterrupt here leads to the same cleanup.
+ self._own_pgrp = ksft_ready is not None
self.proc = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, pass_fds=pass_fds,
- env=env)
+ env=env,
+ start_new_session=self._own_pgrp)
if ksft_wait is not None:
os.close(wait_fd)
if ksft_ready is not None:
os.close(ready_fd)
- msg = fd_read_timeout(rfd, ksft_wait)
- os.close(rfd)
+ timed_out = False
+ try:
+ msg = fd_read_timeout(rfd, ksft_wait)
+ except TimeoutError:
+ msg = None
+ timed_out = True
+ except BaseException:
+ # Interrupted: stop the command, then let the
+ # interruption, not any cleanup failure, propagate.
+ self._cleanup_quietly(self._reap_unready, kill=True)
+ raise
+ finally:
+ os.close(rfd)
if not msg:
- terminate = self.proc.poll() is None
- self._process_terminate(terminate=terminate, timeout=1)
+ self._reap_unready(kill=timed_out)
raise CmdInitFailure("Did not receive ready message", self)
if not background:
self.process(terminate=False, fail=fail, expect_fail=expect_fail,
timeout=timeout)
+ def _drain_until_exit(self, bufs, timeout):
+ """Read the command's output into bufs until it exits.
+
+ Reading keeps a command that writes while shutting down from
+ blocking on a full pipe. Returns False if the command is still
+ running after timeout seconds.
+ """
+ fds = {self.proc.stdout.fileno(): bufs[0],
+ self.proc.stderr.fileno(): bufs[1]}
+ poller = select.poll()
+ for fd in fds:
+ poller.register(fd, select.POLLIN)
+ deadline = time.monotonic() + timeout
+ while self.proc.poll() is None:
+ left = deadline - time.monotonic()
+ if left <= 0:
+ return False
+ if not fds:
+ # Both pipes are at EOF: nothing left to drain.
+ try:
+ self.proc.wait(timeout=left)
+ except subprocess.TimeoutExpired:
+ return False
+ break
+ # Poll the exit status at least every 100ms: descendants can
+ # keep the pipes open, and quiet, after the command exits.
+ for fd, _ in poller.poll(min(left, 0.1) * 1000):
+ data = os.read(fd, 65536)
+ if data:
+ fds[fd].append(data)
+ else:
+ poller.unregister(fd)
+ del fds[fd]
+ return True
+
+ def _cleanup_quietly(self, func, *args, **kwargs):
+ """Run a cleanup step while an exception is propagating.
+
+ Report a failure instead of raising it, which would replace that
+ exception. A second interruption still propagates.
+ """
+ try:
+ func(*args, **kwargs)
+ except Exception as e:
+ print(f"# Warning: cleanup of {self.comm!r} failed: "
+ f"{type(e).__name__}: {e}")
+
+ @contextlib.contextmanager
+ def _killed_on_interrupt(self):
+ """Guard a wait for the command to exit.
+
+ If the wait ends in an exception, KeyboardInterrupt say, SIGKILL
+ the process group the command leads: terminal signals do not reach
+ it, so it and what it started would run on. The exception stays
+ the one raised.
+ """
+ try:
+ yield
+ except BaseException:
+ self._cleanup_quietly(self._kill_leftovers)
+ raise
+
+ def _kill_leftovers(self):
+ """SIGKILL what is left of the process group the command leads."""
+ if not self._own_pgrp:
+ return
+ self._kill_group(signal.SIGKILL)
+ if self.proc.returncode is None:
+ try:
+ self.proc.wait(timeout=1)
+ except subprocess.TimeoutExpired:
+ pass
+ self.proc.stdout.close()
+ self.proc.stderr.close()
+ # Only now: EOF on the ksft_wait pipe lets a command go on.
+ if self.ksft_term_fd:
+ os.close(self.ksft_term_fd)
+ self.ksft_term_fd = None
+
+ def _kill_group(self, sig):
+ """Signal the process group the command leads.
+
+ The group outlives the command while any of its descendants are
+ left in it, so this reaches them after the command is reaped too.
+ """
+ try:
+ os.killpg(self.proc.pid, sig)
+ except ProcessLookupError:
+ pass
+
+ def _reap_unready(self, kill):
+ """Stop and reap a local command that did not report ready.
+
+ A command that closed the ready FD gets SIGTERM, as before, and a
+ grace period to exit, with its output drained meanwhile. One that
+ never answered gets SIGKILL, since it may ignore SIGTERM, as does
+ one still running after the grace period. The signals go to the
+ command's whole process group, and whatever is left of the group
+ once the command is gone gets SIGKILL, so that a wrapper's workers
+ do not outlive it. Wait for the command itself rather than for EOF
+ on its output: a shell's descendants can keep its stdout/stderr
+ pipes open after it exits, so take only the output that is there.
+
+ Close the ksft_wait pipe only once all that is done: ksft_wait()
+ takes EOF on it as leave to go on, so closing it first lets a
+ command that is still running resume.
+ """
+ out, err = [], []
+ with self._killed_on_interrupt():
+ if self.proc.poll() is None:
+ self._kill_group(signal.SIGKILL if kill else signal.SIGTERM)
+ self._drain_until_exit((out, err), timeout=1)
+ self._collect_reaped(out, err)
+
+ def _reap_cancelled(self, terminate, timeout):
+ """Stop and reap a local command whose bkg() was cancelled.
+
+ Ask the command to exit as a normal exit would, through the
+ ksft_wait pipe or with SIGTERM to its group, and wait for it, not
+ for EOF: what it started may hold its pipes open. Then SIGKILL the
+ rest of its group, as _reap_unready() does.
+ """
+ if self.ksft_term_fd:
+ try:
+ os.write(self.ksft_term_fd, b"1")
+ except BrokenPipeError:
+ pass
+ out, err = [], []
+ with self._killed_on_interrupt():
+ if self.proc.poll() is None:
+ if terminate:
+ self._kill_group(signal.SIGTERM)
+ self._drain_until_exit((out, err), timeout=timeout)
+ self._collect_reaped(out, err)
+
+ def _collect_reaped(self, out, err):
+ """SIGKILL the command's group, reap it and keep its output.
+
+ out and err hold output drained so far.
+ """
+ self._kill_group(signal.SIGKILL)
+ # A command stuck in the kernel does not die even then: give up
+ # on it rather than hang, leaving ret unset.
+ try:
+ self.proc.wait(timeout=1)
+ except subprocess.TimeoutExpired:
+ pass
+ try:
+ stdout, stderr = self.proc.communicate(timeout=1)
+ except subprocess.TimeoutExpired as e:
+ stdout, stderr = e.stdout or b"", e.stderr or b""
+ stdout = b"".join(out) + stdout
+ stderr = b"".join(err) + stderr
+ self.stdout = stdout.decode("utf-8", "replace")
+ self.stderr = stderr.decode("utf-8", "replace")
+ self.proc.stdout.close()
+ self.proc.stderr.close()
+ self.ret = self.proc.returncode
+ if self.ksft_term_fd:
+ os.close(self.ksft_term_fd)
+ self.ksft_term_fd = None
+
def _process_terminate(self, terminate, timeout):
if terminate:
- self.proc.terminate()
+ if self._own_pgrp:
+ self._kill_group(signal.SIGTERM)
+ else:
+ self.proc.terminate()
stdout, stderr = self.proc.communicate(timeout=timeout)
self.stdout = stdout.decode("utf-8")
self.stderr = stderr.decode("utf-8")
@@ -117,11 +323,11 @@ class cmd:
if fail is None:
fail = not terminate
- if self.ksft_term_fd:
- os.write(self.ksft_term_fd, b"1")
-
- stdout, stderr = self._process_terminate(terminate=terminate,
- timeout=timeout)
+ with self._killed_on_interrupt():
+ if self.ksft_term_fd:
+ os.write(self.ksft_term_fd, b"1")
+ stdout, stderr = self._process_terminate(terminate=terminate,
+ timeout=timeout)
# Fail on unexpected test failure if fail.
# Fail on unexpected test success if expect_fail.
@@ -202,8 +408,18 @@ class bkg(cmd):
# since forcing termination silences failures with fail=None
if self.proc.poll() is None:
terminate = terminate or (self._exit_wait and ex_type is not None)
- return self.process(terminate=terminate, fail=self.check_fail,
- expect_fail=self.expect_fail)
+ if ex_type is None:
+ return self.process(terminate=terminate, fail=self.check_fail,
+ expect_fail=self.expect_fail)
+ # Cancelled, e.g. by Ctrl-C: stop the command and what it started,
+ # without replacing the exception in flight.
+ if self._own_pgrp:
+ self._cleanup_quietly(self._reap_cancelled, terminate, 20)
+ else:
+ self._cleanup_quietly(self.process, terminate=terminate,
+ fail=self.check_fail,
+ expect_fail=self.expect_fail)
+ return None
GLOBAL_DEFER_QUEUE = []
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg()
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (4 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
` (2 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Willem de Bruijn, Simon Horman, Shuah Khan,
linux-kselftest
Let callers override the 20-second context-exit timeout for
long-running commands. None waits indefinitely on normal exit, but
gives a readiness-enabled command one second to exit on cancellation.
An explicit zero still means no grace period.
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
tools/testing/selftests/net/lib/py/utils.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 9edfc4f88621..1db7a21db642 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -274,7 +274,11 @@ class cmd:
if self.proc.poll() is None:
if terminate:
self._kill_group(signal.SIGTERM)
- self._drain_until_exit((out, err), timeout=timeout)
+ # None waits forever elsewhere; cleanup must end. Not
+ # "timeout or 1", which would change an explicit 0.
+ self._drain_until_exit((out, err),
+ timeout=1 if timeout is None
+ else timeout)
self._collect_reaped(out, err)
def _collect_reaped(self, out, err):
@@ -385,11 +389,12 @@ class bkg(cmd):
"""
def __init__(self, comm, shell=None, fail=None, expect_fail=None,
ns=None, host=None, exit_wait=False, ksft_ready=None,
- ksft_wait=None):
+ ksft_wait=None, timeout=20):
super().__init__(comm, background=True,
shell=shell, fail=fail, expect_fail=expect_fail,
ns=ns, host=host, ksft_ready=ksft_ready,
ksft_wait=ksft_wait)
+ self.timeout = timeout
self.terminate = not exit_wait and not ksft_wait
self._exit_wait = exit_wait
self.check_fail = fail
@@ -410,15 +415,18 @@ class bkg(cmd):
terminate = terminate or (self._exit_wait and ex_type is not None)
if ex_type is None:
return self.process(terminate=terminate, fail=self.check_fail,
- expect_fail=self.expect_fail)
+ expect_fail=self.expect_fail,
+ timeout=self.timeout)
# Cancelled, e.g. by Ctrl-C: stop the command and what it started,
# without replacing the exception in flight.
if self._own_pgrp:
- self._cleanup_quietly(self._reap_cancelled, terminate, 20)
+ self._cleanup_quietly(self._reap_cancelled, terminate,
+ self.timeout)
else:
self._cleanup_quietly(self.process, terminate=terminate,
fail=self.check_fail,
- expect_fail=self.expect_fail)
+ expect_fail=self.expect_fail,
+ timeout=self.timeout)
return None
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (5 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, John Fastabend,
Sabrina Dubroca, linux-kselftest
Run the kTLS echo test over a single-slave balance-xor bond with
layer3+4 hashing. First verify that the slave offloads TLS. Then take
the slave down midway through an echo to exercise TX software fallback.
Cover two cases: bring the slave back before the client resumes, or
resume the client with the slave down and wait for a retransmission
timeout before bringing it back. Without the fix, the fallback
encrypts the same data at both the bond and the slave, and the echoed
data differs from what the client sent in both cases.
Skip configurations the test cannot safely restore. On cleanup,
restore the NIC's addresses and verify that its original routes are back
Both bounce cases fail without "tls: device: keep tls_sw_fallback()
from encrypting its own output".
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
tools/testing/selftests/drivers/net/hw/config | 1 +
.../selftests/drivers/net/hw/tls_hw_offload.c | 57 +-
.../drivers/net/hw/tls_hw_offload.py | 499 +++++++++++++++++-
3 files changed, 543 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/config b/tools/testing/selftests/drivers/net/hw/config
index 081155bf7847..ee658188670a 100644
--- a/tools/testing/selftests/drivers/net/hw/config
+++ b/tools/testing/selftests/drivers/net/hw/config
@@ -1,3 +1,4 @@
+CONFIG_BONDING=y
CONFIG_BPF_SYSCALL=y
CONFIG_FAIL_FUNCTION=y
CONFIG_FAULT_INJECTION=y
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 5b3887f32b68..9c1c546d36cf 100644
--- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
+++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
@@ -24,6 +24,8 @@
#include <netdb.h>
#include <linux/tls.h>
+#include "../../../net/lib/ksft.h"
+
#ifndef SOL_TLS
#define SOL_TLS 282
#endif
@@ -82,13 +84,19 @@ static int random_size_max;
*/
static int verbose;
-/* Upper bound on a helper's lifetime, enforced by SIGALRM. The harness
- * waits for both helpers with the default 20s cmd()/bkg() timeout and
- * cannot signal the one on the remote, so each must exit on its own first.
- * A normal run takes a few seconds; the socket timeouts catch most stalls
- * sooner and with a better error.
+/* -P: pause the client halfway until the harness releases it. */
+static int pause_mid;
+
+/* Upper bound on a helper's lifetime, enforced by SIGALRM. On a timeout
+ * the harness can only kill the ssh client of the remote helper, not the
+ * helper itself, so each must exit on its own first. A normal run takes a
+ * few seconds; the socket timeouts catch most stalls sooner and with a
+ * better error. -T raises both, keeping the lifetime above the I/O timeout.
*/
#define HELPER_TIMEOUT_S 15
+#define IO_TIMEOUT_S 8
+static int io_timeout_s = IO_TIMEOUT_S;
+static int helper_timeout_s = HELPER_TIMEOUT_S;
static const char *cipher_name(int cipher)
{
@@ -152,7 +160,7 @@ static void configure_echo_socket(int fd, int payload)
*/
static void set_io_timeouts(int fd)
{
- struct timeval tv = { .tv_sec = 8, .tv_usec = 0 };
+ struct timeval tv = { .tv_sec = io_timeout_s, .tv_usec = 0 };
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
@@ -388,6 +396,13 @@ static int do_client(void)
printf("Sent %zd bytes (iteration %d)\n", n, i);
if (client_recv_echo(csk, buf, echo_buf, n) < 0)
goto out;
+
+ if (pause_mid && i == num_iterations / 2) {
+ printf("Pausing after iteration %d\n", i);
+ ksft_ready();
+ ksft_wait();
+ printf("Resumed\n");
+ }
}
test_result = 0;
@@ -751,6 +766,10 @@ static void print_usage(const char *prog)
printf(" -c <cipher> Cipher: 128 or 256 (default: 128)\n");
printf(" -n <N> Send/echo iterations (default: 100)\n");
printf(" -t <type> Record type test: 21=alert, 22=handshake\n");
+ printf(" -P Pause halfway (client): ksft_ready(), ksft_wait()\n");
+ printf(" -T <sec> Send/recv timeout (default: %d); lifetime bound\n"
+ " becomes 2 * <sec> + 15 (default: %d)\n",
+ IO_TIMEOUT_S, HELPER_TIMEOUT_S);
printf(" -V Verbose: log every iteration\n");
printf(" -h Show this help message\n");
printf("\nExample:\n");
@@ -779,7 +798,6 @@ int main(int argc, char *argv[])
* is not lost in the stdio buffer.
*/
setvbuf(stdout, NULL, _IOLBF, 0);
- alarm(HELPER_TIMEOUT_S);
if (argc < 2 ||
(strcmp(argv[1], "server") && strcmp(argv[1], "client"))) {
@@ -789,7 +807,7 @@ int main(int argc, char *argv[])
is_server = !strcmp(argv[1], "server");
optind = 2; /* skip subcommand */
- while ((opt = getopt(argc, argv, "s:p:b:r:c:v:n:t:V46h")) != -1) {
+ while ((opt = getopt(argc, argv, "s:p:b:r:c:v:n:t:T:PV46h")) != -1) {
switch (opt) {
case 's':
server_ip = optarg;
@@ -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;
case '4':
if (force_family == AF_INET6) {
printf("ERROR: -4 and -6 are exclusive\n");
@@ -865,6 +894,11 @@ int main(int argc, char *argv[])
return 1;
}
+ if (pause_mid && (test_record_type || num_iterations < 2)) {
+ printf("ERROR: -P needs echo mode and -n >= 2\n");
+ return 1;
+ }
+
if (test_record_type && random_size_max) {
printf("ERROR: -t cannot be combined with -r\n");
return 1;
@@ -879,6 +913,10 @@ int main(int argc, char *argv[])
printf("warning: -r is ignored in server mode\n");
random_size_max = 0;
}
+ if (pause_mid) {
+ printf("warning: -P is ignored in server mode\n");
+ pause_mid = 0;
+ }
} else {
if (!server_ip) {
printf("ERROR: Client requires -s <ip> option\n");
@@ -886,6 +924,9 @@ int main(int argc, char *argv[])
}
}
+ /* After option parsing, so -T applies */
+ alarm(helper_timeout_s);
+
printf("TLS Version: %s\n", version_name(tls_version));
printf("Cipher: %s\n", cipher_name(cipher_type));
printf("Address family: %s\n",
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 e720ce654761..7d90f1c2024a 100755
--- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
+++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
@@ -3,15 +3,27 @@
"""Test kTLS hardware offload using a C helper binary."""
+import ipaddress
+import json
+import os
+import socket
+import struct
+import sys
+import tempfile
+import time
from collections import defaultdict
from lib.py import (
CmdExitFailure,
+ KsftFailEx,
KsftNamedVariant,
KsftSkipEx,
NetDrvEpEnv,
bkg,
cmd,
+ defer,
+ ip,
+ ksft_disruptive,
ksft_eq,
ksft_exit,
ksft_ge,
@@ -19,9 +31,18 @@ from lib.py import (
ksft_run,
ksft_variants,
rand_port,
+ wait_file,
wait_port_listen,
)
+BOND_IFNAME = "tlsbond0"
+
+# -T for -P cases, long enough for a bounced NIC to retrain.
+PAUSE_IO_TIMEOUT_S = 45
+# bounce_inflight(): outage once the client has sent, and wait for that.
+INFLIGHT_OUTAGE_S = 2
+INFLIGHT_SEND_WAIT_S = 10
+
# `ethtool -S` counters on the DUT NIC, from the minimum set every TLS
# offload driver should report (Documentation/networking/tls-offload.rst,
# "Statistics"). Drivers expose varying subsets: mlx5 has all four, nfp
@@ -198,7 +219,7 @@ def verify_tls_counters(stats_before, stats_after, is_dut, hw_directions=()):
def run_tls_test(cfg, cipher="128", tls_version="1.2",
buffer_size=None, random_max=None, ipver="4",
- record_type=None):
+ record_type=None, pause=None):
"""Run the TLS offload test.
The DUT runs the TLS client and the remote runs the echo server.
@@ -213,6 +234,10 @@ def run_tls_test(cfg, cipher="128", tls_version="1.2",
kTLS because TLS is pairwise, but verify_tls_counters() requires HW
offload only in enabled DUT directions. The peer and the DUT's other
direction may use SW kTLS.
+
+ pause: if set, the client stops halfway, pause(cfg, port) runs, and
+ the client resumes once it returns. pause() may return a bkg()
+ handle for work that outlives it, reaped after the echo.
"""
require_tls_setup(cfg)
@@ -228,8 +253,13 @@ def run_tls_test(cfg, cipher="128", tls_version="1.2",
port = rand_port()
send_size = random_max or buffer_size
+ io_opt = f"-T {PAUSE_IO_TIMEOUT_S}"
+ budget = {"timeout": 2 * PAUSE_IO_TIMEOUT_S + 30} if pause else {}
+
server_parts = [f"{cfg.bin_remote} server -p {port} -c {cipher}",
f"-v {tls_version}", f"-{ipver}"]
+ if pause:
+ server_parts.append(io_opt)
if send_size:
server_parts.append(f"-b {send_size}")
if record_type:
@@ -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)
@@ -305,6 +357,439 @@ def test_tls_offload_record_type(cfg, record_type):
run_tls_test(cfg, record_type=record_type)
+def wait_carrier(ifname, deadline=30):
+ """Wait for carrier, which can take a NIC well over wait_file()'s
+ default 5s after a flap.
+ """
+ wait_file(f"/sys/class/net/{ifname}/carrier",
+ lambda x: x.strip() == "1", deadline=deadline)
+
+
+def wait_reachable(ifname, peer, deadline=30):
+ """Wait until the peer answers through ifname.
+
+ The peer can lag carrier after a flap; fail here rather than with an
+ opaque connect() error in the helper.
+ """
+ family = "-6" if ":" in peer else "-4"
+ end = time.monotonic() + deadline
+ while cmd(f"ping {family} -c1 -W1 -I {ifname} {peer}",
+ fail=False).ret != 0:
+ if time.monotonic() > end:
+ raise KsftFailEx(f"{peer} unreachable through {ifname}")
+ time.sleep(0.5)
+
+
+def save_nic(ifname):
+ """Dump the NIC's global addresses and its routes in all tables.
+
+ Skip the IPv6 local table, which the restored addresses and addrconf
+ recreate: require_restorable() refuses NICs with other routes there,
+ and restore_nic() checks that they came back.
+ """
+ saved = tempfile.TemporaryDirectory()
+ cmd(f"ip addr save dev {ifname} scope global > {saved.name}/addr",
+ shell=True)
+ cmd(f"ip -4 route save dev {ifname} table all > {saved.name}/route4",
+ shell=True)
+ tables = {r.get("table", "main") for r in
+ ip(f"-6 route show dev {ifname} table all", json=True)}
+ for table in sorted(tables - {"local"}):
+ cmd(f"ip -6 route save dev {ifname} table {table} "
+ f"> {saved.name}/route6-{table}", shell=True)
+ return saved
+
+
+# Route attributes that change on their own: flags follow the carrier
+# (linkdown), and expires counts down.
+ROUTE_VOLATILE = ("flags", "expires")
+
+
+def route_keys(ifname):
+ """The NIC's routes as save_nic() dumps them, for comparison."""
+ keys = set()
+ for family in ("-4", "-6"):
+ for r in ip(f"{family} route show dev {ifname} table all",
+ json=True):
+ if family == "-6" and r.get("table") == "local":
+ continue
+ attrs = {k: v for k, v in r.items() if k not in ROUTE_VOLATILE}
+ keys.add((family, json.dumps(attrs, sort_keys=True)))
+ return keys
+
+
+def local6_routes(ifname):
+ """The NIC's IPv6 local table routes, with the attributes that identify
+ them: all but empty flags. Unlike in route_keys(), an expiry or a flag
+ counts: addrconf's routes have neither, so such a route would not come
+ back as it was. -d, as iproute2 omits "proto boot" otherwise.
+ """
+ return [{k: v for k, v in r.items() if k != "flags" or v}
+ for r in ip(f"-d -6 route show dev {ifname} table local",
+ json=True)]
+
+
+def local6_keys(ifname):
+ """local6_routes() in comparable form."""
+ return {json.dumps(r, sort_keys=True) for r in local6_routes(ifname)}
+
+
+def wait_local6(ifname, local6, deadline=10):
+ """Fail unless the IPv6 local routes saved by setup_bond() come back.
+
+ addrconf adds an address's route only once its DAD completes.
+ """
+ end = time.monotonic() + deadline
+ while True:
+ missing = local6 - local6_keys(ifname)
+ if not missing:
+ return
+ if time.monotonic() > end:
+ raise KsftFailEx(f"{len(missing)} IPv6 local routes of {ifname} "
+ f"missing after restore: "
+ + "; ".join(sorted(missing)))
+ time.sleep(0.5)
+
+
+def check_routes(ifname, routes, when):
+ """Fail if any of the routes saved by setup_bond() is missing."""
+ missing = routes - route_keys(ifname)
+ if missing:
+ link = ip(f"link show dev {ifname}", json=True)[0]
+ raise KsftFailEx(f"{len(missing)} routes of {ifname} missing "
+ f"{when} (flags {link['flags']}, operstate "
+ f"{link['operstate']}): "
+ + "; ".join(f"{family} {attrs}"
+ for family, attrs in sorted(missing)))
+
+
+def count_routes(ifname):
+ """Number of IPv4 and IPv6 routes on ifname, in all tables."""
+ return sum(len(ip(f"{family} route show dev {ifname} table all",
+ json=True))
+ for family in ("-4", "-6"))
+
+
+def restore_routes(ifname, dumps):
+ """Replay route dumps until all of them apply.
+
+ "ip route restore" stops at the first failing route, e.g. one whose
+ gateway's route comes later, so replay while each round adds routes.
+ """
+ routes = count_routes(ifname)
+ while True:
+ failed = [dump for dump in dumps
+ if cmd(f"ip route restore < {dump}", shell=True,
+ fail=False).ret]
+ if not failed:
+ return
+ prev, routes = routes, count_routes(ifname)
+ if routes == prev:
+ raise KsftFailEx(f"Could not restore the routes of {ifname} "
+ f"from {failed}")
+
+
+def restore_nic(cfg, saved, routes, local6):
+ """Bring the NIC back up as a standalone link with its configuration.
+
+ Check the routes after the replay and again after carrier, to tell a
+ failed replay from routes the kernel removed later, and the IPv6
+ local routes, which addrconf recreates, once there is carrier.
+ """
+ try:
+ ip(f"link set dev {cfg.ifname} up")
+ cmd(f"ip addr restore < {saved.name}/addr", shell=True)
+ restore_routes(cfg.ifname,
+ [f"{saved.name}/{dump}"
+ for dump in sorted(os.listdir(saved.name))
+ if dump.startswith("route")])
+ finally:
+ saved.cleanup()
+ check_routes(cfg.ifname, routes, "after the replay")
+ # Best effort: the next case waits for carrier itself.
+ try:
+ wait_carrier(cfg.ifname, deadline=10)
+ except TimeoutError:
+ ksft_pr(f"NOTE: {cfg.ifname} still without carrier, "
+ f"leaving it to the next case to wait for, and not "
+ f"checking its IPv6 local routes, which need DAD")
+ else:
+ wait_local6(cfg.ifname, local6)
+ check_routes(cfg.ifname, routes, "after waiting for carrier")
+
+
+def eui64_link_local(mac):
+ """The link-local address addrconf derives from mac (addr_gen_mode 0)."""
+ b = bytes.fromhex(mac.replace(":", ""))
+ iid = bytes([b[0] ^ 2]) + b[1:3] + b"\xff\xfe" + b[3:6]
+ return ipaddress.IPv6Address(b"\xfe\x80" + bytes(6) + iid)
+
+
+def normalize_local6(route):
+ """route with its destination as an IPv6 network, so that a host
+ address printed without /128 compares equal. Anything else, such as
+ "default", is left as printed.
+ """
+ try:
+ dst = str(ipaddress.IPv6Network(route["dst"]))
+ except ValueError:
+ return route
+ return {**route, "dst": dst}
+
+
+def require_ipv6_recreated(ifname):
+ """Skip unless the NIC's IPv6 addresses and local routes come back.
+
+ Taking the NIC down removes its IPv6 addresses and its IPv6 local
+ table, which save_nic() leaves out. Only the global addresses are
+ restored; addrconf adds the EUI-64 link-local address again in
+ addr_gen_mode 0, as the MAC is unchanged. Of the local table, allow
+ only the routes those recreate, as wait_local6() expects them back,
+ compared whole: any other route, or one of those with an attribute
+ addrconf does not set (another metric, a metrics entry, ...), would
+ be lost, so skip. This includes anycast routes and NICs without IPv6
+ addresses, whose local table can still hold routes.
+ """
+ link = ip(f"addr show dev {ifname}", json=True)[0]
+ v6 = [a for a in link["addr_info"] if a["family"] == "inet6"]
+ auto_ll = None
+ mode = f"/proc/sys/net/ipv6/conf/{ifname}/addr_gen_mode"
+ if os.path.exists(mode):
+ with open(mode, encoding="ascii") as f:
+ if f.read().strip() == "0":
+ auto_ll = eui64_link_local(link["address"])
+ kept = set()
+ for a in v6:
+ addr = ipaddress.IPv6Address(a["local"])
+ if a.get("scope") != "global" and addr != auto_ll:
+ raise KsftSkipEx(f"IPv6 address {addr} on {ifname} would be "
+ f"lost: taking {ifname} down removes it, and "
+ f"only global addresses are restored")
+ kept.add(addr)
+ # The routes addrconf adds, as local6_routes() shows them.
+ common = {"protocol": "kernel", "scope": "global", "pref": "medium"}
+ allowed = [{**common, "type": "local", "dst": f"{addr}/128",
+ "metric": 0} for addr in kept]
+ allowed.append({**common, "type": "multicast", "dst": "ff00::/8",
+ "metric": 256})
+ for r in local6_routes(ifname):
+ if normalize_local6(r) in allowed:
+ continue
+ raise KsftSkipEx(f"IPv6 local table route of {ifname} would not "
+ f"come back after taking {ifname} down: "
+ f"{json.dumps(r, sort_keys=True)}")
+
+
+def require_restorable(ifname, addrs):
+ """Skip if moving the NIC into the bond would lose state that
+ restore_nic() does not put back.
+
+ Flushing the addresses deletes IPv4 routes, and strips the source of
+ IPv6 routes, that prefer one of them as source, also through other
+ devices. Taking the NIC down deletes multipath routes through it,
+ which save_nic()'s per-device dumps miss, flushes its permanent and
+ proxy neighbour entries, and removes its IPv6 addresses (see
+ require_ipv6_recreated()).
+ """
+ locals_ = {a["local"] for a in addrs}
+ for family in ("-4", "-6"):
+ # Unfiltered: "dev" filtering can leave out multipath routes.
+ for r in ip(f"{family} route show table all", json=True):
+ hops = [h.get("dev") for h in r.get("nexthops", [])]
+ if ifname in hops:
+ raise KsftSkipEx(f"Multipath route {r['dst']} has a "
+ f"nexthop through {ifname}, which taking "
+ f"it down would delete")
+ # A multipath route has no "dev".
+ if r.get("prefsrc") in locals_ and r.get("dev") != ifname:
+ raise KsftSkipEx(f"Route {r['dst']} via "
+ f"{r.get('dev', 'multipath')} prefers "
+ f"{r['prefsrc']} as source, which moving "
+ f"{ifname}'s addresses would remove")
+ require_ipv6_recreated(ifname)
+ if ip(f"neigh show dev {ifname} nud permanent", json=True) or \
+ ip(f"neigh show proxy dev {ifname}", json=True):
+ raise KsftSkipEx(f"{ifname} has permanent or proxy neighbour "
+ f"entries, which taking it down would delete")
+
+
+def require_connected_peers(cfg, addrs):
+ """Skip unless every peer is on-link through a prefix of addrs.
+
+ Only the addresses move to the bond, bringing their prefix routes
+ with them: a peer reached through a gateway, or through any route
+ other than those, would be unreachable through the bond.
+ """
+ nets = [ipaddress.ip_network(f"{a['local']}/{a['prefixlen']}",
+ strict=False) for a in addrs]
+ for peer in filter(None, cfg.remote_addr_v.values()):
+ family = "-6" if ":" in peer else "-4"
+ route = ip(f"{family} route get {peer}", json=True)[0]
+ if (route.get("dev") != cfg.ifname or "gateway" in route or
+ not any(ipaddress.ip_address(peer) in net for net in nets)):
+ raise KsftSkipEx(f"{peer} is not on-link through a prefix of "
+ f"{cfg.ifname}'s global addresses, so it would "
+ f"be unreachable through {BOND_IFNAME}")
+
+
+def setup_bond(cfg):
+ """Enslave the DUT NIC to a single-slave bond for the rest of the case.
+
+ kTLS offload over a bond needs layer3+4 hashing (bond_sk_get_lower_dev());
+ balance-xor needs no LACP partner. The NIC's global addresses move to
+ the bond and cleanup restores them and its routes.
+ """
+ # Reuse the NIC's MAC so the peer's neighbour entries stay valid.
+ link = ip(f"link show dev {cfg.ifname}", json=True)[0]
+ if "master" in link:
+ raise KsftSkipEx(f"{cfg.ifname} is already enslaved to "
+ f"{link['master']}")
+ if ip(f"nexthop show dev {cfg.ifname}", json=True):
+ raise KsftSkipEx(f"{cfg.ifname} has nexthop objects, which taking "
+ f"it down would delete")
+ mtu, mac = link["mtu"], link["address"]
+ addrs = [a for a in
+ ip(f"addr show dev {cfg.ifname}", json=True)[0]["addr_info"]
+ if a.get("scope") == "global"]
+ if not addrs:
+ raise KsftSkipEx(f"No global address on {cfg.ifname} to move to "
+ f"{BOND_IFNAME}")
+ require_restorable(cfg.ifname, addrs)
+ require_connected_peers(cfg, addrs)
+
+ routes = route_keys(cfg.ifname)
+ local6 = local6_keys(cfg.ifname)
+ saved = save_nic(cfg.ifname)
+ ip(f"link add {BOND_IFNAME} address {mac} mtu {mtu} type bond "
+ "mode balance-xor xmit_hash_policy layer3+4 miimon 100")
+ # defer() runs LIFO: delete the bond (releasing the NIC) first.
+ defer(restore_nic, cfg, saved, routes, local6)
+ defer(ip, f"link del {BOND_IFNAME}")
+
+ # 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")
+ ip(f"link set dev {cfg.ifname} master {BOND_IFNAME}")
+ ip(f"link set dev {BOND_IFNAME} up")
+ for addr in addrs:
+ nodad = " nodad" if addr["family"] == "inet6" else ""
+ ip(f"addr replace {addr['local']}/{addr['prefixlen']} "
+ f"dev {BOND_IFNAME}{nodad}")
+ wait_bond_ready(cfg)
+
+
+def wait_bond_ready(cfg):
+ """Wait until the bond carries traffic through its slave again.
+
+ The bond's carrier lags the slave's by a miimon round: check both.
+ """
+ wait_carrier(cfg.ifname)
+ wait_carrier(BOND_IFNAME)
+
+ for peer in filter(None, cfg.remote_addr_v.values()):
+ wait_reachable(BOND_IFNAME, peer)
+
+
+@ksft_disruptive
+def test_tls_offload_bond(cfg):
+ """kTLS offload to the slave NIC through a bond, with no bounce."""
+ require_tls_setup(cfg)
+ cfg.require_ipver("4")
+ setup_bond(cfg)
+ run_tls_test(cfg)
+
+
+def bounce_idle(cfg, _port):
+ """Bounce the slave while the socket is idle, then resume the echo."""
+ ip(f"link set dev {cfg.ifname} down")
+ ip(f"link set dev {cfg.ifname} up")
+ wait_bond_ready(cfg)
+
+
+# Background link-up for bounce_inflight(). Reads icsk_retransmits from
+# /proc/net/tcp, as ss needs CONFIG_INET_DIAG for it.
+INFLIGHT_LINK_UP = """
+import subprocess, sys, time
+proc_rem, base, ifname, wait_s, outage_s = sys.argv[1:]
+
+def client_retransmits():
+ with open("/proc/net/tcp") as f:
+ return [int(c[6], 16) for c in (l.split() for l in f.readlines()[1:])
+ if c[2] == proc_rem and c[3] == "01"]
+
+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"])
+if up.returncode:
+ sys.exit(up.returncode)
+if len(found) != 1 or found[0] <= int(base):
+ sys.exit(f"no client retransmission timeout during the outage "
+ f"(client sockets' retransmits: {found}, was {base})")
+"""
+
+
+def client_proc_rem(cfg, port):
+ """The test client's remote address as /proc/net/tcp prints it."""
+ addr = struct.unpack("=I", socket.inet_aton(cfg.remote_addr_v["4"]))[0]
+ return f"{addr:08X}:{port:04X}"
+
+
+def client_retransmits(cfg, port):
+ """The test client's icsk_retransmits."""
+ rem = client_proc_rem(cfg, port)
+ with open("/proc/net/tcp", encoding="ascii") as f:
+ found = [int(c[6], 16) for c in (l.split() for l in f.readlines()[1:])
+ if c[2] == rem and c[3] == "01"]
+ if len(found) != 1:
+ raise KsftFailEx(f"Expected one client socket to port {port}, "
+ f"found {len(found)}")
+ return found[0]
+
+
+def bounce_inflight(cfg, port):
+ """Send the resumed echo into a bond that has no usable slave.
+
+ The client resumes only after this returns, so the link-up runs in the
+ background, once the client's socket has had a retransmission timeout.
+ Returns it for run_tls_test() to reap; it fails if there was none.
+ """
+ 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)
+
+
+@ksft_variants([
+ KsftNamedVariant("idle", bounce_idle),
+ KsftNamedVariant("inflight", bounce_inflight),
+])
+@ksft_disruptive
+def test_tls_offload_bond_bounce(cfg, bounce):
+ """Bounce the bond slave under an open offloaded socket.
+
+ NETDEV_DOWN moves the socket to the TX SW fallback, which then runs
+ at both bond master and slave and must encrypt only once; encrypting
+ twice puts plaintext on the wire and the echo mismatches.
+ """
+ require_tls_setup(cfg)
+ if 'Tx' not in cfg.tls_hw_directions:
+ raise KsftSkipEx("Bond bounce requires DUT TLS TX offload")
+ cfg.require_ipver("4")
+ setup_bond(cfg)
+ run_tls_test(cfg, pause=bounce)
+
+
def main() -> None:
"""Set up the DUT/peer environment and run the offload test suites."""
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
@@ -312,8 +797,10 @@ def main() -> None:
cfg.bin_remote = None
cfg.tls_skip_reason = None
+ # Flap the NIC last, so a slow retrain cannot fail later cases.
ksft_run([test_tls_offload, test_tls_offload_sizes,
- test_tls_offload_record_type], args=(cfg, ))
+ test_tls_offload_record_type, test_tls_offload_bond,
+ test_tls_offload_bond_bounce], args=(cfg, ))
ksft_exit()
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (6 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, John Fastabend,
Sabrina Dubroca, linux-kselftest
Move an established offloaded connection to a macvlan on the same
NIC. Unlike a bond bounce, this leaves the NIC up and the socket
offloaded: the NIC must transmit the fallback's ciphertext unchanged.
Check that the resumed echo traverses the macvlan and matches the
original data. Without "tls: device: don't let the NIC encrypt
fallback output again", the echo mismatches.
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
tools/testing/selftests/drivers/net/hw/config | 1 +
.../drivers/net/hw/tls_hw_offload.py | 84 +++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/hw/config b/tools/testing/selftests/drivers/net/hw/config
index ee658188670a..dab194fb27ee 100644
--- a/tools/testing/selftests/drivers/net/hw/config
+++ b/tools/testing/selftests/drivers/net/hw/config
@@ -14,6 +14,7 @@ CONFIG_IPV6=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_TUNNEL=y
+CONFIG_MACVLAN=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_DEVMEM=y
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 7d90f1c2024a..e1382cee8dd1 100755
--- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
+++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
@@ -36,6 +36,10 @@ from lib.py import (
)
BOND_IFNAME = "tlsbond0"
+MACVLAN_IFNAME = "tlsmv0"
+
+# Second half of the helper's default echo (-n 100, -b 16384).
+RESUMED_ECHO_BYTES = 50 * 16384
# -T for -P cases, long enough for a bounced NIC to retrain.
PAUSE_IO_TIMEOUT_S = 45
@@ -790,6 +794,85 @@ def test_tls_offload_bond_bounce(cfg, bounce):
run_tls_test(cfg, pause=bounce)
+def read_tx_bytes(ifname):
+ """TX bytes of a local interface."""
+ link = ip(f"-s link show dev {ifname}", json=True)[0]
+ return link["stats64"]["tx"]["bytes"]
+
+
+def sysctl_set(name, value):
+ """Set a sysctl for the rest of the case, restoring it on cleanup."""
+ old = cmd(f"sysctl -n {name}").stdout.strip()
+ cmd(f"sysctl -qw {name}={value}")
+ defer(cmd, f"sysctl -qw {name}={old}")
+
+
+def require_onlink_peer(cfg):
+ """Skip unless reroute_macvlan()'s direct /32 can take over the
+ connection's route without changing its next hop.
+
+ The macvlan is unnumbered and ARPs for the peer itself: a peer behind
+ a gateway would need the gateway, which also could not be made to
+ forget the macvlan's MAC on cleanup. An existing /32 to the peer would
+ clash with the one added, and a route from a table other than main
+ would win over it.
+ """
+ peer, local = cfg.remote_addr_v["4"], cfg.addr_v["4"]
+ route = ip(f"-d route get {peer} from {local}", json=True)[0]
+ if route.get("dev") != cfg.ifname or "gateway" in route:
+ raise KsftSkipEx(f"{peer} is not on-link through {cfg.ifname}")
+ if route.get("table", "main") != "main":
+ raise KsftSkipEx(f"{peer} is routed by table {route['table']}, "
+ f"not main")
+ if ip(f"route show table main exact {peer}/32", json=True):
+ raise KsftSkipEx(f"A host route to {peer} already exists")
+
+
+def setup_macvlan(cfg):
+ """Add a macvlan upper on the DUT NIC for the rest of the case.
+
+ The peer may answer on either MAC, so set loose rp_filter on both.
+ """
+ ip(f"link add {MACVLAN_IFNAME} link {cfg.ifname} type macvlan "
+ "mode bridge")
+ # Runs after the delete: make the peer drop the macvlan's MAC.
+ defer(ip, f"neigh flush to {cfg.addr_v['4']}", host=cfg.remote)
+ defer(ip, f"link del {MACVLAN_IFNAME}")
+ sysctl_set(f"net.ipv4.conf.{cfg.ifname}.rp_filter", 2)
+ sysctl_set(f"net.ipv4.conf.{MACVLAN_IFNAME}.rp_filter", 2)
+ ip(f"link set dev {MACVLAN_IFNAME} up")
+ wait_carrier(MACVLAN_IFNAME)
+
+
+def reroute_macvlan(cfg, _port):
+ """Move the paused connection's route to the macvlan upper."""
+ peer = cfg.remote_addr_v["4"]
+ # The macvlan is unnumbered, so pin the source address.
+ ip(f"route add {peer}/32 dev {MACVLAN_IFNAME} src {cfg.addr_v['4']}")
+ defer(ip, f"route del {peer}/32 dev {MACVLAN_IFNAME}")
+ wait_reachable(MACVLAN_IFNAME, peer)
+
+
+@ksft_disruptive
+def test_tls_offload_upper_reroute(cfg):
+ """Move an offloaded socket's route to an upper device of its NIC.
+
+ The NIC must not encrypt the SW fallback's output again.
+ """
+ require_tls_setup(cfg)
+ if 'Tx' not in cfg.tls_hw_directions:
+ raise KsftSkipEx("Upper device reroute requires DUT TLS TX offload")
+ cfg.require_ipver("4")
+ require_onlink_peer(cfg)
+ setup_macvlan(cfg)
+ before = read_tx_bytes(MACVLAN_IFNAME)
+ run_tls_test(cfg, pause=reroute_macvlan)
+ sent = read_tx_bytes(MACVLAN_IFNAME) - before
+ ksft_ge(sent, RESUMED_ECHO_BYTES,
+ comment=f"resumed echo did not go through {MACVLAN_IFNAME} "
+ f"({sent} bytes)")
+
+
def main() -> None:
"""Set up the DUT/peer environment and run the offload test suites."""
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
@@ -800,6 +883,7 @@ def main() -> None:
# Flap the NIC last, so a slow retrain cannot fail later cases.
ksft_run([test_tls_offload, test_tls_offload_sizes,
test_tls_offload_record_type, test_tls_offload_bond,
+ test_tls_offload_upper_reroute,
test_tls_offload_bond_bounce], args=(cfg, ))
ksft_exit()
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
` (7 preceding siblings ...)
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
@ 2026-12-04 23:53 ` Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
8 siblings, 1 reply; 17+ messages in thread
From: Rishikesh Jethwani @ 2026-12-04 23:53 UTC (permalink / raw)
To: netdev
Cc: Rishikesh Jethwani, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, John Fastabend,
Sabrina Dubroca, linux-kselftest
Pause an offloaded echo and reroute it onto a path whose MTU is below
the established connection's segment size. Cover both the NIC and a
macvlan upper. Clear DF on the client socket rather than changing the
namespace default.
A stalled echo alone does not prove IP refused fragmentation. Verify
that TX offload was active, ip_do_fragment() returned -EMSGSIZE for
the marked skbs, and no fragment reached output or device egress.
Require the client to time out after resuming and the peer to receive
no bytes beyond the pre-pause echo, with no TLS decryption error.
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
tools/testing/selftests/drivers/net/hw/config | 13 +
.../selftests/drivers/net/hw/tls_hw_offload.c | 28 +-
.../drivers/net/hw/tls_hw_offload.py | 258 +++++++++++++++++-
3 files changed, 297 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/config b/tools/testing/selftests/drivers/net/hw/config
index dab194fb27ee..d36de1f3b2de 100644
--- a/tools/testing/selftests/drivers/net/hw/config
+++ b/tools/testing/selftests/drivers/net/hw/config
@@ -1,12 +1,18 @@
CONFIG_BONDING=y
+CONFIG_BPF_EVENTS=y
+CONFIG_BPF_JIT=y
CONFIG_BPF_SYSCALL=y
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_FAIL_FUNCTION=y
CONFIG_FAULT_INJECTION=y
CONFIG_FAULT_INJECTION_DEBUG_FS=y
CONFIG_FUNCTION_ERROR_INJECTION=y
+CONFIG_FUNCTION_TRACER=y
CONFIG_HUGETLBFS=y
CONFIG_INET6_ESP=y
CONFIG_INET6_ESP_OFFLOAD=y
+CONFIG_INET_DIAG=y
CONFIG_INET_ESP=y
CONFIG_INET_ESP_OFFLOAD=y
CONFIG_IO_URING=y
@@ -14,6 +20,8 @@ CONFIG_IPV6=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_TUNNEL=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_MACVLAN=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_CLS_BPF=y
@@ -23,6 +31,11 @@ CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPIP=y
CONFIG_NETKIT=y
CONFIG_NET_SCH_INGRESS=y
+CONFIG_NETFILTER=y
+CONFIG_NETFILTER_EGRESS=y
+CONFIG_NF_TABLES=m
+CONFIG_NF_TABLES_IPV4=y
+CONFIG_NF_TABLES_NETDEV=y
CONFIG_SYNC_FILE=y
CONFIG_TLS=y
CONFIG_TLS_DEVICE=y
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 9c1c546d36cf..73cb7a8a7b0f 100644
--- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
+++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
@@ -87,6 +87,9 @@ static int verbose;
/* -P: pause the client halfway until the harness releases it. */
static int pause_mid;
+/* -D: let IP fragment the client's packets (IP_PMTUDISC_DONT). */
+static int pmtudisc_dont;
+
/* Upper bound on a helper's lifetime, enforced by SIGALRM. On a timeout
* the harness can only kill the ssh client of the remote helper, not the
* helper itself, so each must exit on its own first. A normal run takes a
@@ -254,6 +257,19 @@ static int install_tls_key(int fd, int direction, int cipher)
* family and %zone scope IDs in link-local addresses). Returns the fd on
* success, -1 on error (with the fd already closed).
*/
+static int set_pmtudisc_dont(int fd, int family)
+{
+ int val;
+
+ if (family == AF_INET6) {
+ val = IPV6_PMTUDISC_DONT;
+ return setsockopt(fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val,
+ sizeof(val));
+ }
+ val = IP_PMTUDISC_DONT;
+ return setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val));
+}
+
static int client_connect_tls(void)
{
struct addrinfo hints = {0}, *res, *rp;
@@ -281,6 +297,12 @@ static int client_connect_tls(void)
err = errno;
continue;
}
+ if (pmtudisc_dont && set_pmtudisc_dont(csk, rp->ai_family) < 0) {
+ err = errno;
+ close(csk);
+ csk = -1;
+ continue;
+ }
if (connect(csk, rp->ai_addr, rp->ai_addrlen) == 0)
break;
err = errno;
@@ -767,6 +789,7 @@ static void print_usage(const char *prog)
printf(" -n <N> Send/echo iterations (default: 100)\n");
printf(" -t <type> Record type test: 21=alert, 22=handshake\n");
printf(" -P Pause halfway (client): ksft_ready(), ksft_wait()\n");
+ printf(" -D Clear DF, letting IP fragment (client)\n");
printf(" -T <sec> Send/recv timeout (default: %d); lifetime bound\n"
" becomes 2 * <sec> + 15 (default: %d)\n",
IO_TIMEOUT_S, HELPER_TIMEOUT_S);
@@ -807,7 +830,7 @@ int main(int argc, char *argv[])
is_server = !strcmp(argv[1], "server");
optind = 2; /* skip subcommand */
- while ((opt = getopt(argc, argv, "s:p:b:r:c:v:n:t:T:PV46h")) != -1) {
+ while ((opt = getopt(argc, argv, "s:p:b:r:c:v:n:t:T:DPV46h")) != -1) {
switch (opt) {
case 's':
server_ip = optarg;
@@ -818,6 +841,9 @@ int main(int argc, char *argv[])
case 'P':
pause_mid = 1;
break;
+ case 'D':
+ pmtudisc_dont = 1;
+ break;
case 'T':
io_timeout_s = atoi(optarg);
if (io_timeout_s < 1 || io_timeout_s > 120) {
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 e1382cee8dd1..a937ec979a7b 100755
--- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
+++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
@@ -3,9 +3,13 @@
"""Test kTLS hardware offload using a C helper binary."""
+import errno
import ipaddress
import json
import os
+import re
+import select
+import signal
import socket
import struct
import sys
@@ -27,6 +31,8 @@ from lib.py import (
ksft_eq,
ksft_exit,
ksft_ge,
+ ksft_in,
+ ksft_not_in,
ksft_pr,
ksft_run,
ksft_variants,
@@ -38,9 +44,24 @@ from lib.py import (
BOND_IFNAME = "tlsbond0"
MACVLAN_IFNAME = "tlsmv0"
-# Second half of the helper's default echo (-n 100, -b 16384).
+# Each half of the helper's default echo (-n 100, -b 16384): -P pauses
+# after the first, and the second is the resumed echo.
+PAUSED_ECHO_BYTES = 50 * 16384
RESUMED_ECHO_BYTES = 50 * 16384
+# Fragmentation cases (see frag_reroute()).
+FRAG_NFT_TABLE = "tlsfrag"
+FRAG_NFT_EGRESS_TABLE = "tlsfrag_egress"
+FRAG_MARK = 0x544c
+FRAG_RT_TABLE = 0x544c
+# Rerouted path's MTU, lowered to the connection's MSS (frag_reroute()).
+FRAG_MTU = 1000
+# The server's recv timeout outlasts the client's lifetime, so the
+# client stalls on its own timeout rather than seeing EOF.
+FRAG_CLIENT_LIFETIME_S = 15
+FRAG_SERVER_IO_TIMEOUT_S = 2 * FRAG_CLIENT_LIFETIME_S
+FRAG_SERVER_LIFETIME_S = 2 * FRAG_SERVER_IO_TIMEOUT_S + 15
+
# -T for -P cases, long enough for a bounced NIC to retrain.
PAUSE_IO_TIMEOUT_S = 45
# bounce_inflight(): outage once the client has sent, and wait for that.
@@ -873,6 +894,240 @@ def test_tls_offload_upper_reroute(cfg):
f"({sent} bytes)")
+def client_mss(peer, port):
+ """The MSS the test client's established socket sizes segments by.
+
+ -O prints one line per socket. Not finding exactly one is a test
+ failure; ss not reporting the MSS of the one found is a skip.
+ """
+ out = cmd(f"ss -tinHO state established dst {peer} "
+ f"dport = :{port}").stdout
+ socks = [line for line in out.splitlines() if line.strip()]
+ if len(socks) != 1:
+ raise KsftFailEx(f"Expected one client socket to port {port}, "
+ f"found {len(socks)}: {out.strip()!r}")
+ # Not advmss: or rcvmss:.
+ found = re.search(r"\bmss:(\d+)", socks[0])
+ if not found:
+ raise KsftSkipEx(f"ss reports no mss: for the client socket: "
+ f"{socks[0].strip()!r}")
+ return int(found.group(1))
+
+
+def frag_reroute(cfg, port, dev):
+ """Reroute the connection onto a small-MTU route without TCP noticing.
+
+ TCP keeps sizing segments for the socket's route, but the route chain
+ re-runs the lookup (ip_route_me_harder()) after marking the skb, so
+ each segment leaves through the policy route and exceeds its MTU. A
+ full segment is the MSS plus at least 40 bytes of headers, so an MTU
+ of at most the MSS is below it whatever the path the connection
+ started on.
+ """
+ peer = cfg.remote_addr_v["4"]
+ mtu = min(FRAG_MTU, client_mss(peer, port))
+ if mtu < 68:
+ raise KsftSkipEx(f"MSS {mtu} leaves no IPv4 MTU below the segments")
+ ip(f"route add {peer}/32 dev {dev} mtu {mtu} table {FRAG_RT_TABLE}")
+ defer(ip, f"route del {peer}/32 dev {dev} table {FRAG_RT_TABLE}")
+ # "create" fails if the table exists, so never delete one we do not own.
+ cmd(f"nft create table ip {FRAG_NFT_TABLE}")
+ defer(cmd, f"nft delete table ip {FRAG_NFT_TABLE}")
+ cmd(f"nft add chain ip {FRAG_NFT_TABLE} out "
+ "{ type route hook output priority mangle ; }")
+ cmd(f"nft add rule ip {FRAG_NFT_TABLE} out ip daddr {peer} "
+ f"tcp dport {port} meta mark set {FRAG_MARK}")
+
+
+def frag_count_egress(dev):
+ """Count the rerouted flow's IPv4 fragments that reach dev.
+
+ Egress runs before validate_xmit_skb(), so this also counts fragments
+ that tls_sw_fallback() or the driver would drop.
+ """
+ table = f"netdev {FRAG_NFT_EGRESS_TABLE}"
+ cmd(f"nft create table {table}")
+ defer(cmd, f"nft delete table {table}")
+ cmd(f"nft add counter {table} frags")
+ cmd(f"nft add chain {table} out "
+ f"{{ type filter hook egress device {dev} priority 0 ; }}")
+ cmd(f"nft add rule {table} out meta mark {FRAG_MARK} "
+ "ip frag-off & 0x3fff != 0 counter name frags")
+
+
+def read_nft_counter(family, table, name):
+ """Packet count of a named nftables counter."""
+ out = json.loads(cmd(f"nft --json list counter {family} {table} "
+ f"{name}").stdout)
+ return next(obj["counter"]["packets"] for obj in out["nftables"]
+ if "counter" in obj)
+
+
+# @ret: ip_do_fragment() return values for rerouted segments. @frags:
+# their fragments handed to ip_finish_output2(). Without the fix, a
+# fragment can fail in output() and never reach the egress counter, so
+# count both. The skb is not dereferenced on return, where it may be
+# freed. frag_off is read bytewise to avoid a byte swap.
+FRAG_BPFTRACE = f"""
+fentry:ip_do_fragment
+/args.skb->mark == {FRAG_MARK}/
+{{
+ @in[(uint64)args.skb] = 1;
+}}
+fexit:ip_do_fragment
+/@in[(uint64)args.skb]/
+{{
+ @ret[retval] = count();
+ delete(@in[(uint64)args.skb]);
+}}
+fentry:ip_finish_output2
+/args.skb->mark == {FRAG_MARK}/
+{{
+ $frag_off = args.skb->head + args.skb->network_header + 6;
+ if ((*(uint8 *)$frag_off & 0x3f) || *(uint8 *)($frag_off + 1)) {{
+ @frags = count();
+ }}
+}}
+"""
+
+
+def wait_bpftrace_attached(trace, timeout=30):
+ """Wait until bpftrace reports its probes attached, on either pipe."""
+ fds = [trace.proc.stdout.fileno(), trace.proc.stderr.fileno()]
+ deadline = time.monotonic() + timeout
+ seen = b""
+ while b"attached_probes" not in seen and b"Attaching " not in seen:
+ left = deadline - time.monotonic()
+ rlist = select.select(fds, [], [], left)[0] if left > 0 else []
+ if not rlist:
+ raise KsftFailEx(f"bpftrace did not attach: {seen!r}")
+ for fd in rlist:
+ data = os.read(fd, 4096)
+ if not data:
+ raise KsftFailEx(f"bpftrace exited: {seen!r}")
+ seen += data
+
+
+def bpftrace_maps(stdout):
+ """Maps from bpftrace's JSON output, by name without the "@"."""
+ maps = {}
+ for line in stdout.splitlines():
+ try:
+ obj = json.loads(line)
+ except ValueError:
+ continue
+ if obj.get("type") == "map":
+ for name, value in obj["data"].items():
+ maps[name.lstrip("@")] = value
+ return maps
+
+
+def frag_route_dev(cfg, upper):
+ """Return the device for the small-MTU route, setting it up if needed."""
+ if not upper:
+ return cfg.ifname
+ setup_macvlan(cfg)
+ return MACVLAN_IFNAME
+
+
+@ksft_variants([
+ KsftNamedVariant("same_dev", False),
+ KsftNamedVariant("upper", True),
+])
+@ksft_disruptive
+def test_tls_offload_frag(cfg, upper):
+ """IP must not fragment kTLS offload plaintext.
+
+ Every rerouted segment must be refused by ip_do_fragment(), and the
+ connection must stall rather than deliver or corrupt data: the server
+ must have received nothing beyond the bytes echoed before the pause.
+ Segments under the MTU, such as a record's tail, can still leave, but
+ out of order behind a refused one. MTU probing is off, as it would
+ shrink the MSS and end the stall.
+ """
+ require_tls_setup(cfg)
+ if 'Tx' not in cfg.tls_hw_directions:
+ raise KsftSkipEx("Fragmentation test requires DUT TLS TX offload")
+ cfg.require_ipver("4")
+ cfg.require_cmd("nft")
+ cfg.require_cmd("bpftrace")
+ cfg.require_cmd("ss")
+ if not os.path.exists("/sys/kernel/btf/vmlinux"):
+ raise KsftSkipEx("Fragmentation test requires CONFIG_DEBUG_INFO_BTF")
+
+ peer = cfg.remote_addr_v["4"]
+ dev = frag_route_dev(cfg, upper)
+ sysctl_set("net.ipv4.tcp_mtu_probing", 0)
+ # frag_reroute() fills the table; until then, lookups fall through it.
+ ip(f"rule add fwmark {FRAG_MARK} lookup {FRAG_RT_TABLE}")
+ defer(ip, f"rule del fwmark {FRAG_MARK} lookup {FRAG_RT_TABLE}")
+ frag_count_egress(dev)
+
+ port = rand_port()
+ server_cmd = (f"{cfg.bin_remote} server -p {port} -c 128 -v 1.2 -4 "
+ f"-T {FRAG_SERVER_IO_TIMEOUT_S}")
+ client_cmd = (f"{cfg.bin_local} client -s {peer} -p {port} -c 128 "
+ "-v 1.2 -4 -P -D")
+
+ tls_before = read_tls_stats()
+ peer_before = read_tls_stats(host=cfg.remote)
+ # Both helpers stall and time out, so check their outcome below.
+ with bkg(["bpftrace", "-f", "json", "-e", FRAG_BPFTRACE],
+ fail=False) as trace:
+ wait_bpftrace_attached(trace)
+ with bkg(server_cmd, host=cfg.remote, exit_wait=True, fail=False,
+ timeout=FRAG_SERVER_LIFETIME_S + 15) as server:
+ wait_port_listen(port, host=cfg.remote)
+ with bkg(client_cmd, ksft_wait=30, fail=False,
+ timeout=FRAG_CLIENT_LIFETIME_S + 15) as client:
+ frag_reroute(cfg, port, dev)
+ tls_after = read_tls_stats()
+ peer_after = read_tls_stats(host=cfg.remote)
+
+ dev_tx = stat_diff(tls_before, tls_after, 'TlsTxDevice')
+ ksft_ge(dev_tx, 1,
+ comment=f"HW TX offload not engaged (TlsTxDevice={dev_tx})")
+
+ maps = bpftrace_maps(trace.stdout)
+ rets = maps.get("ret", {})
+ refused = rets.get(str(-errno.EMSGSIZE), 0)
+ ksft_ge(refused, 1,
+ comment=f"no rerouted segment was refused by ip_do_fragment() "
+ f"(returns: {rets})")
+ ksft_eq(sum(rets.values()), refused,
+ comment=f"ip_do_fragment() returned other than -EMSGSIZE for "
+ f"rerouted segments (returns: {rets})")
+ built = maps.get("frags", 0)
+ ksft_eq(built, 0,
+ comment=f"ip_do_fragment() passed {built} fragments of rerouted "
+ f"segments to ip_finish_output2()")
+
+ ksft_in("Resumed", client.stdout,
+ comment="client never resumed after the reroute")
+ ksft_not_in("mismatch", client.stdout,
+ comment="client got a corrupted echo")
+ stalled = (client.ret == -signal.SIGALRM or
+ "Resource temporarily unavailable" in client.stdout)
+ ksft_eq(stalled, True,
+ comment=f"client did not stall (exit {client.ret}): "
+ f"{client.stdout.strip()}")
+ decrypt_err = stat_diff(peer_before, peer_after, 'TlsDecryptError')
+ ksft_eq(decrypt_err, 0,
+ comment=f"peer failed to decrypt (TlsDecryptError={decrypt_err})")
+ # The server reports its total once its recv times out.
+ received = re.search(r"Total received: (\d+) bytes", server.stdout)
+ ksft_eq(received is not None, True,
+ comment=f"server did not report its total: "
+ f"{server.stdout.strip()}")
+ ksft_eq(int(received.group(1)) if received else None, PAUSED_ECHO_BYTES,
+ comment="server received data sent after the reroute")
+
+ frags = read_nft_counter("netdev", FRAG_NFT_EGRESS_TABLE, "frags")
+ ksft_eq(frags, 0,
+ comment=f"offload plaintext was fragmented "
+ f"({frags} fragments reached {dev})")
+
+
def main() -> None:
"""Set up the DUT/peer environment and run the offload test suites."""
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
@@ -884,6 +1139,7 @@ def main() -> None:
ksft_run([test_tls_offload, test_tls_offload_sizes,
test_tls_offload_record_type, test_tls_offload_bond,
test_tls_offload_upper_reroute,
+ test_tls_offload_frag,
test_tls_offload_bond_bounce], args=(cfg, ))
ksft_exit()
--
2.50.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] On its own, this patch does not fix the headline case it claims
to fix: NIC re-encryption of tls_sw_fallback() output, e.g. after a…
- [Low] tls_is_skb_tx_device_offloaded() is also used for TX queue and
bond-slave selection, not only to decide whether the NIC encrypts.
- [Low] This patch makes tls_is_skb_tx_device_offloaded() true only when
skb->decrypted is set, but the in-tree descriptions of the helper were…
--
I found three low-severity issues in this patch. The code itself looks correct within the series. All three findings are about the commit message, tags and in-tree documentation, plus one change to how two drivers pick queues and bond slaves.
tls: device: don't let the NIC encrypt fallback output again
This commit adds a skb_is_decrypted() check to
tls_is_skb_tx_device_offloaded(). With it, skbs from an offloaded socket
that are not marked for device crypto skip the driver's TLS TX path. That
covers software fallback output and data queued before TLS_TX was enabled.
> Require skb_is_decrypted() in tls_is_skb_tx_device_offloaded().
> Fallback output then takes the ordinary TX path, as does data queued
> before TLS_TX was enabled. Backport the first three fixes together,
> in order.
[Severity: Low]
Does this change alone make fallback output take the ordinary TX path?
complete_skb() copies the headers group, which includes decrypted, from
the original skb:
net/tls/tls_device_fallback.c:complete_skb() {
...
skb_copy_header(nskb, skb);
...
/* Ciphertext now: don't encrypt it again */
nskb->decrypted = 0;
...
}
The nskb->decrypted = 0 line comes from the previous patch in the series,
"tls: device: keep tls_sw_fallback() from encrypting its own output".
Without it, nskb keeps decrypted=1, so the new skb_is_decrypted() check
still returns true for fallback output. The macvlan reroute case would
then still go like this:
macvlan xmit
validate_xmit_skb()->tls_validate_xmit_skb()
dev != ctx->netdev, so tls_sw_fallback() runs; nskb keeps decrypted=1
lower NIC xmit
validate_xmit_skb()->tls_validate_xmit_skb()
dev == ctx->netdev, so the skb is returned unchanged
the driver sees tls_is_skb_tx_device_offloaded() == true and encrypts
the ciphertext again
Could the commit message name the prerequisite commit? It could also say
that this check depends on complete_skb() clearing the mark.
"Backport the first three fixes together, in order" will not mean much
once this is in git history. This patch has Fixes: e8f69799810c and a bare
Cc: stable. The prerequisite has a different tag, Fixes: c55dcdd435aa.
Would a prerequisite annotation help here, like the one the previous patch
uses?
Cc: stable@vger.kernel.org # x.y.z: <prereq sha>
That would stop stable trees from picking this patch up without the
previous one.
> diff --git a/include/net/tls.h b/include/net/tls.h
> index 0b001b8ab1c3b..9998b55820919 100644
> --- a/include/net/tls.h
> +++ b/include/net/tls.h
> @@ -365,7 +365,8 @@ static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb)
>
> return sk && sk_fullsock(sk) &&
> (smp_load_acquire(&sk->sk_validate_xmit_skb) ==
> - &tls_validate_xmit_skb);
> + &tls_validate_xmit_skb) &&
> + skb_is_decrypted(skb);
[Severity: Low]
tls_is_skb_tx_device_offloaded() is not only used to decide whether the
NIC encrypts. It also drives TX queue selection and bond slave selection.
Is the change in those callers intended?
After this patch, every unmarked skb of an offloaded socket goes a
different way at these two call sites. That includes pure ACKs, bare FINs,
pre-offload data and retransmits, and fallback output.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:cxgb4_select_queue() {
...
if (xfrm_offload(skb) || is_ptp_enabled(skb, dev) ||
skb->encapsulation ||
tls_is_skb_tx_device_offloaded(skb) ||
(proto != IPPROTO_TCP && proto != IPPROTO_UDP))
txq = txq % pi->nqsets;
...
}
When netdev_get_num_tc(dev) != 0, every skb of a TLS offloaded socket used
to be kept on the normal NIC queues. Now only decrypted=1 skbs are. The
unmarked segments of the same flow can end up on the mqprio ETHOFLD queues
and be shaped there.
drivers/net/bonding/bond_main.c:__bond_start_xmit() {
...
if (tls_is_skb_tx_device_offloaded(skb))
return bond_tls_device_xmit(bond, skb, dev);
...
}
Only marked skbs are now pinned to the TLS lower device. After an
active-backup failover, or a slave array change in xor mode, unmarked skbs
can leave on a different slave from the one carrying the TLS records.
Can this split one TCP flow across hardware queues or ports? That could
reorder ACKs, FINs and pre-offload retransmits relative to the TLS data.
This may be harmless, since none of these skbs need device crypto. The
commit message mentions the "ordinary TX path", but not the queue
selection or bond steering changes.
[Severity: Low]
Should the in-tree descriptions of this helper be updated as well?
tls_set_device_offload() in net/tls/tls_device.c still says:
/* following this assignment tls_is_skb_tx_device_offloaded
* will return true and the context might be accessed
* by the netdev's xmit function.
*/
smp_store_release(&sk->sk_validate_xmit_skb, tls_validate_xmit_skb);
After this patch the helper returns true only for skbs built with
MSG_SENDPAGE_DECRYPTED. Pre-offload skbs and fallback output now return
false.
Documentation/networking/tls-offload.rst still tells driver authors:
TX offload being fully initialized does not imply that all segments passing
through the driver and which belong to the offloaded socket will be after
the expected sequence number and will have kernel record information.
In particular, already encrypted data may have been queued to the socket
before installing the connection state in the kernel.
Those segments still reach the driver. However, the shared helper now
keeps them out of the TLS TX handlers in mlx5e_accel_tx_begin(),
nfp_net_tls_tx(), fun_tls_tx() and the cxgb4 ULD tx_handler path.
Neither the comment nor the documentation says that the helper now
requires the skb mark as well as the socket state.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The comment this patch adds in tls_sw_fallback()
(net/tls/tls_device_fallback.c:393), "Its record was acked and freed:…
- [Low] This patch edits the '*sync_size < 0' branch of fill_sg_in()
(net/tls/tls_device_fallback.c:239-252) and removes the…
--
tls: device: remove the dead start marker bypass in TX fallback
This removes the start marker bypass in tls_sw_fallback() and its special
case in fill_sg_in(). The reasoning is that pre-offload skbs now return
early from tls_sw_fallback() before record lookup, and TCP will not merge
them with decrypted data across the start marker. The commit message says
there is no functional change.
> diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
> index 42afbe7e60b56..da875fdf5b546 100644
> --- a/net/tls/tls_device_fallback.c
> +++ b/net/tls/tls_device_fallback.c
> @@ -237,8 +237,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
>
> *sync_size = tcp_seq - tls_record_start_seq(record);
> if (*sync_size < 0) {
> - int is_start_marker = tls_record_is_start_marker(record);
> -
> spin_unlock_irqrestore(&ctx->lock, flags);
> /* This should only occur if the relevant record was
> * already acked. In that case it should be ok
[ ... ]
> @@ -250,8 +248,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
> * on TCP to retransmit a packet that doesn't contain
> * already acked payload.
> */
> - if (!is_start_marker)
> - *sync_size = 0;
> return -EINVAL;
> }
[Severity: Low]
This isn't a bug, but should the comment above be updated along with this
change?
As far as I can tell, tls_get_record() can only produce a negative
sync_size by returning the start marker record. The marker has len == 0,
so it skips the between() range check:
net/tls/tls_device.c:tls_get_record() {
...
/* send the start_marker record if seq number is before the
* tls offload start marker sequence number. This record is
* required to handle TCP packets which are before TLS offload
* started.
...
}
Records are contiguous, because tls_push_record() sets each end_seq to
tp->write_seq + record->len. A seq inside a record that was already acked
and removed by tls_tcp_clean_acked() fails the between() check, so
tls_get_record() returns NULL. The earlier !record branch handles that
case.
Before this patch, the is_start_marker check showed in the code that this
branch covered the pre-offload case. With the check gone, the branch can
only be reached through the start marker, but the comment still says it
is the "already acked" case.
Would it be clearer to rewrite the comment to describe the start marker
invariant, or to replace it with something like DEBUG_NET_WARN_ON_ONCE()?
[ ... ]
> @@ -394,12 +390,9 @@ static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
> sg_init_table(sg_in, sg_in_max_elements);
> sg_init_table(sg_out, ARRAY_SIZE(sg_out));
>
> - if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs)) {
> - /* bypass packets before kernel TLS socket option was set */
> - if (sync_size < 0 && payload_len <= -sync_size)
> - nskb = skb_get(skb);
> + /* Its record was acked and freed: drop it */
> + if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs))
> goto put_sg;
[Severity: Low]
This isn't a bug, but is this new comment accurate for every way
fill_sg_in() can fail?
fill_sg_in() returns -EINVAL from three places. Only the !record case from
tls_get_record() matches "acked and freed".
The *sync_size < 0 case can only be reached through the start marker
record. That record is live, not acked and freed.
The last case happens after a live record has been found and its frags
referenced with netmem_inc_ref():
fill_sg_in() {
...
if (skb_to_sgvec(skb, &sg_in[i], tcp_payload_offset, payload_len) < 0)
return -EINVAL;
...
}
__skb_to_sgvec() can return -EMSGSIZE when the sg table runs out or the
recursion is too deep, or -EINVAL when the length is short. In that case
the packet of a live record is dropped because the scatterlist conversion
failed, not because of an ACK.
The drop and the put_sg cleanup are fine for all three paths. Could the
comment say something like "drop the skb on lookup or sg setup failure"
instead?
>
> nskb = tls_enc_skb(tls_ctx, sg_out, sg_in, skb, sync_size, rcd_sn);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found 8 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 5
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 new branch in bkg.__exit__() (utils.py lines 411-422)
catches and only prints a background command's failure whenever any…
- [Medium] cmd.__init__() starts readiness commands with
`start_new_session=self._own_pgrp` (line 120), which calls setsid() in…
- [Medium] selftests: net: py: 20s cancel stall for ksft_wait helpers in
bkg.__exit__()
- [Low] cmd._cleanup_quietly() prints a cleanup failure with a single
print(f"# Warning: ... {type(e).__name__}: {e}"), so only the first…
- [Low] bkg.__init__() still prints "combining shell and terminate is
risky!
- [Low] cmd._kill_group() calls os.killpg(self.proc.pid, sig) with no
check of whether the group leader has already been reaped or the group…
- [Low] On the normal teardown path of an own-process-group command
(bkg.__exit__ with ex_type None, then process(terminate=False), then…
- [Low] Several interrupt windows are not covered by any cleanup guard.
--
selftests: net: py: reap commands that fail to report ready
This patch gives readiness-enabled commands in the net selftest Python
library their own session and process group. It kills that group when the
command times out, closes the ready FD, or is interrupted. It also adds
bounded output draining, delays closing the ksft_wait pipe until teardown,
switches fd_read_timeout() to poll(), and makes bkg.__exit__() suppress
cleanup failures while another exception is propagating.
> diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
> index 1727bc4180733..9edfc4f88621c 100644
> --- a/tools/testing/selftests/net/lib/py/utils.py
> +++ b/tools/testing/selftests/net/lib/py/utils.py
[ ... ]
> @@ -84,26 +109,207 @@ class cmd:
> pass_fds.append(ready_fd)
> env["KSFT_READY_FD"] = str(ready_fd)
>
> + # A command that reports ready leads its own process group, so
> + # that _reap_unready() and _kill_leftovers() can stop what it
> + # started too. Terminal signals then no longer reach it: on
> + # Ctrl-C, KeyboardInterrupt here leads to the same cleanup.
> + self._own_pgrp = ksft_ready is not None
> self.proc = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE, pass_fds=pass_fds,
> - env=env)
> + env=env,
> + start_new_session=self._own_pgrp)
[Severity: Medium]
start_new_session makes the child call setsid(). That takes the command
and its workers out of the terminal's process group, and also out of the
test runner's group and session. Is that trade-off intended?
kselftest/runner.sh runs each test through tap_timeout():
/usr/bin/timeout --foreground "$kselftest_timeout" \
/usr/bin/timeout "$kselftest_timeout" $1
The inner timeout has no --foreground, so when it expires it signals its
whole process group. Before this patch, readiness helpers were in that
group and got the SIGTERM directly. SIGHUP, SIGINT and SIGQUIT sent to the
foreground group reached them too.
Now they only stop if Python unwinds into bkg.__exit__() or
_reap_cancelled(). The runner timeout itself still reaches Python, which
raises KsftTerminate and cleans up.
What stops the helpers if the interpreter dies without unwinding? Examples
are SIGHUP on an ssh hangup, SIGQUIT, SIGKILL of the test process, a
harness killing the process group, or an interpreter crash.
ksft_wait helpers may still exit on EOF of the wait pipe. ksft_ready-only
helpers have no such pipe, for example in toeplitz.py:
with bkg(" ".join(rx_cmd), ksft_ready=True, exit_wait=True) as rx_proc:
gro_lib.py and gro_stats.py use the same pattern. Could those helpers, and
any wrapper workers, now outlive the test and stay bound to the device or
port?
The in-code comment only mentions terminal signals. The commit message
doesn't mention the new session or the change to group signals.
> if ksft_wait is not None:
> os.close(wait_fd)
> if ksft_ready is not None:
> os.close(ready_fd)
> - msg = fd_read_timeout(rfd, ksft_wait)
> - os.close(rfd)
> + timed_out = False
> + try:
> + msg = fd_read_timeout(rfd, ksft_wait)
[Severity: Low]
Are there interrupt windows around this try block that no cleanup guard
covers? The command now lives in its own session. A Ctrl-C or runner
SIGTERM in these windows no longer reaches the child as well, so nothing
reaps it:
1) KeyboardInterrupt or KsftTerminate while subprocess.Popen() waits on
its exec-status pipe. CPython re-raises without killing the forked
child, and self.proc is never assigned.
2) The os.close(wait_fd), os.close(ready_fd) and timed_out = False
statements before the try.
3) After a successful ready message, the rest of cmd.__init__() and
bkg.__init__() before __enter__() runs.
4) The time between getting a bkg back from a helper such as setup_xsk()
in xsk_reconfig.py and entering the caller's with block.
In these cases _reap_unready(), _kill_leftovers() and bkg.__exit__() never
run. A ksft_ready-only helper has no wait-pipe EOF to make it exit, and
rfd, ready_fd and ksft_term_fd leak too.
The windows are short. Still, the commit message says the patch was
"Tested locally with ... Ctrl-C during readiness and teardown", and
readiness only partly covers these adjacent windows.
[ ... ]
> + def _cleanup_quietly(self, func, *args, **kwargs):
> + """Run a cleanup step while an exception is propagating.
> +
> + Report a failure instead of raising it, which would replace that
> + exception. A second interruption still propagates.
> + """
> + try:
> + func(*args, **kwargs)
> + except Exception as e:
> + print(f"# Warning: cleanup of {self.comm!r} failed: "
> + f"{type(e).__name__}: {e}")
[Severity: Low]
Only the first line of this message gets the '#' prefix. Can this put
unprefixed helper output into the TAP stream?
CmdExitFailure and CmdInitFailure build their message as:
super().__init__(msg + "\n" + repr(cmd_obj))
cmd.__repr__() puts the command's STDOUT and STDERR on the following
lines, indented with spaces rather than '#'.
ksft_run() prints exceptions through ksft_pr() with a per-line prefix.
With this patch, bkg.__exit__() sends process() through
_cleanup_quietly(), so a CmdExitFailure ends up in this print() instead.
runner.sh pipes output through tap_prefix, so this mostly shows when a
test is run standalone. Should every line get the '#' prefix, as ksft_pr()
does?
[ ... ]
> + def _kill_group(self, sig):
> + """Signal the process group the command leads.
> +
> + The group outlives the command while any of its descendants are
> + left in it, so this reaches them after the command is reaped too.
> + """
> + try:
> + os.killpg(self.proc.pid, sig)
> + except ProcessLookupError:
> + pass
[Severity: Low]
Could this signal an unrelated process group? os.killpg() runs without
checking whether the leader is still unreaped or whether the group has
any members left. Several callers reach it after the leader has been
reaped:
1) _collect_reaped() sends SIGKILL right after _drain_until_exit(), whose
self.proc.poll() loop normally reaps the leader. It also does so when
_reap_unready() or _reap_cancelled() found the leader already reaped.
2) _kill_leftovers() sends SIGKILL before it checks returncode. By then
communicate() in _process_terminate() may already have reaped the
leader, for example if decode("utf-8") raised.
3) _process_terminate() now calls _kill_group(signal.SIGTERM) for
own-pgrp commands, even if self.proc.poll() in bkg.__exit__() already
reaped the leader.
Popen.terminate(), which _process_terminate() used before, skips the
signal once returncode is set, to avoid PID reuse.
If the group is empty and its PID has been reused by a new group leader,
that group would get SIGTERM or SIGKILL. Only ProcessLookupError is
handled. PID reuse inside such a short window is unlikely, but nothing
here rules it out.
[ ... ]
> def _process_terminate(self, terminate, timeout):
> if terminate:
> - self.proc.terminate()
> + if self._own_pgrp:
> + self._kill_group(signal.SIGTERM)
> + else:
> + self.proc.terminate()
[Severity: Low]
SIGTERM now goes to the whole group for own-pgrp commands. Is the warning
in bkg.__init__() still accurate for them?
if shell and self.terminate:
print("# Warning: combining shell and terminate is risky!")
print("# SIGTERM may not reach the child on zsh/ksh!")
Take bkg(..., shell=True, ksft_ready=True) with no exit_wait or
ksft_wait. self.terminate is set and the warning prints, yet os.killpg()
now delivers SIGTERM to the shell's children. No in-tree caller combines
these today.
> stdout, stderr = self.proc.communicate(timeout=timeout)
[Severity: Low]
Should this path also kill whatever is left of the group? On a normal
teardown of an own-pgrp command, bkg.__exit__() runs with no exception,
calls process(), and this communicate() succeeds. Nothing then sends the
final group SIGKILL that _collect_reaped() and _kill_leftovers() send.
Workers of a readiness wrapper that redirected their own output don't keep
communicate() waiting. No TimeoutExpired fires, so _kill_leftovers() never
runs.
Leaving such workers behind on a normal exit predates this patch. Before,
though, they stayed in Python's process group, so a later Ctrl-C or
runner group SIGTERM reached them. Now they sit in a separate session that
nothing signals. No in-tree readiness helper uses such a wrapper today.
> self.stdout = stdout.decode("utf-8")
> self.stderr = stderr.decode("utf-8")
[ ... ]
> @@ -202,8 +408,18 @@ class bkg(cmd):
> # since forcing termination silences failures with fail=None
> if self.proc.poll() is None:
> terminate = terminate or (self._exit_wait and ex_type is not None)
> - return self.process(terminate=terminate, fail=self.check_fail,
> - expect_fail=self.expect_fail)
> + if ex_type is None:
> + return self.process(terminate=terminate, fail=self.check_fail,
> + expect_fail=self.expect_fail)
> + # Cancelled, e.g. by Ctrl-C: stop the command and what it started,
> + # without replacing the exception in flight.
> + if self._own_pgrp:
> + self._cleanup_quietly(self._reap_cancelled, terminate, 20)
> + else:
> + self._cleanup_quietly(self.process, terminate=terminate,
> + fail=self.check_fail,
> + expect_fail=self.expect_fail)
> + return None
[Severity: Medium]
For a ksft_wait command, can a cancelled bkg() now stall for 20
seconds before anything stops the helper?
bkg.__init__() sets self.terminate to False whenever ksft_wait is
given, and self._exit_wait is False unless exit_wait was passed. So
terminate stays False in __exit__() even with an exception in flight,
and _reap_cancelled() runs with terminate=False and timeout=20.
It writes to ksft_term_fd and skips the group SIGTERM. Then
_drain_until_exit() waits the full 20 seconds before
_collect_reaped() sends SIGKILL.
The wait pipe write only helps a helper that is already sitting in
ksft_wait(). napi_id.py runs:
with bkg(listen_cmd, ksft_wait=3) as server:
and then connects to it with socat from cfg.remote. napi_id_helper
calls ksft_ready() and then blocks in accept() and read() before it
reaches ksft_wait(). The remote socat may fail, or the user may hit
Ctrl-C, before the peer has connected. In either case the helper never
reads KSFT_WAIT_FD.
Before this patch, the helper shared Python's process group. Ctrl-C
and the runner's group SIGTERM reached it directly, so it died right
away. With start_new_session it is in its own session, and the only
thing that ends it is the SIGKILL 20 seconds later. A foreground
failure also goes from the 5 second default of process() to 20
seconds.
On a runner timeout, KsftTerminate unwinds into this path, and
teardown blocks for 20 seconds per such helper. If the test process is
killed in that window, the defer queue never runs. The helper's group
is then left in a session that nothing else signals.
Should _reap_cancelled() send SIGTERM to the group whenever an
exception is in flight, as exit_wait commands already get? Or should
it use a much shorter grace period than 20 seconds?
[Severity: Medium]
This branch runs for any exception in flight, not just an interruption. It
also covers commands without their own process group. Is that intended?
Before this patch, a CmdExitFailure, CmdExitZeroFailure or TimeoutExpired
from process() replaced the in-flight exception, and ksft_run() reported
FAIL. Now _cleanup_quietly() catches Exception and only prints a warning.
Take a test body inside with bkg(..., ksft_wait=N), or any
bkg(fail=True), that raises KsftSkipEx or KsftXfailEx after the helper
exited non-zero. ksft_run() now reports SKIP or XFAIL instead of FAIL:
except KsftSkipEx as e:
comment = "SKIP " + str(e)
cnt_key = 'skip'
except KsftXfailEx as e:
comment = "XFAIL " + str(e)
cnt_key = 'xfail'
The else branch also catches remote host= commands and plain local bkg()
users. The commit message only says:
Clean up the group on interruption without masking the original
exception.
Could the commit message describe this change in reported results? Or
could the suppression be limited to interruptions such as
KeyboardInterrupt and KsftTerminate?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg()
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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] bkg.__exit__() handles timeout=None differently on its two
cancellation paths.
--
selftests: net: py: add a timeout argument to bkg()
This patch adds a timeout argument to bkg() so callers can override the
20-second context-exit timeout. A value of None waits indefinitely on
normal exit, while a readiness-enabled command gets one second to exit on
cancellation.
> diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
> index 9edfc4f88621c..1db7a21db6423 100644
> --- a/tools/testing/selftests/net/lib/py/utils.py
> +++ b/tools/testing/selftests/net/lib/py/utils.py
> @@ -274,7 +274,11 @@ class cmd:
> if self.proc.poll() is None:
> if terminate:
> self._kill_group(signal.SIGTERM)
> - self._drain_until_exit((out, err), timeout=timeout)
> + # None waits forever elsewhere; cleanup must end. Not
> + # "timeout or 1", which would change an explicit 0.
> + self._drain_until_exit((out, err),
> + timeout=1 if timeout is None
> + else timeout)
> self._collect_reaped(out, err)
[ ... ]
> @@ -410,15 +415,18 @@ class bkg(cmd):
> terminate = terminate or (self._exit_wait and ex_type is not None)
> if ex_type is None:
> return self.process(terminate=terminate, fail=self.check_fail,
> - expect_fail=self.expect_fail)
> + expect_fail=self.expect_fail,
> + timeout=self.timeout)
> # Cancelled, e.g. by Ctrl-C: stop the command and what it started,
> # without replacing the exception in flight.
> if self._own_pgrp:
> - self._cleanup_quietly(self._reap_cancelled, terminate, 20)
> + self._cleanup_quietly(self._reap_cancelled, terminate,
> + self.timeout)
> else:
> self._cleanup_quietly(self.process, terminate=terminate,
> fail=self.check_fail,
> - expect_fail=self.expect_fail)
> + expect_fail=self.expect_fail,
> + timeout=self.timeout)
[Severity: Medium]
Can cancellation cleanup hang here when bkg() is created with
timeout=None?
The new comment in cmd._reap_cancelled() says "cleanup must end", and that
path maps None to a 1 second grace period. That only covers _own_pgrp
commands, though.
This else branch handles every remote (host=) command and every local
command started without ksft_ready/ksft_wait. It passes self.timeout to
process() unchanged, so None reaches cmd._process_terminate():
bkg.__exit__()
_cleanup_quietly(self.process, ..., timeout=None)
cmd.process()
cmd._process_terminate()
self.proc.terminate()
stdout, stderr = self.proc.communicate(timeout=timeout)
proc.terminate() only signals the leader. If the command ignores SIGTERM,
or if it is a shell whose descendants keep stdout/stderr open, does
communicate(timeout=None) ever return?
_cleanup_quietly() only catches Exception, and nothing is raised in this
case. A test assertion failure inside the with-block would then hang the
runner while the exception unwinds, and no second Ctrl-C is coming to
break out of it.
Before this patch both cancellation paths were bounded at 20 seconds. The
else branch got that from process()'s default timeout=20.
Would it make sense to apply the same "1 if timeout is None else timeout"
mapping in this branch, or to describe the difference in the commit
message? The commit message currently only says:
None waits indefinitely on normal exit, but gives a readiness-enabled
command one second to exit on cancellation.
> return None
>
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
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 <slave>
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 <sec> Send/recv timeout (default: 8); lifetime bound
becomes 2 * <sec> + 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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 cleanup in setup_macvlan()
(tools/testing/selftests/drivers/net/hw/tls_hw_offload.py:839-840)…
- [Low] main()
(tools/testing/selftests/drivers/net/hw/tls_hw_offload.py:883-887)…
- [Low] selftests: net: sysctl_set() duplicates ctl_file_write() and
breaks on dots
--
selftests: net: test TLS fallback after rerouting to an upper device
This adds a TLS offload selftest case. It moves an established offloaded
connection onto a macvlan upper of the same NIC in the middle of the
echo, then checks that the resumed echo goes through the macvlan and
matches the original data. It also adds CONFIG_MACVLAN to the hw
selftest config.
> 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 7d90f1c2024a1..e1382cee8dd13 100755
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
[ ... ]
> +def setup_macvlan(cfg):
> + """Add a macvlan upper on the DUT NIC for the rest of the case.
> +
> + The peer may answer on either MAC, so set loose rp_filter on both.
> + """
> + ip(f"link add {MACVLAN_IFNAME} link {cfg.ifname} type macvlan "
> + "mode bridge")
> + # Runs after the delete: make the peer drop the macvlan's MAC.
> + defer(ip, f"neigh flush to {cfg.addr_v['4']}", host=cfg.remote)
> + defer(ip, f"link del {MACVLAN_IFNAME}")
[Severity: Medium]
Can this deferred remote flush stall or time out, given that it needs the
same path it is meant to repair?
reroute_macvlan() adds the /32 route through tlsmv0 with the DUT's source
address, then pings through it:
ip(f"route add {peer}/32 dev {MACVLAN_IFNAME} src {cfg.addr_v['4']}")
...
wait_reachable(MACVLAN_IFNAME, peer)
The macvlan then broadcasts an ARP request. The sender IP is the DUT's
IPv4 address and the sender MAC is the macvlan's. On the peer,
arp_process() handles it with:
n = neigh_event_ns(tbl, sha, &sip, dev);
After that, the peer's entry for the DUT address points at the macvlan
MAC. The resumed echo and the SSH traffic keep that entry REACHABLE.
The defers run in reverse order: route del, the two rp_filter restores,
link del tlsmv0, and only then the remote neigh flush. Deleting the
macvlan removes its MAC from the NIC unicast filter. The peer, however,
keeps sending to that MAC.
The README.rst example uses REMOTE_ARGS=root@192.168.1.2 with
REMOTE_V4=192.168.1.2, so the SSH connection runs between the test
addresses. In that setup, the new ssh for the flush gets its SYN-ACKs
sent to the deleted MAC, and they are dropped. This lasts until
neighbour state recovers on its own, which can take tens of seconds.
cmd() has a 20s default timeout.
If this raises TimeoutExpired, ksft_flush_defer() sets
KSFT_RESULT=False. That fails a run in which the test itself passed. If
the ssh does succeed, the peer's entry has already been corrected, so
the flush has no effect.
There is also a second gap. Other hosts on the segment that already had
an entry for the DUT address are updated to the macvlan MAC by the same
broadcast request, through the "Update our ARP tables" path in
arp_process(). Nothing flushes those entries.
> + sysctl_set(f"net.ipv4.conf.{cfg.ifname}.rp_filter", 2)
> + sysctl_set(f"net.ipv4.conf.{MACVLAN_IFNAME}.rp_filter", 2)
> + ip(f"link set dev {MACVLAN_IFNAME} up")
> + wait_carrier(MACVLAN_IFNAME)
[Severity: Low]
Is there a reason not to use ctl_file_write() here?
tools/testing/selftests/net/lib/py/utils.py already provides it, and
drivers/net/hw/lib/py/__init__.py re-exports it for the hw tests. Its
docstring names sysctls as a target. It reads and writes the /proc/sys
file directly from Python, skips the write when the value is already
set, and defers restoring the old value. That is what sysctl_set()
reimplements.
The hand-rolled version also differs from it in two ways.
First, it runs the sysctl binary through cmd(), but the case never
calls cfg.require_cmd("sysctl"). On a minimal rootfs without procps,
this raises FileNotFoundError from setup_macvlan() instead of skipping.
check_tls_support() in this same file already handles a missing
modprobe, so that kind of environment looks expected here.
Second, setup_macvlan() builds the key with dots:
net.ipv4.conf.{cfg.ifname}.rp_filter. sysctl treats dots as path
separators. If cfg.ifname itself contains a dot, as a VLAN such as
eth0.100 does, the name is split in the wrong place and the lookup
fails with ENOENT. Passing
/proc/sys/net/ipv4/conf/<ifname>/rp_filter to ctl_file_write() avoids
both problems.
Minor: the rp_filter restore deferred for tlsmv0 does nothing useful.
The link del defer deletes the macvlan right after that restore runs.
[ ... ]
> @@ -800,6 +883,7 @@ def main() -> None:
> # Flap the NIC last, so a slow retrain cannot fail later cases.
> ksft_run([test_tls_offload, test_tls_offload_sizes,
> test_tls_offload_record_type, test_tls_offload_bond,
> + test_tls_offload_upper_reroute,
> test_tls_offload_bond_bounce], args=(cfg, ))
[Severity: Low]
Doesn't this placement go against the comment just above the list?
# Flap the NIC last, so a slow retrain cannot fail later cases.
test_tls_offload_bond takes cfg.ifname down in setup_bond(). After that,
restore_nic() waits for carrier only as a best effort:
# Best effort: the next case waits for carrier itself.
Before this patch, the next case was test_tls_offload_bond_bounce. Its
wait_bond_ready() waits for carrier and calls wait_reachable() for the
peer.
The new case waits for carrier only indirectly, through
wait_carrier(MACVLAN_IFNAME) in setup_macvlan(). It never checks that the
peer is reachable over cfg.ifname before run_tls_test() starts the first
half of the echo.
If reachability lags carrier after the bond case's flap, could the new
case fail for a reason that belongs to the previous case?
Would listing test_tls_offload_upper_reroute before test_tls_offload_bond
follow the documented order? The same placement is still there at the
end of the series, where test_tls_offload_frag is also inserted before
test_tls_offload_bond_bounce.
> ksft_exit()
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
@ 2026-12-06 0:23 ` netdev-bot+sashiko
0 siblings, 0 replies; 17+ messages in thread
From: netdev-bot+sashiko @ 2026-12-06 0:23 UTC (permalink / raw)
To: rjethwani
Cc: netdev, stable, john.fastabend, kuba, sd, davem, edumazet, pabeni,
willemb, horms, alice.kernel, tariqt
Thank you for your contribution! Sashiko AI review found 7 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 6
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] test_tls_offload_frag() checks only that the bpftrace binary
and /sys/kernel/btf/vmlinux exist (lines 1053-1056).
- [Low] In tools/testing/selftests/drivers/net/hw/tls_hw_offload.c, the
new helper set_pmtudisc_dont() was inserted between…
- [Low] The commit message leaves out information a maintainer or
backporter needs.
- [Low] print_usage() in tls_hw_offload.c (line 792) documents the new -D
option as client-only ('Clear DF, letting IP fragment (client)'), the…
- [Low] wait_bpftrace_attached() (tls_hw_offload.py:994-1008) builds fds
= [stdout, stderr] and processes select()'s ready list in that order.
- [Low] selftests: net: FRAG_BPFTRACE skb pointer reuse race in
ip_do_fragment()
- [Low] selftests: net: unsorted CONFIG_NETFILTER entries in
drivers/net/hw/config
--
selftests: net: verify that IP refuses to fragment TLS offload data
This commit adds test_tls_offload_frag(). The test pauses an offloaded TLS
echo and reroutes it onto a small-MTU policy route, on either the NIC or a
macvlan upper. It then uses bpftrace and nftables counters to check that
ip_do_fragment() refuses the marked skbs. It also adds a -D option that
sets IP_PMTUDISC_DONT on the client socket of the C helper, and extends
the drivers/net/hw selftests config.
> selftests: net: verify that IP refuses to fragment TLS offload data
>
> [ ... ]
>
> A stalled echo alone does not prove IP refused fragmentation. Verify
> that TX offload was active, ip_do_fragment() returned -EMSGSIZE for
> the marked skbs, and no fragment reached output or device egress.
[Severity: Low]
Could the commit message name the kernel fix this test depends on?
The -EMSGSIZE return that the bpftrace script checks for comes from "net:
don't fragment skbs that still need device crypto". The only hint in the
patch is the "Without the fix" comment above FRAG_BPFTRACE. The other two
tests in this series both quote the fix they fail without, for example:
Without "tls: device: don't let the NIC encrypt fallback output again",
the echo mismatches.
The subject also says "IP", but test_tls_offload_frag() only covers IPv4.
It calls cfg.require_ipver("4"), uses nft "table ip" and "ip frag-off",
and runs the client with -4. The harness never reaches the
IPV6_PMTUDISC_DONT branch of set_pmtudisc_dont().
The patch also adds 13 symbols to the shared drivers/net/hw config
(DEBUG_INFO_BTF, FUNCTION_TRACER, BPF_JIT, NETFILTER_EGRESS, NF_TABLES*,
IP_MULTIPLE_TABLES, INET_DIAG and others). It adds bpftrace, nft and ss as
new tool dependencies too. Would it be worth mentioning these in the
message?
> 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 9c1c546d36cf6..73cb7a8a7b0f3 100644
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.c
[ ... ]
> @@ -254,6 +257,19 @@ static int install_tls_key(int fd, int direction, int cipher)
> * family and %zone scope IDs in link-local addresses). Returns the fd on
> * success, -1 on error (with the fd already closed).
> */
> +static int set_pmtudisc_dont(int fd, int family)
> +{
> + int val;
> +
> + if (family == AF_INET6) {
> + val = IPV6_PMTUDISC_DONT;
> + return setsockopt(fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val,
> + sizeof(val));
> + }
> + val = IP_PMTUDISC_DONT;
> + return setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val));
> +}
> +
> static int client_connect_tls(void)
[Severity: Low]
Was set_pmtudisc_dont() meant to go above this comment? The block comment
for client_connect_tls() ("Open a TCP connection to server_ip:server_port,
switch to the TLS ULP ... Returns the fd on success, -1 on error (with the
fd already closed)") now sits directly above set_pmtudisc_dont().
set_pmtudisc_dont() returns setsockopt()'s 0/-1 and does not close the fd.
The caller does that. client_connect_tls() is now left without a comment.
[ ... ]
> @@ -818,6 +841,9 @@ int main(int argc, char *argv[])
> case 'P':
> pause_mid = 1;
> break;
> + case 'D':
> + pmtudisc_dont = 1;
> + break;
> case 'T':
> io_timeout_s = atoi(optarg);
> if (io_timeout_s < 1 || io_timeout_s > 120) {
[Severity: Low]
This isn't a bug, but print_usage() marks -D as "(client)", the same as
-P. The server-mode block later in main() warns about and clears the
other client-only options:
if (is_server) {
...
if (pause_mid) {
printf("warning: -P is ignored in server mode\n");
pause_mid = 0;
}
}
Should -D get the same "ignored in server mode" warning? At the moment
"server -D" is accepted without any message.
> 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 e1382cee8dd13..a937ec979a7bf 100755
> --- a/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
> +++ b/tools/testing/selftests/drivers/net/hw/tls_hw_offload.py
[ ... ]
> @@ -873,6 +894,240 @@ def test_tls_offload_upper_reroute(cfg):
[ ... ]
> +def wait_bpftrace_attached(trace, timeout=30):
> + """Wait until bpftrace reports its probes attached, on either pipe."""
> + fds = [trace.proc.stdout.fileno(), trace.proc.stderr.fileno()]
> + deadline = time.monotonic() + timeout
> + seen = b""
> + while b"attached_probes" not in seen and b"Attaching " not in seen:
> + left = deadline - time.monotonic()
> + rlist = select.select(fds, [], [], left)[0] if left > 0 else []
> + if not rlist:
> + raise KsftFailEx(f"bpftrace did not attach: {seen!r}")
> + for fd in rlist:
> + data = os.read(fd, 4096)
> + if not data:
> + raise KsftFailEx(f"bpftrace exited: {seen!r}")
[Severity: Low]
Can this lose bpftrace's error message? Suppose bpftrace writes an error
to stderr and exits before this loop reads it. select() then returns both
fds. stdout is first in fds, so its EOF raises "bpftrace exited: b''"
before the pending stderr data is read.
The exception then leaves the with bkg(...) block. bkg.__exit__() stores
the rest of the output in trace.stderr through _cleanup_quietly(), but
nothing prints it. With fail=False, no CmdExitFailure carries it either.
Would reading every ready fd before raising, or including trace.stderr in
the exception, show the real cause?
[ ... ]
> +def test_tls_offload_frag(cfg, upper):
[ ... ]
> + require_tls_setup(cfg)
> + if 'Tx' not in cfg.tls_hw_directions:
> + raise KsftSkipEx("Fragmentation test requires DUT TLS TX offload")
> + cfg.require_ipver("4")
> + cfg.require_cmd("nft")
> + cfg.require_cmd("bpftrace")
> + cfg.require_cmd("ss")
> + if not os.path.exists("/sys/kernel/btf/vmlinux"):
> + raise KsftSkipEx("Fragmentation test requires CONFIG_DEBUG_INFO_BTF")
[Severity: Medium]
These checks only confirm that the bpftrace binary and vmlinux BTF exist.
FRAG_BPFTRACE also needs fentry/fexit trampoline support, the "args.skb"
syntax, and a traceable ip_finish_output2(). What happens when one of
those is missing?
bpftrace would fail to parse or attach and then exit.
wait_bpftrace_attached() turns that into a test failure:
if not data:
raise KsftFailEx(f"bpftrace exited: {seen!r}")
That would happen with an older bpftrace that only accepts "args->" for
fentry probes. I believe "args." arrived around 0.21, but have not
confirmed that. It would also happen on an arch without ftrace direct-call
trampolines. Either way the result is a failure rather than a skip. Every
other missing prerequisite in this function raises KsftSkipEx.
netpoll_basic.py also fails when bpftrace fails, but it only uses a plain
kprobe.
Would it make sense to treat a bpftrace startup failure as KsftSkipEx, or
to check for fentry support up front?
[ ... ]
> @@ -873,6 +894,240 @@ def test_tls_offload_upper_reroute(cfg):
> f"({sent} bytes)")
>
>
> +def client_mss(peer, port):
> + """The MSS the test client's established socket sizes segments by.
> +
> + -O prints one line per socket. Not finding exactly one is a test
> + failure; ss not reporting the MSS of the one found is a skip.
> + """
> + out = cmd(f"ss -tinHO state established dst {peer} "
> + f"dport = :{port}").stdout
> + socks = [line for line in out.splitlines() if line.strip()]
> + if len(socks) != 1:
> + raise KsftFailEx(f"Expected one client socket to port {port}, "
> + f"found {len(socks)}: {out.strip()!r}")
> + # Not advmss: or rcvmss:.
> + found = re.search(r"\bmss:(\d+)", socks[0])
> + if not found:
> + raise KsftSkipEx(f"ss reports no mss: for the client socket: "
> + f"{socks[0].strip()!r}")
> + return int(found.group(1))
> +
> +
> +def frag_reroute(cfg, port, dev):
> + """Reroute the connection onto a small-MTU route without TCP noticing.
> +
> + TCP keeps sizing segments for the socket's route, but the route chain
> + re-runs the lookup (ip_route_me_harder()) after marking the skb, so
> + each segment leaves through the policy route and exceeds its MTU. A
> + full segment is the MSS plus at least 40 bytes of headers, so an MTU
> + of at most the MSS is below it whatever the path the connection
> + started on.
> + """
> + peer = cfg.remote_addr_v["4"]
> + mtu = min(FRAG_MTU, client_mss(peer, port))
> + if mtu < 68:
> + raise KsftSkipEx(f"MSS {mtu} leaves no IPv4 MTU below the segments")
> + ip(f"route add {peer}/32 dev {dev} mtu {mtu} table {FRAG_RT_TABLE}")
> + defer(ip, f"route del {peer}/32 dev {dev} table {FRAG_RT_TABLE}")
> + # "create" fails if the table exists, so never delete one we do not own.
> + cmd(f"nft create table ip {FRAG_NFT_TABLE}")
> + defer(cmd, f"nft delete table ip {FRAG_NFT_TABLE}")
> + cmd(f"nft add chain ip {FRAG_NFT_TABLE} out "
> + "{ type route hook output priority mangle ; }")
> + cmd(f"nft add rule ip {FRAG_NFT_TABLE} out ip daddr {peer} "
> + f"tcp dport {port} meta mark set {FRAG_MARK}")
> +
> +
> +def frag_count_egress(dev):
> + """Count the rerouted flow's IPv4 fragments that reach dev.
> +
> + Egress runs before validate_xmit_skb(), so this also counts fragments
> + that tls_sw_fallback() or the driver would drop.
> + """
> + table = f"netdev {FRAG_NFT_EGRESS_TABLE}"
> + cmd(f"nft create table {table}")
> + defer(cmd, f"nft delete table {table}")
> + cmd(f"nft add counter {table} frags")
> + cmd(f"nft add chain {table} out "
> + f"{{ type filter hook egress device {dev} priority 0 ; }}")
> + cmd(f"nft add rule {table} out meta mark {FRAG_MARK} "
> + "ip frag-off & 0x3fff != 0 counter name frags")
> +
> +
> +def read_nft_counter(family, table, name):
> + """Packet count of a named nftables counter."""
> + out = json.loads(cmd(f"nft --json list counter {family} {table} "
> + f"{name}").stdout)
> + return next(obj["counter"]["packets"] for obj in out["nftables"]
> + if "counter" in obj)
> +
> +
> +# @ret: ip_do_fragment() return values for rerouted segments. @frags:
> +# their fragments handed to ip_finish_output2(). Without the fix, a
> +# fragment can fail in output() and never reach the egress counter, so
> +# count both. The skb is not dereferenced on return, where it may be
> +# freed. frag_off is read bytewise to avoid a byte swap.
> +FRAG_BPFTRACE = f"""
> +fentry:ip_do_fragment
> +/args.skb->mark == {FRAG_MARK}/
> +{{
> + @in[(uint64)args.skb] = 1;
> +}}
> +fexit:ip_do_fragment
> +/@in[(uint64)args.skb]/
> +{{
> + @ret[retval] = count();
> + delete(@in[(uint64)args.skb]);
> +}}
> +fentry:ip_finish_output2
> +/args.skb->mark == {FRAG_MARK}/
> +{{
> + $frag_off = args.skb->head + args.skb->network_header + 6;
> + if ((*(uint8 *)$frag_off & 0x3f) || *(uint8 *)($frag_off + 1)) {{
> + @frags = count();
> + }}
> +}}
> +"""
> +
> +
> +def wait_bpftrace_attached(trace, timeout=30):
> + """Wait until bpftrace reports its probes attached, on either pipe."""
> + fds = [trace.proc.stdout.fileno(), trace.proc.stderr.fileno()]
> + deadline = time.monotonic() + timeout
> + seen = b""
> + while b"attached_probes" not in seen and b"Attaching " not in seen:
> + left = deadline - time.monotonic()
> + rlist = select.select(fds, [], [], left)[0] if left > 0 else []
> + if not rlist:
> + raise KsftFailEx(f"bpftrace did not attach: {seen!r}")
> + for fd in rlist:
> + data = os.read(fd, 4096)
> + if not data:
> + raise KsftFailEx(f"bpftrace exited: {seen!r}")
> + seen += data
> +
> +
> +def bpftrace_maps(stdout):
> + """Maps from bpftrace's JSON output, by name without the "@"."""
> + maps = {}
> + for line in stdout.splitlines():
> + try:
> + obj = json.loads(line)
> + except ValueError:
> + continue
> + if obj.get("type") == "map":
> + for name, value in obj["data"].items():
> + maps[name.lstrip("@")] = value
> + return maps
> +
> +
> +def frag_route_dev(cfg, upper):
> + """Return the device for the small-MTU route, setting it up if needed."""
> + if not upper:
> + return cfg.ifname
> + setup_macvlan(cfg)
> + return MACVLAN_IFNAME
> +
> +
> +@ksft_variants([
> + KsftNamedVariant("same_dev", False),
> + KsftNamedVariant("upper", True),
> +])
> +@ksft_disruptive
> +def test_tls_offload_frag(cfg, upper):
> + """IP must not fragment kTLS offload plaintext.
> +
> + Every rerouted segment must be refused by ip_do_fragment(), and the
> + connection must stall rather than deliver or corrupt data: the server
> + must have received nothing beyond the bytes echoed before the pause.
> + Segments under the MTU, such as a record's tail, can still leave, but
> + out of order behind a refused one. MTU probing is off, as it would
> + shrink the MSS and end the stall.
> + """
> + require_tls_setup(cfg)
> + if 'Tx' not in cfg.tls_hw_directions:
> + raise KsftSkipEx("Fragmentation test requires DUT TLS TX offload")
> + cfg.require_ipver("4")
> + cfg.require_cmd("nft")
> + cfg.require_cmd("bpftrace")
> + cfg.require_cmd("ss")
> + if not os.path.exists("/sys/kernel/btf/vmlinux"):
> + raise KsftSkipEx("Fragmentation test requires CONFIG_DEBUG_INFO_BTF")
> +
> + peer = cfg.remote_addr_v["4"]
> + dev = frag_route_dev(cfg, upper)
> + sysctl_set("net.ipv4.tcp_mtu_probing", 0)
> + # frag_reroute() fills the table; until then, lookups fall through it.
> + ip(f"rule add fwmark {FRAG_MARK} lookup {FRAG_RT_TABLE}")
> + defer(ip, f"rule del fwmark {FRAG_MARK} lookup {FRAG_RT_TABLE}")
> + frag_count_egress(dev)
> +
> + port = rand_port()
> + server_cmd = (f"{cfg.bin_remote} server -p {port} -c 128 -v 1.2 -4 "
> + f"-T {FRAG_SERVER_IO_TIMEOUT_S}")
> + client_cmd = (f"{cfg.bin_local} client -s {peer} -p {port} -c 128 "
> + "-v 1.2 -4 -P -D")
> +
> + tls_before = read_tls_stats()
> + peer_before = read_tls_stats(host=cfg.remote)
> + # Both helpers stall and time out, so check their outcome below.
> + with bkg(["bpftrace", "-f", "json", "-e", FRAG_BPFTRACE],
> + fail=False) as trace:
> + wait_bpftrace_attached(trace)
> + with bkg(server_cmd, host=cfg.remote, exit_wait=True, fail=False,
> + timeout=FRAG_SERVER_LIFETIME_S + 15) as server:
> + wait_port_listen(port, host=cfg.remote)
> + with bkg(client_cmd, ksft_wait=30, fail=False,
> + timeout=FRAG_CLIENT_LIFETIME_S + 15) as client:
> + frag_reroute(cfg, port, dev)
> + tls_after = read_tls_stats()
> + peer_after = read_tls_stats(host=cfg.remote)
> +
> + dev_tx = stat_diff(tls_before, tls_after, 'TlsTxDevice')
> + ksft_ge(dev_tx, 1,
> + comment=f"HW TX offload not engaged (TlsTxDevice={dev_tx})")
> +
> + maps = bpftrace_maps(trace.stdout)
> + rets = maps.get("ret", {})
> + refused = rets.get(str(-errno.EMSGSIZE), 0)
> + ksft_ge(refused, 1,
> + comment=f"no rerouted segment was refused by ip_do_fragment() "
> + f"(returns: {rets})")
> + ksft_eq(sum(rets.values()), refused,
> + comment=f"ip_do_fragment() returned other than -EMSGSIZE for "
> + f"rerouted segments (returns: {rets})")
> + built = maps.get("frags", 0)
> + ksft_eq(built, 0,
> + comment=f"ip_do_fragment() passed {built} fragments of rerouted "
> + f"segments to ip_finish_output2()")
> +
> + ksft_in("Resumed", client.stdout,
> + comment="client never resumed after the reroute")
> + ksft_not_in("mismatch", client.stdout,
> + comment="client got a corrupted echo")
> + stalled = (client.ret == -signal.SIGALRM or
> + "Resource temporarily unavailable" in client.stdout)
> + ksft_eq(stalled, True,
> + comment=f"client did not stall (exit {client.ret}): "
> + f"{client.stdout.strip()}")
> + decrypt_err = stat_diff(peer_before, peer_after, 'TlsDecryptError')
> + ksft_eq(decrypt_err, 0,
> + comment=f"peer failed to decrypt (TlsDecryptError={decrypt_err})")
> + # The server reports its total once its recv times out.
> + received = re.search(r"Total received: (\d+) bytes", server.stdout)
> + ksft_eq(received is not None, True,
> + comment=f"server did not report its total: "
> + f"{server.stdout.strip()}")
> + ksft_eq(int(received.group(1)) if received else None, PAUSED_ECHO_BYTES,
> + comment="server received data sent after the reroute")
> +
> + frags = read_nft_counter("netdev", FRAG_NFT_EGRESS_TABLE, "frags")
> + ksft_eq(frags, 0,
> + comment=f"offload plaintext was fragmented "
> + f"({frags} fragments reached {dev})")
> +
> +
> def main() -> None:
> """Set up the DUT/peer environment and run the offload test suites."""
> with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
[Severity: Low]
Can this attribute the wrong return value to a rerouted segment? @in
is keyed only by the skb address, but ip_do_fragment() always gives
the skb away before it returns. It calls kfree_skb() on the fail path,
which includes the new -EMSGSIZE refusal. It calls consume_skb() on
the slow path, and output() on the frag_list path. The comment above
notes that the skb may be freed by the time fexit runs. Its address
can also have been reused by then.
__ip_queue_xmit() calls ip_local_out() with BHs enabled. Between the
kfree_skb() and the fexit trampoline, another CPU, or a softirq on
this one, can allocate an skb at the same address and send it through
ip_do_fragment(). Suppose that unmarked skb's fexit runs first. It
matches @in, adds its own return value (0 for a successful
fragmentation) to @ret, and deletes the entry. The real -EMSGSIZE
sample is then dropped. The ksft_eq(sum(rets.values()), refused, ...)
check fails even though the kernel behaved correctly. Two marked skbs
sharing an address the same way would collapse into a single @in
entry, and one of their samples would be lost.
This needs concurrent IPv4 fragmentation on the DUT, so it should be
rare. When it does happen, it shows up as a flaky failure that is hard
to explain. Would keying @in by tid, or by tid and skb, instead of the
bare pointer be enough here? Or is there a way to record the outcome
without relying on the address of an skb that has already been freed?
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/hw/config b/tools/testing/selftests/drivers/net/hw/config
> --- a/tools/testing/selftests/drivers/net/hw/config
> +++ b/tools/testing/selftests/drivers/net/hw/config
> @@ -23,6 +31,11 @@ CONFIG_NET_IPGRE_DEMUX=y
> CONFIG_NET_IPIP=y
> CONFIG_NETKIT=y
> CONFIG_NET_SCH_INGRESS=y
> +CONFIG_NETFILTER=y
> +CONFIG_NETFILTER_EGRESS=y
> +CONFIG_NF_TABLES=m
> +CONFIG_NF_TABLES_IPV4=y
> +CONFIG_NF_TABLES_NETDEV=y
> CONFIG_SYNC_FILE=y
> CONFIG_TLS=y
> CONFIG_TLS_DEVICE=y
[Severity: Low]
This isn't a bug, but the new CONFIG_NETFILTER and
CONFIG_NETFILTER_EGRESS lines land after CONFIG_NET_SCH_INGRESS. The
file is kept sorted. Commit 0e1368a28dd5 ("selftests: drv-net: fix
sort order of makefile and config") fixed it up last time. The order
used is the one that puts CONFIG_NETKIT between CONFIG_NET_IPIP and
CONFIG_NET_SCH_INGRESS. In that order, both new symbols belong ahead
of CONFIG_NET_IPGRE_DEMUX rather than after CONFIG_NET_SCH_INGRESS.
Could they be moved there?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-12-06 0:23 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox