Article View: linux.kernel.netdev
Article #6954Re: [PATCH net] tls: device: keep tls_sw_fallback() from encrypting its own output
From: netdev-bot+sashiko
Date: Fri, 23 Oct 2026 21:39
Date: Fri, 23 Oct 2026 21:39
111 lines
11968 bytes
11968 bytes
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] The patch makes complete_skb() in
net/tls/tls_device_fallback.c run `nskb->decrypted = 0;` on every skb…
--
tls: device: keep tls_sw_fallback() from encrypting its own output
This patch makes tls_sw_fallback() pass through any skb that lacks the
decrypted bit. It also makes complete_skb() clear the decrypted bit on
the fallback's output. Together these stop a skb from being encrypted a
second time when it is validated at both a bond master and its slave.
> diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
> index 3b7d0ab2bcf1..24fba12febd1 100644
> --- a/net/tls/tls_device_fallback.c
> +++ b/net/tls/tls_device_fallback.c
> @@ -192,6 +192,14 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln)
> skb->destructor = NULL;
> skb->sk = NULL;
>
> + /* nskb carries ciphertext now, but skb_copy_header() inherited the
> + * plaintext original's decrypted bit. Clear it so the bit keeps meaning
> + * "still-plaintext, needs an encryptor": a requeued nskb would otherwise
> + * be re-validated and encrypted a second time on any re-entry into
> + * tls_sw_fallback().
> + */
> + nskb->decrypted = 0;
[Severity: Medium]
Can clearing skb->decrypted here strip PSP encapsulation from fallback
output?
PSP also uses skb->decrypted on transmit, but it means "this skb belongs
to a PSP TX association". The bit is set at enqueue time:
include/net/psp/functions.h:psp_enqueue_set_decrypted() {
...
pas = psp_sk_assoc(sk);
if (pas && pas->tx.spi)
skb->decrypted = 1;
}
Drivers then use it to decide on PSP TX offload:
include/net/psp/functions.h:psp_skb_get_assoc_rcu() {
if (!skb->decrypted || !skb->sk)
return NULL;
return psp_sk_get_assoc_rcu(skb->sk);
}
mlx5 reaches this through mlx5e_accel_tx_begin()->mlx5e_psp_is_offload(),
and netdevsim through nsim_do_psp(). mlx5e_accel_tx_begin() applies kTLS
and then PSP to the same skb.
Nothing seems to prevent one socket from having both features.
psp_sock_assoc_set_tx() installs psp_validate_xmit without checking for a
TLS ULP. tls_set_device_offload() overwrites sk->sk_validate_xmit_skb
unconditionally. Documentation/networking/psp.rst also describes starting
with TLS and then switching to PSP.
On such a socket the TLS SW fallback can engage in two ways.
tls_device_down() can install tls_validate_xmit_skb_sw() after a port
bounce, or tls_validate_xmit_skb() can fall back after a reroute. The
path is then:
tls_sw_fallback()
tls_enc_skb()
complete_skb()
nskb->decrypted = 0;
mlx5e_accel_tx_begin()
mlx5e_psp_is_offload()
psp_skb_get_assoc_rcu() returns NULL
The result is that the segment goes out as plain TCP with no PSP header.
Before this patch, skb_copy_header() carried decrypted=1 over to nskb, so
PSP encapsulation still happened. Once the fallback is active,
retransmits go through it as well. The peer's __psp_sk_rx_policy_check()
would then drop the non-PSP data segments, so the connection could stall.
PSP protection would also be skipped silently on the wire, although the
payload stays TLS-encrypted.
Could this be fixed without clearing skb->decrypted? Some options:
- Use a separate marker for fallback output.
- Skip the bond-master pass in tls_validate_xmit_skb_sw() the same way
tls_validate_xmit_skb() already does with netif_is_bond_master().
- Keep the bit when the socket has a PSP TX association.
> +
> update_chksum(nskb, headln);
>
> /* sock_efree means skb must gone through skb_orphan_partial() */
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019212651.733565-1-rjethwani%40purestorage.com
Technical Details
Message-ID:
<179279158210.3134.17242732656375934492@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351254-linux-kernel-netdev=dewy.ruReferences:
<20261019212651.733565-1-rjethwani@purestorage.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351254-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] tls: device: keep tls_sw_fallback() from encrypting its own output Date: Fri, 23 Oct 2026 21:39:42 +0000 Organization: Usenet Network Message-ID: <179279158210.3134.17242732656375934492@kernel.org> References: <20261019212651.733565-1-rjethwani@purestorage.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="619458"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:fshz9gdqm18vEOfpmRKt13Bl8LM= sha256:H2//Nm9oXFB/ls4wkDazud9DNEqpLUcGorpDOQtlAPs= sha1:MQNPEiOpKglg6tjzIUKX72k09fw= sha256:394z3IfoBaA2VdLtXyGZgRGMIVxDxSZYw7n2pROIawA= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D2B6A11159F; Sat, 24 Oct 2026 00:41:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.739 X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e2eYZm56hHUw; Sat, 24 Oct 2026 00:41:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351254-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id E9C49111550; Sat, 24 Oct 2026 00:41:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 93D2A3198D; Fri, 23 Oct 2026 21:39:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792791584; b=qxiSqnaUZ6ZqaOVEd0sGGaZQnrMujC5o2q1p4zmX6CGS4qDKgSBiP4c0edFAxBnaLhe7 osICIothrrwYOsKONsSEEHYboCF51vFU7UOEXhnErnPUi38ideshl34Eg3NWFlrAObY9J kEVZzGSVAi17dtu0L+fLPB7KIsshjypD/pPVdDk6Qj57VMQfVRzL6RJSvVoedVvjvIaOe OM3uhTJcmwk2hZvJMAue7ZDHfdOcjXUhWMK7vOJTf0WYhqEJdJHpVwodw0D3xlnrbF30+ cr2IBZqwmllyZZ2hxqB9MplSpI8m+stSZiUJE6Suu4kG6lwVLCr3vQOBVkapFs1g/sQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792791584; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=u/IIYlBMsIERedMVOhy43pG4RdFmWnfvHko5DBgCsoc=; b=20QB36mKSOrxleFRDP2eeWLnkioteWs8Y+z3XfMiouULMp8aCvaOAsHsGiGLDAlyqtus fd3+E4Ty4uukMhyzWjwUxVG4X3tMrPT1K3k951tfdrvBRqf0isH37b1HixoTkjlwW9+JE pEcZkvhKMBnkwsqj3aCElPY26iBNHDYopnPk+fnVb9rQB0KKAF+43sxtzIbmxBlkcuR6Q z0xw/X5tkUaWnKOYjdkP/S7qphj0NgBUnmaZLqAaS2HNFHgamtzEHKKflBU2y9RLqOtyY pqtKi6ERZmlhbVUyHw9k0zFoYmIsNTwA7d8aht+Lgue36LNJqnkWOSWjlc5JFz6PqNw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QquDzyeS; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B25B2606A325; Fri, 23 Oct 2026 21:39:44 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QquDzyeS X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792791583; b=wsklhQDfQ+TWMuxrueXe9wSFrEXCy0u1qx4BkGd+PR+JeagupGMZDw+Q8UXKlPPxMBAI DaMBjmLIWH4Zl/QoQYYy4pWdtE3lEpK4wLUQ5ZcmDe/Dsnjjh2bbCp3yiZpMVW8Wgh/lp 6GTTftyNiFnB7GLIDGeGz0OVSclMJ5XuG7gorHxasnHwHbHGwFxDkaSZ2piw1bSZhR6Ed R8JQePNoMBEtoCzYz0ergG5ox+trYk2GDbuL8jVR5+3KIV4Qp5StLE4kXSsU3h7RLuVmB HaBkfUjjKR7lsFk0WSKZfQNo1pyrDaFrN2/ZfglQNf4Ws7IRIsHZquQjzT8C/tsf1iA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792791583; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=u/IIYlBMsIERedMVOhy43pG4RdFmWnfvHko5DBgCsoc=; b=GvYu5axzFBN2ahXxc4NPg5qifm50uAAnnR2XSvZlV7yOJa/iSA6q0nhsQaPGrK3wn0O+ /wEtLpgyYt832algjAyqYIs4PwZVGr8MYYlOyU3CPJvW4wsGrWMVeo0mP3Rk/Xjcgl5kv aYSjq2pZg4w7y3vnU22aU+BBBVmSsA+wM56qeNa6Dl0UGWxKtHD/5M8g1IsjxVJFR+CQZ iduLv77klcPferLui4pS4ydFqwBalnslfr67u7kLcece/K1X46fmNRrQJnnkosWpfTUO4 ivR+NKqgXz2J4u2AqlRH/7OIDKFhZ0IEdE/8TfVGjVwcv/3FXMokoPzEJWUDIK0jepw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QquDzyeS; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84CF2606A31A; Fri, 23 Oct 2026 21:39:43 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8760D1F01825; Fri, 23 Oct 2026 21:39:42 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792791583; bh=u/IIYlBMsIERedMVOhy43pG4RdFmWnfvHko5DBgCsoc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=QquDzyeSuy2WViiUA9t6SoylbRUEwn9JFSQBnrSzVSAavfETwtcKrCB1zGub/Y53V 9/wPsa7y0IlVuhImom8WYG1hbI+ZGwS8JikYuwI5oEss1qjJVe1RAfct1NyzG56iXa m5FHBUFK5gbNFyNFRzhflJd+6uYZW8t+J6C5WXFBk0YrAucBcYktkjQfQgElSL2u0m vKqs6HsYmMZiar1THKn5DuDhoHw1UNK8pJNdH/mAOyVjrAHHY30p0GxHagwMvjpv2d 1/h9qOXgT72qDnJXh2cEbbgqFCyTrQ0KzbwqtZKsGLnJCsWHpEJ5RhwTPFcvdzP027 pAwzhr3T+C49g== X-Cc: netdev@vger.kernel.org, john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-In-Reply-To: <20261019212651.733565-1-rjethwani@purestorage.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list