From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.228 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796428609; b=MSMgHRm3tcfi/r7NqAGG0W0QwKfQZyxECPszEJRn/92Pq98TkwMt1O/D40Pf9vozF/Hd d/2sj0i5Yekymw6u5jpZkU5G0f7z6yQuN4gMCAySFL4py15LZnKVqidB6qNCIBFHpe2Ve sPJI5i9rSIWmDRXhBrtrPtjovrfGCJmi+gFiRz8WtpM+PGWqfHWh+79OMfoZ69G0ZbgmQ c9j8XFHhXqhTuf4chG8WY6JeH3AgkkN0mRCQeVghJHeO7Su7fZnIi1Vmidypm84TnJGZy kyEKH1NNfDJaJ6b48Orf7MCd8aSlYYFidr04jxJ0n4NVAc4OFuyIB0Q/xjspC21+aPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796428609; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:X-Relaying-Domain: Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=r4nFf8qR9WapvNzDya/q8KCMU0BTtI9tNiu36YALIw4=; b=TxMeGm3MebN6ijunAFp8jelVWWAOqJC+CNdVAv1EVzLrHqodyySSiutIhdQ21h+NzECL v+lo/aj0PTFuCT4cVR9McRhYPb0qc3zIMPu+cNM9RSqeswhQRiUdE8+//l8XWc2KrXoXJ 0Nt3rXPoamxeEsolgm4hNVE4VygpbYqG0TVmcY4F0j4osrD9Pi9rHRZAAgFUftc2ADUk0 U/7pSYzJdgFYTmCjRbPzA7kADyHI/PiQAMmPEEAOF3tmBuFTx15N2GJlFXWvQbhqSfCYZ W2aXmKGQD3gIAS/G6rbYOtpZIANxjIE6ASC4flxsZJPYBxxug3FD1bdoQrIQfEKQwTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=purestorage.com; spf=pass smtp.mailfrom=purestorage.com; dkim=pass header.d=purestorage.com header.i=@purestorage.com header.a=rsa-sha256 header.s=google2022 header.b=XAWYYSVN; arc=none smtp.remote-ip=209.85.215.228 Received: from mail-pg1-f228.google.com (mail-pg1-f228.google.com [209.85.215.228]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7944D606A681 for ; Fri, 4 Dec 2026 23:56:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7944D606A681 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=purestorage.com header.i=@purestorage.com header.a=rsa-sha256 header.s=google2022 header.b=XAWYYSVN Received: by mail-pg1-f228.google.com with SMTP id 41be03b00d2f7-ce12248de51so652742a12.0 for ; Fri, 04 Dec 2026 15:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1796428607; x=1797033407; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=r4nFf8qR9WapvNzDya/q8KCMU0BTtI9tNiu36YALIw4=; b=XAWYYSVN9mAul7V+I14PFwTlPm5Fj0D+T4FI1F1M8DbKcAR51QsZGVL7iRp+pmxlhR 2IVu+L3y87WGVXZ/7W5e58q+HlkLC4JlxSxCV4yHFmOlrItCUSuRBy1YG8Hx+WoCXeAl +V/39ZxKEXxa4XqB1EMXgDNjxo7aDV0yc2McFIrECj0+oteRh4gbAqGhYY78apgQV+YH pexTekfrkeAgr8yI33NIseXWiPnd1yI3krjiH7tS6nnO34tXdP7z4CGbeiiEVC+xZ8ko TDvX8Xy3MYpFDLIUZozawZF4H4xIEkKG68vJfUcl/szldZ/leFJfsYGBmuOpp6V/LrNu TDCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796428607; x=1797033407; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=r4nFf8qR9WapvNzDya/q8KCMU0BTtI9tNiu36YALIw4=; b=V1psDz2j7c0TTUF+ZONa6W0npXT0Oz4FhRAAHdpK4wdPvalBSL5+Cu40lN8Vgetlfx LJwN7GZuX4lqFNywAoS0d9pNVlwhc8NjxBi3oTP16KQFPpC6PjqfzJBEncWyx0UdfLeN f+cIDXrz15PCrH2Sa3VBW63BcvcyDcJ+hvPik3mWQoiD1dkXk2vHgl5LHy5n3d6uF3fr Lspu7gnE+v4vB8EMBif9sXlBRIiwSD7kmt90JN4dm88uvKs11rHP5bsyhlAlxvd0Q1Qs 8K5NZVFxKlQJJPZVYOBvqiF7FEcBUEnhY8wqV+M/ngOG8n4Z46+AHJkrbVt5ArhJa+TE aolw== X-Gm-Message-State: AB4q+uF3wE+aYga5N8fFgVVH3IXNTvLbZHcwcUlUu+8gKOMc+S+Njz2D gkygI0cfMuPTgqIqpZhqXxujmjl4eiz4Ytme75AmJqHo/3eocBAR8ZjvXApNA9Zbl4eAvWZZt/5 VfYACNqy4X9DBzSm/RXwsDsyLVTuAW+cZgrFW0KoEdk3V2DBWfU3GkY7fyBxkIoKlT1lIFJP75N uYgC7gdaKDPelE6LZdQdYMiOyIYp/LurUK5um/3Z78V7LdIen3Bk6qAhGgAIdsLrRIgroSwZRr6 DdHGt4v/Lgntll0Z3GIAMPFe4CrkQE= X-Gm-Gg: AZFdTZcB+lOGvXHlWqep2s2ZuAehf621xcIGx7GyxWauPsLrU2XhGZ6w4JaR6tMGqT5 nYq+LI0pHiK+sMf3fPsrpc6DAuIwYsnNky5jxmgCApBFqZArMjnrn6//1UHwj3CuL/K5H5vspFK VydISOYjzYvJ5teruIXPeAZ/mNQmvUsgT9jmM8voH7jzmREEpsDlOMkzk3t6YJp9+kuWkL+2jNd n8LNSCLTZz0lbX4O/fg8YCxT/653oRPtReTpMTRtVzgX3vKywMC6oYo+e/H/fF4rk6zb8dHCFu6 mog1XoNu/+T8MkNbP+bfEZJwKOlzP3urfLLmennqvlCgR2apHuHqXZuLYvaFnjlkG0fmrCAADpt qDpm+U3fOOl0qs+sEmcE= X-Received: by 2002:a17:90b:5483:b0:3ac:97bc:4c98 with SMTP id 98e67ed59e1d1-3b5e06c4bccmr2958261a91.64.1796428606559; Fri, 04 Dec 2026 15:56:46 -0800 (PST) Received: from c7-smtp-2026.dev.purestorage.com ([2620:125:9017:12:36:3:6:0]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-3b5c7aa46e5sm4337468a91.3.2026.12.04.15.56.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 15:56:46 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-rjethwani.dev.purestorage.com (dev-rjethwani.dev.purestorage.com [IPv6:2620:125:9025:23::2ea]) by c7-smtp-2026.dev.purestorage.com (Postfix) with ESMTP id E48B9400F2; Fri, 4 Dec 2026 16:56:45 -0700 (MST) Received: by dev-rjethwani.dev.purestorage.com (Postfix, from userid 1557719937) id DDEF0DCE140; Fri, 4 Dec 2026 16:56:45 -0700 (MST) From: Rishikesh Jethwani To: netdev@vger.kernel.org Cc: Rishikesh Jethwani Subject: [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Date: Fri, 4 Dec 2026 16:53:47 -0700 Message-ID: <20261204235642.36653-1-rjethwani@purestorage.com> X-Mailer: git-send-email 2.50.1 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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