From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.227 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796428611; b=QnstbOeBY+z9+kwxkMW5aFTtUPDYLw9+1eRozVsDDAus+5e4SaF6PAiuIE5fhMg+GHzy 3bzO4VEhSFtZCW7QoQpyibIQ3DE4R92p8GYeefit9C7el0oOV1IdLEatHui2O/w9fvhUq 8jzq3Ub2H48EUvuRDC1ccmqm2rX650t9YCATayNTaflg73fQvHy2XQU0TDV/oqk5L1ZAz avbzHlxFijeqAUBeEWY+I8hb3DKY2XWGSGJpIyxsqF+3KBrrnvqB3rQpjqyAVtm+vDC+e eI87rCBvp1dgvwNSm9loHXCJsHwCKoanwJCOyu+Bbo4rMipZmUgqQvA1Gx8sP4/2LGA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796428611; 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: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=goYRIGyF31ie137V4SzWUcuUvkmDJ/HxHzjVcvwGld4=; b=CeY3v+TKEIJ2XEAHQayL8GmYoi9x3qj4KqmAeZjwkhDLz9GLE083VxK2KCySoYlrEIvt 1HBbCxx+VMoPsZXqDTFrM/qby3DPoCIla0XkyPcq7/PQsuBZ3FIJRgo5t3x8icozaoS9A 90HPuTNxdGOpP1GIU+wsD6Z12mSlfoIGQBSYkT/2oweqDin07GxXBuNGeCpQ65YIsyNK3 qwKvgpTIyIjEKvPT8pYzbq5JxU5PAJdnVNIL7pAjLampES1oMGUNuHgyLB4ssfYeZALKY DjMoVNyog4L6bH5ZO4DCdgXaQDJrr1fhQdHrbUN23eai9ZL/zMraqyiE7lAjH9oxujQ== 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=GTXrHgfF; arc=none smtp.remote-ip=74.125.82.227 Received: from mail-dy1-f227.google.com (mail-dy1-f227.google.com [74.125.82.227]) (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 9AF10606A686 for ; Fri, 4 Dec 2026 23:56:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9AF10606A686 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) header.d=purestorage.com header.i=@purestorage.com header.a=rsa-sha256 header.s=google2022 header.b=GTXrHgfF Received: by mail-dy1-f227.google.com with SMTP id 5a478bee46e88-387504e1934so1623383eec.1 for ; Fri, 04 Dec 2026 15:56:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1796428609; x=1797033409; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=goYRIGyF31ie137V4SzWUcuUvkmDJ/HxHzjVcvwGld4=; b=GTXrHgfFESz2+VtXhDFJ+nnFlaeMjzQiOFan1XETSUjxggOix0Njz0HmfYC8+SQd9F 9TNFuCq2VWHC8WyCwwOCGDFbk7qxOKS8XbKRaCt1qwX6iAj9vdESHoJRJhBgJfppAdwv BCe28dVesHNOnl9Rrh8dXbcD5ghRtTCZDqcoEV1Z+rbpZgjgVY4fHfE8h09jY1E6Wa1y iG9c2++hzetwwNxyn+WCT2QrpM9PCdcXnkZ6noHwC80rcVbzdUDf6bzTh218N8fPO5A+ gSbQ6fU7YY1XBLotFLcPVMlc7EmxsxvcYXmlYwZgfpTxrXYfgjv8f+lqAhKlyTBF5FMM 0tVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796428609; x=1797033409; h=content-transfer-encoding:mime-version:references:in-reply-to :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=goYRIGyF31ie137V4SzWUcuUvkmDJ/HxHzjVcvwGld4=; b=1U5R2/prUB2MpxENnAbHw0uc9ACnjBNH/YXf/g5YeAqroZKFKYZNFsSXfNbclc4w2f EIfWYb8KL+yDfpHkr26N9oyrmDr41vPgItIFJI781/6zhqFq1q58kbguzTNVFyvkRGuT /SEdKrYAXKjSBPBJ2dAeR/Cze13rh2UG2CQzi6gi2dwG/BaFpXdje24KqF6GFMcVQz4n /6qbxjHKes6J1pEPN3gTN0emZhgWIBcnaqePhpuIsSETBFaeSz0uhvVecelaBCAqO4uF 0FaNGKFONRBEiDLWo58dVu83FRfSeLsjIjtU6HdbqdSxfHd4kxeR4KWrwAcSFRyRvcCM PfcQ== X-Gm-Message-State: AB4q+uE6gmveeFdgzY6WThTTzBibN6npjR0FgBWeNuBsrneLjM7SWwc9 Xyr77cRFuZgZ+xu1kpzw/7fVpWEkBkTKdQP9161G9pIWrpAHP1uh4LRX3W16LBtEOZxaNlqqQT9 W9xcIp3Oo398s3dymANt9FHYR2VO3XA/IXKJEW4kR/lG4+u6g3XZr X-Gm-Gg: AZFdTZcxTSdY95Me4HC0jSZNEzkCFwsc3Gm/AHNnMktNtDEf93Th91AJcX2Lqb4bvUA tqH7SczfL4jNz9UaKG9H8zD8kJB6wh1nWcd6Pzo+aX8+GM3hYdxwtYPr2c1OQPK9BlqM014z24V pU35KRjkmUooSyxkGU4FWXxHa5jzKI7GF7ADslmGBq2G1sTtU/AagEbgxwphXtRZcROPnRiiMrb jquWPrW8HuKjOSNYgjr893PmmGaXBCjhcTVqxkR54I8h1USDY/vPW+bvwt/pn4dyFgJ9QgWNL8X Zf+EynkzBmlB+byCJhgVKt1NQ0gdYEg9LNYumAmYi0IV8AhurDiVo9ufpbVkB7DQy0sNUcw2qZS RaVNs3hY0KYZ2mLDVQMbu X-Received: by 2002:a05:7301:d80e:10b0:386:240c:19d6 with SMTP id 5a478bee46e88-3875212bcb9mr3259867eec.6.1796428608720; Fri, 04 Dec 2026 15:56:48 -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 5a478bee46e88-3875217d854sm552485eec.4.2026.12.04.15.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 15:56:48 -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 00807400F2; Fri, 4 Dec 2026 16:56:48 -0700 (MST) Received: by dev-rjethwani.dev.purestorage.com (Postfix, from userid 1557719937) id F1DA7DCE140; Fri, 4 Dec 2026 16:56:47 -0700 (MST) From: Rishikesh Jethwani To: netdev@vger.kernel.org Cc: Rishikesh Jethwani , stable@vger.kernel.org, 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 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 Message-ID: <20261204235642.36653-2-rjethwani@purestorage.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261204235642.36653-1-rjethwani@purestorage.com> References: <20261204235642.36653-1-rjethwani@purestorage.com> 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 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 --- 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