Netdev List
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Rishikesh Jethwani <rjethwani@purestorage.com>
Cc: netdev@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net 1/2] tls: device: fix record start in the tls_device_decrypted tracepoint
Date: Tue, 20 Oct 2026 11:57:40 +0200	[thread overview]
Message-ID: <atc7FCQv84jn2CrZ@krikkit> (raw)
In-Reply-To: <20261015201135.2744031-2-rjethwani@purestorage.com>

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

  reply	other threads:[~2026-10-20  9:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 20:11 [PATCH net 0/2] tls: device: fix users of copied_seq after the strparser rework Rishikesh Jethwani
2026-10-15 20:11 ` [PATCH net 1/2] tls: device: fix record start in the tls_device_decrypted tracepoint Rishikesh Jethwani
2026-10-20  9:57   ` Sabrina Dubroca [this message]
2026-10-21 23:13     ` Rishikesh Jethwani
2026-10-15 20:11 ` [PATCH net 2/2] tls: device: fix next-record sequence in core-driven RX resync Rishikesh Jethwani
2026-10-15 20:14 ` [PATCH net 0/2] tls: device: fix users of copied_seq after the strparser rework netdev-bot+sinfo
2026-10-15 20:55   ` Rishikesh Jethwani

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=atc7FCQv84jn2CrZ@krikkit \
    --to=sd@queasysnail.net \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjethwani@purestorage.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