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
Subject: Re: [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again
Date: Sun, 06 Dec 2026 00:23:05 +0000 [thread overview]
Message-ID: <179651658560.3148.13961391786370944844@kernel.org> (raw)
In-Reply-To: <20261204235642.36653-4-rjethwani@purestorage.com>
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: <prereq sha>
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
next prev parent reply other threads:[~2026-12-06 0:23 UTC|newest]
Thread overview: 17+ 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 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
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-06 0:23 ` netdev-bot+sashiko [this message]
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-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
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-06 0:23 ` netdev-bot+sashiko
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani
2026-12-06 0:23 ` netdev-bot+sashiko
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=179651658560.3148.13961391786370944844@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alice.kernel@fastmail.im \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rjethwani@purestorage.com \
--cc=sd@queasysnail.net \
--cc=stable@vger.kernel.org \
--cc=tariqt@nvidia.com \
--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