Netdev List
 help / color / mirror / Atom feed
* [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; 10+ 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] 10+ messages in thread

end of thread, other threads:[~2026-12-04 23:56 UTC | newest]

Thread overview: 10+ 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-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 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
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 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox