From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796516587; b=nRKnrVIGyu/ooYod1/JTb3MsgHgChOElzhYvDoIm7dIknxpqf/jQRGK6X6DtTJV4cPFY GMJ6/O61Eb7YsvpxBYIl9gzL3aG4EcvVfnCw7Cq1mWC7GHmR4ikTMRbiSAytuwpXaNw7a 2iaeaujE6tPEtiM64h9yNRHqwS6/oT7WFfBQzweZIbWEskQERUQwL4Vh+0yyUD8XckiE1 48eK9bIQtTkEseoGLz4UuSSluzGkbiRWSHH3KD+Xp76wGiYBr50UxSJzGeOvjGOsuidMh dv3dUF6UwVvuGhfMWMe2QabtsR5VPm/3uzdXhEId4mPvN2aSV36gYFzPBhECJ7PI3Ng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796516587; 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=ZMS+UzxPnlXXPcW91DSBic6tFiIjN7mjZq9s7xq0vvI=; b=V8NTnFniAUd11aXOdy4AeS/clTDd1KYoDN7TBg5xibbdE76fGrZth1MENBdXicrP0rsy Dj1RRrERz8xo02wVAYt5q5c7PndU5UvC14WhVlO5Jz4Lx3RI3WCVpxpTjXVCliwBPUKZA OmvgZgrhkz99Qqe/xV19yx/EBqJi4rqvVxlu4IQNJajUWJMYuxJ7Mvh4TfaSnk/LtuQCV lQwPWz2HWu/8dCuWdMuTJNIBO0FgGYrcrYQqMVJV3zywZbTz8Y6bJLeFvCV6b8OM+y1PI wpDmdj3Nfg27DD7Te2uqayl/fKtb47CRZYBc+92ArNWbYBS4BNkbepRU7cXdYWqY9Ww== 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=L+T1zglg; arc=none smtp.remote-ip=100.103.45.18 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 1B5E9606A31F; Sun, 6 Dec 2026 00:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L+T1zglg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC501F0093B; Sun, 6 Dec 2026 00:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796516586; bh=ZMS+UzxPnlXXPcW91DSBic6tFiIjN7mjZq9s7xq0vvI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=L+T1zglgGH72Hgp+RNfk7C5qGPmKbIX+OXnIdxvuh924WkCXCQAc/ykDhDLoWKfQL VmSKA1K67IaispSl5ePEcdtz+mJYryhu8zl0dFAT5v1onYczt+zPXIk/twcVzIdGSM 5DiJ2dE4dtAl8zMeni4BhLXOEkRPsiZFV3ttdUlwXryKARDPwQly4HSAc4a5zyxZup v1d+bJkOyyEDro17ceCW16Pt383SFF7MLJhAnP/3Xojla0w29jH6LWATr4hAkBPmKF p/2kT+iZDL+HTx6BDBRzPo5Imm1OQzckl1MMu8xacc/IFO2ZBrCV+Ho1H2jCcc7EJe Zg31XF1Mh09Jw== Subject: Re: [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again From: netdev-bot+sashiko@kernel.org To: rjethwani@purestorage.com Cc: netdev@vger.kernel.org, stable@vger.kernel.org, john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, alice.kernel@fastmail.im, tariqt@nvidia.com Date: Sun, 06 Dec 2026 00:23:05 +0000 Message-ID: <179651658560.3148.13961391786370944844@kernel.org> In-Reply-To: <20261204235642.36653-4-rjethwani@purestorage.com> References: <20261204235642.36653-4-rjethwani@purestorage.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] On its own, this patch does not fix the headline case it claims to fix: NIC re-encryption of tls_sw_fallback() output, e.g. after a… - [Low] tls_is_skb_tx_device_offloaded() is also used for TX queue and bond-slave selection, not only to decide whether the NIC encrypts. - [Low] This patch makes tls_is_skb_tx_device_offloaded() true only when skb->decrypted is set, but the in-tree descriptions of the helper were… -- I found three low-severity issues in this patch. The code itself looks correct within the series. All three findings are about the commit message, tags and in-tree documentation, plus one change to how two drivers pick queues and bond slaves. tls: device: don't let the NIC encrypt fallback output again This commit adds a skb_is_decrypted() check to tls_is_skb_tx_device_offloaded(). With it, skbs from an offloaded socket that are not marked for device crypto skip the driver's TLS TX path. That covers software fallback output and data queued before TLS_TX was enabled. > Require skb_is_decrypted() in tls_is_skb_tx_device_offloaded(). > Fallback output then takes the ordinary TX path, as does data queued > before TLS_TX was enabled. Backport the first three fixes together, > in order. [Severity: Low] Does this change alone make fallback output take the ordinary TX path? complete_skb() copies the headers group, which includes decrypted, from the original skb: net/tls/tls_device_fallback.c:complete_skb() { ... skb_copy_header(nskb, skb); ... /* Ciphertext now: don't encrypt it again */ nskb->decrypted = 0; ... } The nskb->decrypted = 0 line comes from the previous patch in the series, "tls: device: keep tls_sw_fallback() from encrypting its own output". Without it, nskb keeps decrypted=1, so the new skb_is_decrypted() check still returns true for fallback output. The macvlan reroute case would then still go like this: macvlan xmit validate_xmit_skb()->tls_validate_xmit_skb() dev != ctx->netdev, so tls_sw_fallback() runs; nskb keeps decrypted=1 lower NIC xmit validate_xmit_skb()->tls_validate_xmit_skb() dev == ctx->netdev, so the skb is returned unchanged the driver sees tls_is_skb_tx_device_offloaded() == true and encrypts the ciphertext again Could the commit message name the prerequisite commit? It could also say that this check depends on complete_skb() clearing the mark. "Backport the first three fixes together, in order" will not mean much once this is in git history. This patch has Fixes: e8f69799810c and a bare Cc: stable. The prerequisite has a different tag, Fixes: c55dcdd435aa. Would a prerequisite annotation help here, like the one the previous patch uses? Cc: stable@vger.kernel.org # x.y.z: That would stop stable trees from picking this patch up without the previous one. > diff --git a/include/net/tls.h b/include/net/tls.h > index 0b001b8ab1c3b..9998b55820919 100644 > --- a/include/net/tls.h > +++ b/include/net/tls.h > @@ -365,7 +365,8 @@ static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb) > > return sk && sk_fullsock(sk) && > (smp_load_acquire(&sk->sk_validate_xmit_skb) == > - &tls_validate_xmit_skb); > + &tls_validate_xmit_skb) && > + skb_is_decrypted(skb); [Severity: Low] tls_is_skb_tx_device_offloaded() is not only used to decide whether the NIC encrypts. It also drives TX queue selection and bond slave selection. Is the change in those callers intended? After this patch, every unmarked skb of an offloaded socket goes a different way at these two call sites. That includes pure ACKs, bare FINs, pre-offload data and retransmits, and fallback output. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:cxgb4_select_queue() { ... if (xfrm_offload(skb) || is_ptp_enabled(skb, dev) || skb->encapsulation || tls_is_skb_tx_device_offloaded(skb) || (proto != IPPROTO_TCP && proto != IPPROTO_UDP)) txq = txq % pi->nqsets; ... } When netdev_get_num_tc(dev) != 0, every skb of a TLS offloaded socket used to be kept on the normal NIC queues. Now only decrypted=1 skbs are. The unmarked segments of the same flow can end up on the mqprio ETHOFLD queues and be shaped there. drivers/net/bonding/bond_main.c:__bond_start_xmit() { ... if (tls_is_skb_tx_device_offloaded(skb)) return bond_tls_device_xmit(bond, skb, dev); ... } Only marked skbs are now pinned to the TLS lower device. After an active-backup failover, or a slave array change in xor mode, unmarked skbs can leave on a different slave from the one carrying the TLS records. Can this split one TCP flow across hardware queues or ports? That could reorder ACKs, FINs and pre-offload retransmits relative to the TLS data. This may be harmless, since none of these skbs need device crypto. The commit message mentions the "ordinary TX path", but not the queue selection or bond steering changes. [Severity: Low] Should the in-tree descriptions of this helper be updated as well? tls_set_device_offload() in net/tls/tls_device.c still says: /* following this assignment tls_is_skb_tx_device_offloaded * will return true and the context might be accessed * by the netdev's xmit function. */ smp_store_release(&sk->sk_validate_xmit_skb, tls_validate_xmit_skb); After this patch the helper returns true only for skbs built with MSG_SENDPAGE_DECRYPTED. Pre-offload skbs and fallback output now return false. Documentation/networking/tls-offload.rst still tells driver authors: TX offload being fully initialized does not imply that all segments passing through the driver and which belong to the offloaded socket will be after the expected sequence number and will have kernel record information. In particular, already encrypted data may have been queued to the socket before installing the connection state in the kernel. Those segments still reach the driver. However, the shared helper now keeps them out of the TLS TX handlers in mlx5e_accel_tx_begin(), nfp_net_tls_tx(), fun_tls_tx() and the cxgb4 ULD tx_handler path. Neither the comment nor the documentation says that the helper now requires the skb mark as well as the socket state. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com