πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27559

Re: [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback

#27559
From: netdev-bot+sashiko
Date: Sun, 06 Dec 2026 00:23
126 lines
12642 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The comment this patch adds in tls_sw_fallback()
  (net/tls/tls_device_fallback.c:393), "Its record was acked and freed:…
- [Low] This patch edits the '*sync_size < 0' branch of fill_sg_in()
  (net/tls/tls_device_fallback.c:239-252) and removes the…

--

tls: device: remove the dead start marker bypass in TX fallback

This removes the start marker bypass in tls_sw_fallback() and its special
case in fill_sg_in(). The reasoning is that pre-offload skbs now return
early from tls_sw_fallback() before record lookup, and TCP will not merge
them with decrypted data across the start marker. The commit message says
there is no functional change.

> diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
> index 42afbe7e60b56..da875fdf5b546 100644
> --- a/net/tls/tls_device_fallback.c
> +++ b/net/tls/tls_device_fallback.c
> @@ -237,8 +237,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
>  
>  	*sync_size = tcp_seq - tls_record_start_seq(record);
>  	if (*sync_size < 0) {
> -		int is_start_marker = tls_record_is_start_marker(record);
> -
>  		spin_unlock_irqrestore(&ctx->lock, flags);
>  		/* This should only occur if the relevant record was
>  		 * already acked. In that case it should be ok

[ ... ]

> @@ -250,8 +248,6 @@ static int fill_sg_in(struct scatterlist *sg_in,
>  		 * on TCP to retransmit a packet that doesn't contain
>  		 * already acked payload.
>  		 */
> -		if (!is_start_marker)
> -			*sync_size = 0;
>  		return -EINVAL;
>  	}

[Severity: Low]
This isn't a bug, but should the comment above be updated along with this
change?

As far as I can tell, tls_get_record() can only produce a negative
sync_size by returning the start marker record. The marker has len == 0,
so it skips the between() range check:

net/tls/tls_device.c:tls_get_record() {
    ...
		/* send the start_marker record if seq number is before the
		 * tls offload start marker sequence number. This record is
		 * required to handle TCP packets which are before TLS offload
		 * started.
    ...
}

Records are contiguous, because tls_push_record() sets each end_seq to
tp->write_seq + record->len. A seq inside a record that was already acked
and removed by tls_tcp_clean_acked() fails the between() check, so
tls_get_record() returns NULL. The earlier !record branch handles that
case.

Before this patch, the is_start_marker check showed in the code that this
branch covered the pre-offload case. With the check gone, the branch can
only be reached through the start marker, but the comment still says it
is the "already acked" case.

Would it be clearer to rewrite the comment to describe the start marker
invariant, or to replace it with something like DEBUG_NET_WARN_ON_ONCE()?

[ ... ]

> @@ -394,12 +390,9 @@ static struct sk_buff *tls_sw_fallback(struct sock *sk, struct sk_buff *skb)
>  	sg_init_table(sg_in, sg_in_max_elements);
>  	sg_init_table(sg_out, ARRAY_SIZE(sg_out));
>  
> -	if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs)) {
> -		/* bypass packets before kernel TLS socket option was set */
> -		if (sync_size < 0 && payload_len <= -sync_size)
> -			nskb = skb_get(skb);
> +	/* Its record was acked and freed: drop it */
> +	if (fill_sg_in(sg_in, skb, ctx, &rcd_sn, &sync_size, &resync_sgs))
>  		goto put_sg;

[Severity: Low]
This isn't a bug, but is this new comment accurate for every way
fill_sg_in() can fail?

fill_sg_in() returns -EINVAL from three places. Only the !record case from
tls_get_record() matches "acked and freed".

The *sync_size < 0 case can only be reached through the start marker
record. That record is live, not acked and freed.

The last case happens after a live record has been found and its frags
referenced with netmem_inc_ref():

fill_sg_in() {
    ...
	if (skb_to_sgvec(skb, &sg_in[i], tcp_payload_offset, payload_len) < 0)
		return -EINVAL;
    ...
}

__skb_to_sgvec() can return -EMSGSIZE when the sg table runs out or the
recursion is too deep, or -EINVAL when the length is short. In that case
the packet of a live record is dropped because the scatterlist conversion
failed, not because of an ACK.

The drop and the put_sg cleanup are fine for all three paths. Could the
comment say something like "drop the skb on lookup or sg setup failure"
instead?

>  
>  	nskb = tls_enc_skb(tls_ctx, sg_out, sg_in, skb, sync_size, rcd_sn);

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com
Technical Details
Message-ID: <179651658685.3148.5418160875152343674@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378194-linux-kernel-netdev=dewy.ru
References: <20261204235642.36653-5-rjethwani@purestorage.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378194-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 4/9] tls: device: remove the dead start marker
 bypass in TX fallback
Date: Sun, 06 Dec 2026 00:23:06 +0000
Organization: Usenet Network
Message-ID: <179651658685.3148.5418160875152343674@kernel.org>
References: <20261204235642.36653-5-rjethwani@purestorage.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3150605"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yV2nEuBWgxFJrItqlKBJ67SxXdk= sha256:yN6TKswahNNPaisoHPeWp3xhkfyzYHvCDHzGuSDMFp8=
	sha1:53L6RvETLlqou27vmlAjjxhevAQ= sha256:LKhoBrfN694G8NwC1luDdoiOIz+M+vhAr7XDfQXBu+w=
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 A81F4117F04; Sun,  6 Dec 2026 03:23:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.54
X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, 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] 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 FcYiFiz8WLbh;
	Sun,  6 Dec 2026 03:23:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378194-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7CC41117EF8; Sun,  6 Dec 2026 03:23:13 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 4576D3297A; Sun,  6 Dec 2026 00:23:09 +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=1796516589;
	b=5BP0ds/Vq5XkViuw0AGoV9ZDr4zH6da3oMGxczOnbVFpwZGTT5S8DN6ECFaWVQ3HlchZ
	 Zg9N+G2mxeegJQ8sVCm81La58NconY7LtWhHDapZd3x2gid8koWcGKFtlRp0pMtHpLVK3
	 mUJLqQj/iSp/5ss69KdTbKoSAkwULyVkpFnpvQF0BDUOLYOFd7PWceuP7qaHPuq8LfaTj
	 sTo58j0kRs4p33+EYzs0P/ofTjYwrTsxtbyDz06CVthbWY/qI9VD2gNg1sATXwL6vkU36
	 7yJyXXuWy4Tn9xQtMWWIOEvcPBk3RieZgWk4Jf8v8xFMw1OZ77dihiho1k38VPR6k7w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796516589;
	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=tRx3qwj5dMwwOlwErHi2YOwXnel30Vw7siietJUl+rE=;
	b=gIqbirqyCrbHdAEK6pncY7YenntEWfVt2ZcjfY8tP6KhRWegHGZ9GP/+pMtOu91Lelao
	 AXWKZ9/DqoUL+VMP/rJL5h8qpreTbhQU+ic5qBke7MuRVh/jUV0kNTugYrZ+JAo3pt63W
	 eH+w2O58uf01k1ysjhetASiM3VLDjtaTMe9yu2mgFrsa1rxTPVSnCeBfUuNdj7Hctg80r
	 rrPe+/ow0NzhI5EshD8xlJ/wTIcqroJ9dMLK0+HwMvT5US/+IaHQlxFaNMzwjnOLcOkma
	 EGgPt855UO52h+NVmhzaxoI83uuAP15fYY06CrnTa0ex5tUmuVP36ZvPJoHy9LgOSvA==
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=QQUVJv3E;
	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 1E347606A330;
	Sun,  6 Dec 2026 00:23:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QQUVJv3E
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=1796516588;
	b=o80/MxwRXMBhWqydS0YIp3omARD8lUANsv00sbzMpgFjoO92IlJDRFAgwGLJ9hGz62fF
	 MIWq9Ve6iKp+l1IKW3hYnb3N2FNualeefiXUJH+Ra33sh0q2WnCsD4iEpyaBoXTo92CR/
	 Hj1GoXfhAvOe+gs9m8nEmu7O9jUyHuO+p29rRMRgHRFJkw0pUyJh50q952uoIWZYGsgqO
	 9qIgJRJ+v07M+ObY7hQi0a/8hakS614lKJyIcYySX/DExD9jfLYOGKEaLhOsu1lRCdIqp
	 B0SNMHFNaZh2AFph5N5PFSoxcwZQfWTc56F7AV7gZMCYANZRBCMvrncCNem6xFJyJuQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796516588;
	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=tRx3qwj5dMwwOlwErHi2YOwXnel30Vw7siietJUl+rE=;
	b=WsJUFF5R9tlaChLBmYwIRPmtkxTx7F56wTxRxHeYF2cd8Q0heRODzbduZCzyyuF5dbJX
	 wk4M2g18mDr4tDdtiKwq1WtGt7s2cQ+DhzIyQ68B1yTRq2UBKA1mTr6NVviNmjVX+6wZp
	 Fi917c8GxMX8lj4RdX20tbAH4YHT0VHeZPSiVFl8U8kJGQlfavA2k2EePZeN9cqaAmyzx
	 Gs13FCvXEZsJDMnTg4r0wClmFEa7PWcmLBXiGtwNwRYzvQlV+oRJpcllZOSZCqWeGxYsr
	 BBV8XvYaERGzTNbYtmRWLzgIbtrk93UvhfwkbMCEIg5HhdnmLA43vwtRKfhTxU0+r7w==
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=QQUVJv3E;
	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 40762606A338;
	Sun,  6 Dec 2026 00:23:08 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43E091F0093B;
	Sun,  6 Dec 2026 00:23:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796516587;
	bh=tRx3qwj5dMwwOlwErHi2YOwXnel30Vw7siietJUl+rE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=QQUVJv3EimnS+6ZhPQ9KDhkrR7cmBQgfnKQx5ElDfWjt2Uk97AD/dkuvwh0dymkgE
	 w0thBKmTx3rOpy5yWZqAAGoJh76oUR3jpBrmhWrclR/VXzRxU0F6D9p2RRGtuuNiIZ
	 9DzuR4WiRw3PVqDUR/K4KQXvXkk+dKMII9LtGpH+SKCHMmEaP7J2tBnKWwhkTxU5H8
	 sHe7SM18uthKOLrR71C0BwRViNKegnNyJFiFw8E3QLTzmzrSaDnpPNEVI9usjrKbd0
	 bCQb92HZd5tLXX+/xE8pDajrEmhK7ZLZFIyCUvnx1VZBXOBjugmYiLU6PqXMpTHFMb
	 fhO5j0zCZs82g==
X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, john.fastabend@gmail.com,
 kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org,
 pabeni@redhat.com, willemb@google.com, horms@kernel.org,
 alice.kernel@fastmail.im, tariqt@nvidia.com
X-In-Reply-To: <20261204235642.36653-5-rjethwani@purestorage.com>
X-sashiko-severity: Low
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