[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6659d38ac31fa_3f8cab29482@willemb.c.googlers.com.notmuch>
Date: Fri, 31 May 2024 09:41:30 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jakub Kicinski <kuba@...nel.org>,
edumazet@...gle.com,
pabeni@...hat.com
Cc: davem@...emloft.net,
netdev@...r.kernel.org,
mptcp@...ts.linux.dev,
matttbe@...nel.org,
martineau@...nel.org,
borisp@...dia.com,
willemdebruijn.kernel@...il.com,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next 2/3] tcp: add a helper for setting EOR on tail
skb
Jakub Kicinski wrote:
> TLS (and hopefully soon PSP will) use EOR to prevent skbs
> with different decrypted state from getting merged, without
> adding new tests to the skb handling. In both cases once
> the connection switches to an "encrypted" state, all subsequent
> skbs will be encrypted, so a single "EOR fence" is sufficient
> to prevent mixing.
>
> Add a helper for setting the EOR bit, to make this arrangement
> more explicit.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Willem de Bruijn <willemb@...gle.com>
> ---
> include/net/tcp.h | 9 +++++++++
> net/tls/tls_device.c | 11 ++---------
> 2 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 32741856da01..08c3b99501cf 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -1066,6 +1066,7 @@ static inline bool tcp_skb_can_collapse_to(const struct sk_buff *skb)
> static inline bool tcp_skb_can_collapse(const struct sk_buff *to,
> const struct sk_buff *from)
> {
> + /* skb_cmp_decrypted() not needed, use tcp_write_collapse_fence() */
> return likely(tcp_skb_can_collapse_to(to) &&
> mptcp_skb_can_collapse(to, from) &&
> skb_pure_zcopy_same(to, from));
> @@ -2102,6 +2103,14 @@ static inline void tcp_rtx_queue_unlink_and_free(struct sk_buff *skb, struct soc
> tcp_wmem_free_skb(sk, skb);
> }
>
> +static inline void tcp_write_collapse_fence(struct sock *sk)
> +{
const struct ptr?
> + struct sk_buff *skb = tcp_write_queue_tail(sk);
> +
> + if (skb)
> + TCP_SKB_CB(skb)->eor = 1;
> +}
Powered by blists - more mailing lists