From: Rishikesh Jethwani <rjethwani@purestorage.com>
To: netdev@vger.kernel.org
Cc: Rishikesh Jethwani <rjethwani@purestorage.com>,
stable@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
Ilya Lesokhin <ilyal@mellanox.com>,
Aviad Yehezkel <aviadye@mellanox.com>,
Boris Pismenny <borisp@mellanox.com>,
Daniel Zahka <daniel.zahka@gmail.com>
Subject: [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto
Date: Fri, 4 Dec 2026 16:53:48 -0700 [thread overview]
Message-ID: <20261204235642.36653-2-rjethwani@purestorage.com> (raw)
In-Reply-To: <20261204235642.36653-1-rjethwani@purestorage.com>
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
next prev parent reply other threads:[~2026-12-04 23:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204235642.36653-2-rjethwani@purestorage.com \
--to=rjethwani@purestorage.com \
--cc=aviadye@mellanox.com \
--cc=borisp@mellanox.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=ilyal@mellanox.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox