Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Sabrina Dubroca
Tue, 20 Oct 2026 09:57
Re: [PATCH net 1/2] tls: device: fix record start in the tls_device_decrypted tracepoint
Author: Sabrina Dubroca
Date: Tue, 20 Oct 2026 09:57
Date: Tue, 20 Oct 2026 09:57
70 lines
15155 bytes
15155 bytes
2026-10-15, 14:11:34 -0600, Rishikesh Jethwani wrote:
> diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
> index f11d0528fc43..33e6dc3d4164 100644
> --- a/net/tls/tls_device.c
> +++ b/net/tls/tls_device.c
> @@ -835,6 +835,21 @@ void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq)
> tls_device_resync_rx(tls_ctx, sk, seq, rcd_sn);
> }
>
> +/* TCP sequence of the first byte of the record the strparser holds. In
> + * normal mode the record stays in the TCP receive queue until
> + * tls_strp_msg_consume(), so copied_seq still points at its start. Copy
> + * mode saves the start before TCP reads advance copied_seq, possibly
> + * over a FIN that is not part of the record.
> + */
> +static u32 tls_device_rx_rec_start(struct sock *sk,
> + struct tls_sw_context_rx *sw_ctx)
> +{
> + if (sw_ctx->strp.copy_mode)
> + return sw_ctx->strp.copy_seq;
> +
> + return tcp_sk(sk)->copied_seq;
> +}
nit: tls_strp implementation details should stay in tls_strp.c.
> static void tls_device_core_ctrl_rx_resync(struct tls_context *tls_ctx,
> struct tls_offload_context_rx *ctx,
> struct sock *sk, struct sk_buff *skb)
> @@ -990,7 +1005,7 @@ int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx)
> is_encrypted = 0;
> }
>
> - trace_tls_device_decrypted(sk, tcp_sk(sk)->copied_seq - rxm->full_len,
> + trace_tls_device_decrypted(sk, tls_device_rx_rec_start(sk, sw_ctx),
> tls_ctx->rx.rec_seq, rxm->full_len,
> is_encrypted, is_decrypted);
>
> diff --git a/net/tls/tls_strp.c b/net/tls/tls_strp.c
> index 6cc222008d95..ad8b5150ac97 100644
> --- a/net/tls/tls_strp.c
> +++ b/net/tls/tls_strp.c
> @@ -132,6 +132,7 @@ int tls_strp_msg_cow(struct tls_sw_context_rx *ctx)
> tls_strp_anchor_free(strp);
> strp->anchor = skb;
>
> + strp->copy_seq = tcp_sk(strp->sk)->copied_seq;
> tcp_read_done(strp->sk, strp->stm.full_len);
> strp->copy_mode = 1;
>
> @@ -418,6 +419,7 @@ static int tls_strp_read_copy(struct tls_strparser *strp, bool qshort)
>
> shinfo->frag_list = NULL;
>
> + strp->copy_seq = tcp_sk(strp->sk)->copied_seq;
Why not set strp->copy_seq every time we start processing a new
record? Then we don't have to worry about whether it's set, handle it
in multiple places, and we don't have different cases in _rec_start().
> strp->copy_mode = 1;
> strp->stm.offset = 0;
>
> --
> 2.50.1
>
--
Sabrina
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads