🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7651

Re: [PATCH net v2 2/4] tls: device: fix next-record sequence in core-driven RX resync

#7651
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 22:48
122 lines
12405 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 (1) · 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).

- [Medium] In tls_device_core_ctrl_rx_resync() (net/tls/tls_device.c),
  this patch makes the next-record sequence sent to the device…

Pre-existing issues:
- [Medium] The other CORE_NEXT_HINT resync path, tls_rx_msg_size() ->
  tls_device_rx_resync_new_rec() (net/tls/tls_sw.c:2234-2235 at this…

--

tls: device: fix next-record sequence in core-driven RX resync

tls_device_core_ctrl_rx_resync() used to pass tcp_sk(sk)->copied_seq to
tls_device_resync_rx() as the TCP sequence of the next record. This patch
passes tls_strp_msg_seq() + rxm->full_len instead. The commit message
says the result is the start of the next record in both strparser modes.

> diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
> index fbfe6ec3df048..a6c4d0cc54c73 100644
> --- a/net/tls/tls_device.c
> +++ b/net/tls/tls_device.c

[ ... ]

> @@ -877,8 +878,9 @@ static void tls_device_core_ctrl_rx_resync(struct tls_context *tls_ctx,
>  		memcpy(rcd_sn, tls_ctx->rx.rec_seq, prot->rec_seq_size);
>  		tls_bigint_increment(rcd_sn, prot->rec_seq_size);
>  
> -		tls_device_resync_rx(tls_ctx, sk, tcp_sk(sk)->copied_seq,
> -				     rcd_sn);
> +		tls_device_resync_rx(tls_ctx, sk,
> +				     tls_strp_msg_seq(sw_ctx) +
> +				     rxm->full_len, rcd_sn);

[Severity: Medium]
The sequence passed here no longer depends on the strparser mode. Does the
check that picks this branch still depend on it?

Earlier in tls_device_core_ctrl_rx_resync():

	/* head of next rec is already in, parser will sync for us */
	if (tcp_inq(sk) > rxm->full_len) {
		trace_tls_device_rx_resync_nh_schedule(sk);
		ctx->resync_nh_do_now = 1;
	} else {

tcp_inq() counts from copied_seq. In copy mode, tls_strp_read_copy() has
already moved copied_seq past the current record, so tcp_inq() counts only
the bytes of the next record.

Suppose between 1 and rxm->full_len bytes of the next record are already
queued. The else branch runs, and tls_dev_resync() is called for a TCP
position the device has already passed. resync_nh_do_now is never set, so
tls_device_rx_resync_new_rec() also returns early:

	case TLS_OFFLOAD_SYNC_TYPE_CORE_NEXT_HINT:
		if (likely(!rx_ctx->resync_nh_do_now))
			return;

Would this waste the resync attempt and keep the stream on software
decryption until the backed-off retry?

This tcp_inq() check was already there before this patch. The later commit
"tls: device: fix next-record queued checks in core-driven RX resync" in
this series appears to fix it. That commit replaces the check with
after(READ_ONCE(tcp_sk(sk)->rcv_nxt), next_seq).

[Severity: Medium]
This is a pre-existing issue and was not introduced by this patch. The
commit message says the reported sequence "no longer depends on which mode
the strparser is in". Does that also hold for the other CORE_NEXT_HINT
path?

tls_rx_msg_size() in net/tls/tls_sw.c still computes the record start from
the anchor skb:

	tls_device_rx_resync_new_rec(strp->sk, data_len + TLS_HEADER_SIZE,
				     TCP_SKB_CB(skb)->seq + strp->stm.offset);

In copy mode, tls_strp_read_copy() resets stm.offset to 0 but keeps the
anchor's old cb. The value above can then be lower than the real record
start, while tls_device_core_ctrl_rx_resync() now uses strp->seq.

When tls_device_core_ctrl_rx_resync() sets resync_nh_do_now, it hands the
resync to this path. tls_device_rx_resync_new_rec() also still assumes
normal mode:

		/* head of next rec is already in, note that the sock_inq will
		 * include the currently parsed message when called from parser
		 */
		sock_data = tcp_inq(sk);
		if (sock_data > rcd_len) {

In copy mode, could the device then get the wrong next-record boundary for
CORE_NEXT_HINT? Could the request sequence also fail to match for
DRIVER_REQ and DRIVER_REQ_ASYNC?

Two later commits in this series look like they fix this:

  "tls: device: fix record start reported to RX resync in copy mode"
  changes the argument to strp->seq.

  "tls: device: fix next-record queued checks in core-driven RX resync"
  changes the tcp_inq() check in tls_device_rx_resync_new_rec() to
  READ_ONCE(tcp_sk(sk)->rcv_nxt) - seq.

>  	}
>  }

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261022221732.1397620-1-rjethwani%40purestorage.com
Technical Details
Message-ID: <179305490892.3134.14812552886616716829@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352100-linux-kernel-netdev=dewy.ru
References: <20261022221732.1397620-3-rjethwani@purestorage.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352100-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 2/4] tls: device: fix next-record sequence in
 core-driven RX resync
Date: Mon, 26 Oct 2026 22:48:28 +0000
Organization: Usenet Network
Message-ID: <179305490892.3134.14812552886616716829@kernel.org>
References: <20261022221732.1397620-3-rjethwani@purestorage.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1415449"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KltPNmJkNxEhY25ffKquwf6SyBo= sha256:H77lvXKSf8qs78qURxZCPGTAc/3CbjYubYY1i958kUg=
	sha1:KzjxEHN5vpSAIGleWPvg6wB3Ez0= sha256:NFxE5xBRjQTx+HEr6HaoKgIRZ4+acyf4mEC+Itbbk7o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 37A38125BD5; Tue, 27 Oct 2026 01:48:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.838
X-Spam-Status: No, score=-3.838 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id V1MLnRQkMX3u;
	Tue, 27 Oct 2026 01:48:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-352100-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 95E0F125AD8; Tue, 27 Oct 2026 01:48:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id CD1496024D3; Mon, 26 Oct 2026 22:48:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793054911;
	b=DMIwsGBeSC6wcafk+anTNgdZaheOexa9V7TAAngCRPhFGuFyQ79dfLk9YaJU/Aj3bAEs
	 P6YddIw8NlxfVUqbeEayiHXChJBpAKH/kVX8hTvp3mlwOtk4OZMh2IsifZP3EDsTwtxY8
	 3L8K3qtwkH1sTY66WAXpEJlDh4lRSfn0+su7P186J2Z0Bbt4B/Cqm4D8i3B2g+olzeVrr
	 CAqXhAn/UB5Theza7FpeXtidn3PAq+RzXjYTwCryGktL5//ZEKdvFNYuCw0X8tGcyLGVO
	 b6cJ7+n4uLPK7NCdzNTZq9srK4AIDHsvC0UBDqYeNe8B1VHdHmv2aZUNuVzEuGRG7tA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793054911;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=jcxyz7Cy7L3/Rzx1d3XkFGe0VxaGpBfmgU6arFQu+pk=;
	b=IGjOn5yC/5RI/xH3rKDXKybkrEagNlj54kjSTE5y5q92IdGI89ZkGsC7BLjseGHuHYhl
	 ZU/2ItA2PiuDbBKs8Ji/+7Ismlx+vG2exi1HyNdSSU1+P38/WB04XFMhZ5GWvVei5VjuS
	 wlQM1n1ePqEdmtmIH6fQ+1VCmHB5KJP9h7jKUuoQj62a7QFKsfBywokNSnm1lomtNqlIX
	 z6BNRfmbaMsb0ls0QTwzylsgoMLmfr8EHdmCmiEhj3pdNG/EbjPbg/a6AZufnSpgWF8AU
	 3EKTwppWv90wE7CFxsiCP5F37NQNXEl02IKBjENA5Qjj8B6nOnD5crWg3cxBE7/WAZA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XJfD80vz;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 34AEC606A321;
	Mon, 26 Oct 2026 22:48:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XJfD80vz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793054910;
	b=4Whsns/Tqw6Ibipf/t3ThPRg/+GcaQy3sW+kNZ1EjljKrbmDvLqzOFFxm3IHf3cFnnzQ
	 c1qAyvNo1gXhf0B1Cen1xzsGHoJfm2bCs1ufbKVtpGMVPF2tocJQFvfXy6dINCPfghdq8
	 P6hYdfeHMbF5WjFX96zIMp+3fIkfc9vZr/rZJROftNjpAQFtf98eGhN4D2BUR8gxnG7Xc
	 sQ8/FfAyCj5AIvcUY9nLKpKa3QWEzUp4lIXQD2QkzgI3BLZUY2wF3Pxw9XY9XqEDs6SFx
	 KuyrMz9k8C0XxYG1MNxv+qy1t1fKTyHg7ruX394NQguTB9lbOoS1UbV9CyNCqFJKCCA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793054910;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=jcxyz7Cy7L3/Rzx1d3XkFGe0VxaGpBfmgU6arFQu+pk=;
	b=2neaXF3yj4h/Xlf0qOw8CCTEPFFZxy/CaUnLKI6dJ2KwkpMjmJJorTTBOp5olG2LByXS
	 P6dDCn/xchnYwqD7HLB79r5u1g0wFmu3CL/+CknfGVpgu1H87fd+Lg/XjSBOTjbQ9H4u1
	 Dl0BwGKtZ8KdUICt0wxxPH6HkYTP3NScp5Zc2mu+CJCSBmTrXj9zKN74+cX3BUf4j3wLS
	 CI7J34Wr9NCuLnxFkXRZ2KsP7S7sXVimnoyNvWMGAL1cL2sGMANF+HpHjnubmLGxPwcPU
	 Uw2b3wvMyDWRmgnCEecIltQTN/39UDnnJIVrftft50PpEEFU1JnZOYMOCtEi6Lf3chA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XJfD80vz;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11AE9606A31A
	for <netdev@vger.kernel.org>; Mon, 26 Oct 2026 22:48:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677C41F01825;
	Mon, 26 Oct 2026 22:48:29 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793054909;
	bh=jcxyz7Cy7L3/Rzx1d3XkFGe0VxaGpBfmgU6arFQu+pk=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=XJfD80vzREdmw8Gq2FfRAxfgx0ZC+24a0p0VVUbyWKj7BgrVR+fgTlSykOJ9MSJtB
	 mdFhzSxiKbidCu3L/czUKNRcuwl4TtdolAyabYF6M6l39bylVAwf2WJ61h+RrAESkC
	 2jY7/Iz62p6zu9C8Pl5bDgCN6UT1WJz9dFX0YOicisqsrKULJzZufsbKDwzWGXdCRP
	 qzy0s5xHDn7qUfTvS3M8yUJrBfy7LhndO30KSGgw6UJ937MF83ofSoKuhYYRYZ9cJT
	 YSLazyGuzvSydOqHhfQjxk23+am5AYrhqxbVSS7FqweJ7uEBB16OmZzhDOSCf7JmY5
	 cuUlmfHljh7TA==
X-Cc: netdev@vger.kernel.org, kuba@kernel.org
X-In-Reply-To: <20261022221732.1397620-3-rjethwani@purestorage.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list