From: netdev-bot+sashiko@kernel.org
To: toddfreed@meta.com
Cc: netdev@vger.kernel.org, davem@davemloft.net,
andrew+netdev@lunn.ch, bjorn@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, daniel.zahka@gmail.com,
donald.hunter@gmail.com, edumazet@kernel.org, kuba@kernel.org,
jhs@mojatatu.com, jiri@resnulli.us, john.fastabend@gmail.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org,
martin.lau@linux.dev, pabeni@redhat.com, saeedm@nvidia.com,
horms@kernel.org, tariqt@nvidia.com, weiwan@google.com,
willemdebruijn.kernel@gmail.com
Subject: Re: [PATCH net-next v1 08/15] psp: only give time-wait sockets of psp connections a validator
Date: Sun, 15 Nov 2026 03:18:22 +0000 [thread overview]
Message-ID: <179471270271.2199510.4403404984222798506@kernel.org> (raw)
In-Reply-To: <20261111005533.6436-9-toddfreed@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] psp_twsk_init() (net/psp/psp_sock.c) now sets
tw->tw_validate_xmit_skb = psp_validate_xmit whenever the full socket…
--
psp: only give time-wait sockets of psp connections a validator
This commit changes psp_twsk_init() so that tw_validate_xmit_skb is set
only when the full socket has a psp association, not on every tcp
time-wait socket. It prepares for the upcoming tc psp action, which
treats a socket that has a validator as having its own encryption
offload.
> diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
> index 609b06c7af65b..664955bfb4fdb 100644
> --- a/net/psp/psp_sock.c
> +++ b/net/psp/psp_sock.c
> @@ -330,10 +330,14 @@ void psp_twsk_init(struct inet_timewait_sock *tw, const struct sock *sk)
> {
> struct psp_assoc *pas = psp_sk_assoc(sk);
>
> - if (pas)
> + if (pas) {
> refcount_inc(&pas->refcnt);
> + /* Only for PSP connections: a validator makes the socket
> + * look like it has an encryption offload of its own
> + */
> + tw->tw_validate_xmit_skb = psp_validate_xmit;
[Severity: High]
Should this also check pas->tx.spi? As written, an Rx-only association
(pas->tx.spi == 0) also gets the validator here.
On a full socket, the validator is installed only after a Tx key is set,
in psp_sock_set_tx_key():
WRITE_ONCE(sk->sk_validate_xmit_skb, psp_validate_xmit);
psp_sock_assoc_set_rx() publishes sk->psp_assoc but never sets
sk->sk_validate_xmit_skb. A connection that did rx-assoc but never
tx-assoc therefore has no validator while it is a full socket. It gains
one when it enters TIME_WAIT.
Other places that decide whether a connection is PSP-encrypted test
pas && pas->tx.spi. These include psp_reply_set_decrypted() in this same
file:
if (pas && pas->tx.spi)
skb->decrypted = 1;
and also psp_enqueue_set_decrypted() and psp_sk_overhead() in
include/net/psp/functions.h.
With the act_psp patch later in the series, tcf_psp_sk_offload() returns
true for a TIME_WAIT socket that has a tw_validate_xmit_skb:
return sk_is_inet(sk) && sk->sk_state == TCP_TIME_WAIT &&
inet_twsk(sk)->tw_validate_xmit_skb;
tcf_psp_act() then drops the packet with SKB_DROP_REASON_PSP_OUTPUT. In
addition, sk_validate_xmit_skb() in net/core/dev.c drops skbs carrying a
PSP metadata dst when the time-wait socket has a validator.
TIME_WAIT replies get skb->sk = tw through skb_set_owner_edemux() from
ip_send_unicast_reply() and tcp_v6_send_response(). The resulting
sequence looks like this:
psp_sock_assoc_set_rx() sk->psp_assoc set, tx.spi == 0, no validator
connection closes
psp_twsk_init() tw_validate_xmit_skb set since pas != NULL
TW ACK/RST reply, skb->sk = tw
tcf_psp_act() ENCAP
tcf_psp_sk_offload() true -> TC_ACT_SHOT
So an egress psp encap rule that covers such a connection encapsulates
its packets while the socket is full. Once the socket is in TIME_WAIT,
the same rule drops its ACK and RST replies. Is this the inconsistency
the commit message describes? It seems to remain for Rx-only
associations.
An Rx-only socket has no Tx offload of its own.
Documentation/networking/psp.rst lists Tx as plain text in the Rx PSP
state.
Would gating on pas && pas->tx.spi, as psp_reply_set_decrypted() does,
match the full-socket rule? Copying the validator only when
sk->sk_validate_xmit_skb == psp_validate_xmit would be another option.
> + }
> rcu_assign_pointer(tw->psp_assoc, pas);
> - tw->tw_validate_xmit_skb = psp_validate_xmit;
> }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111005533.6436-1-toddfreed%40meta.com
next prev parent reply other threads:[~2026-11-15 3:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 0:55 [PATCH net-next v1 00/15] psp: introduce socket-less associations Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 01/15] psp: get netns from net_device instead of sock Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 02/15] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 03/15] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 04/15] psp: add support for socket-less psp associations Todd Freed
2026-11-11 16:49 ` Daniel Zahka
2026-11-11 18:23 ` Todd Bert Freed
2026-11-11 19:01 ` Daniel Zahka
2026-11-11 21:49 ` Todd Bert Freed
2026-11-12 0:51 ` Todd Bert Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 05/15] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 06/15] net/sched: act_mirred: don't send decrypted skbs from egress to ingress Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 07/15] bpf: don't redirect " Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 08/15] psp: only give time-wait sockets of psp connections a validator Todd Freed
2026-11-11 11:37 ` Daniel Zahka
2026-11-15 3:18 ` netdev-bot+sashiko [this message]
2026-11-11 0:55 ` [PATCH net-next v1 09/15] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 10/15] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 11/15] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 12/15] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 13/15] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 14/15] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 0:55 ` [PATCH net-next v1 15/15] Documentation: networking: psp: document socket-less associations Todd Freed
2026-11-15 3:18 ` netdev-bot+sashiko
2026-11-11 17:01 ` [PATCH net-next v1 00/15] psp: introduce " Daniel Zahka
2026-11-12 19:35 ` Todd Bert Freed
2026-11-13 15:45 ` Jamal Hadi Salim
2026-11-13 16:21 ` Jamal Hadi Salim
2026-11-13 19:08 ` Todd Bert Freed
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=179471270271.2199510.4403404984222798506@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel.zahka@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=toddfreed@meta.com \
--cc=weiwan@google.com \
--cc=willemdebruijn.kernel@gmail.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