From: sashiko-bot@kernel.org
To: "Todd Freed" <toddfreed@meta.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next v2 05/12] net: add METADATA_PSP dst to carry a psp association on an skb
Date: Fri, 20 Nov 2026 01:31:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-224312@kernel.org> (raw)
In-Reply-To: <20261119013103.1092559-6-toddfreed@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] net: sk_validate_xmit_skb() misclassifies non-PSP TCP_TIME_WAIT
sockets
--
commit 85525961a778a4b7452034bd0372d77e36801869
Author: Todd Freed <toddfreed@meta.com>
net: add METADATA_PSP dst to carry a psp association on an skb
This commit adds a METADATA_PSP metadata_dst type to attach a PSP
association to socket-less skbs and validates it in the transmit path.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d88af07aea290..920604ab9c02c 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -4155,13 +4161,32 @@ static struct sk_buff *sk_validate_xmit_skb(struct sk_buff *skb,
> sk_validate = NULL;
> if (sk) {
> if (sk_fullsock(sk))
> - sk_validate = sk->sk_validate_xmit_skb;
> + sk_validate = READ_ONCE(sk->sk_validate_xmit_skb);
> else if (sk_is_inet(sk) && sk->sk_state == TCP_TIME_WAIT)
> sk_validate = inet_twsk(sk)->tw_validate_xmit_skb;
> }
>
> if (sk_validate) {
> - skb = sk_validate(sk, dev, skb);
> + /* the socket's validator would apply instead of checking the
> + * association. A METADATA_PSP dst isn't given to the packets
> + * of a socket with its own offload, but the socket can gain
> + * one while such a packet is queued.
> + */
> + if (unlikely(skb_psp_md(skb))) {
> + kfree_skb_reason(skb, SKB_DROP_REASON_PSP_OUTPUT);
> + skb = NULL;
> + } else {
> + skb = sk_validate(sk, dev, skb);
> + }
> + } else if (unlikely(skb_psp_md(skb))) {
> + int psp = psp_xmit_md(skb, dev);
> +
> + if (psp <= 0) {
> + kfree_skb_reason(skb, psp == -EMSGSIZE ?
> + SKB_DROP_REASON_PKT_TOO_BIG :
> + SKB_DROP_REASON_PSP_OUTPUT);
> + skb = NULL;
> + }
> } else if (unlikely(skb_is_decrypted(skb))) {
[Severity: High]
Does sk_validate_xmit_skb() drop all METADATA_PSP packets sent by a
TCP_TIME_WAIT socket when CONFIG_INET_PSP is enabled?
When any TCP socket enters TCP_TIME_WAIT, inet_twsk_alloc() calls
psp_twsk_init(), which unconditionally sets tw->tw_validate_xmit_skb even
when the socket has no PSP association:
net/psp/psp_sock.c:psp_twsk_init() {
struct psp_assoc *pas = psp_sk_assoc(sk);
if (pas)
refcount_inc(&pas->refcnt);
rcu_assign_pointer(tw->psp_assoc, pas);
tw->tw_validate_xmit_skb = psp_validate_xmit;
}
Timewait ACKs and RSTs attach the inet_timewait_sock to skb->sk via
skb_set_owner_edemux(). Because tw->tw_validate_xmit_skb is non-NULL on
every TCP_TIME_WAIT socket, sk_validate_xmit_skb() takes the if
(sk_validate) branch and drops any timewait packet carrying a METADATA_PSP
dst.
Conversely, if such a timewait packet was marked skb->decrypted = 1 and
then lost its METADATA_PSP dst to routing, sk_validate_xmit_skb() calls
psp_validate_xmit() instead of hitting the skb_is_decrypted(skb) drop
branch; since tw->psp_assoc is NULL, psp_skb_get_assoc_rcu() returns NULL
and psp_validate_xmit() lets the packet through in clear text.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119013103.1092559-1-toddfreed@meta.com?part=5
next prev parent reply other threads:[~2026-11-20 1:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 1:30 [PATCH net-next v2 00/12] psp: introduce socket-less associations Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 01/12] psp: get netns from net_device instead of sock Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 02/12] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 03/12] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 04/12] psp: add support for socket-less psp associations Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 05/12] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-20 1:31 ` sashiko-bot [this message]
2026-11-20 17:24 ` Todd Bert Freed
2026-11-19 1:30 ` [PATCH net-next v2 06/12] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-20 1:31 ` sashiko-bot
2026-11-19 1:30 ` [PATCH net-next v2 08/12] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-20 1:32 ` sashiko-bot
2026-11-19 1:31 ` [PATCH net-next v2 09/12] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-20 1:32 ` sashiko-bot
2026-11-19 1:31 ` [PATCH net-next v2 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-20 1:32 ` sashiko-bot
2026-11-19 1:31 ` [PATCH net-next v2 11/12] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-20 1:32 ` sashiko-bot
2026-11-19 1:31 ` [PATCH net-next v2 12/12] Documentation: networking: psp: document socket-less associations Todd Freed
2026-11-20 1:32 ` sashiko-bot
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=sashiko-outbox-224312@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=toddfreed@meta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.