Article View: linux.kernel.netdev
Article #4647Re: [PATCH net-next v5 06/10] tls: Return copied data ahead of a run of empty records
From: netdev-bot+sashiko
Date: Sun, 18 Oct 2026 19:23
Date: Sun, 18 Oct 2026 19:23
99 lines
9153 bytes
9153 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] The new early exit in tls_sw_recvmsg() (net/tls/tls_sw.c:1946,
`if (decrypted + copied >= target) break;`) only fires once the low-…
--
tls: Return copied data ahead of a run of empty records
This patch makes tls_sw_recvmsg() leave its receive loop at a zero-length
application_data record once the receive low-water mark has been met. The
goal is to stop a stream of empty records from holding back data that has
already been copied. A reader that has copied nothing keeps reading empty
records for as long as they arrive.
Link: https://lore.kernel.org/r/179124254665.434549.12245680127262431659@kernel.org
> diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
> index 153ff135a395e..9b4e66567ee8d 100644
> --- a/net/tls/tls_sw.c
> +++ b/net/tls/tls_sw.c
> @@ -1939,6 +1939,12 @@ int tls_sw_recvmsg(struct sock *sk,
>
> /* An empty record still marks a boundary. */
> msg->msg_flags |= MSG_EOR;
> +
> + /* Return data already copied instead of holding it
> + * through a run of empty records.
> + */
> + if (decrypted + copied >= target)
> + break;
> continue;
[Severity: High]
Does this leave the same stall in place for a reader that is still below
target?
When SO_RCVLOWAT is above the bytes copied so far, or MSG_WAITALL makes
target equal len, the check above is false. The empty record then takes the
continue. An empty record changes neither len nor decrypted, so the loop
condition stays true:
while (len && (decrypted + copied < target || tls_strp_msg_ready(ctx))) {
Each pass calls tls_rx_rec_wait(). That function recomputes the timeout on
every call and skips its wait loop while a record is ready:
timeo = sock_rcvtimeo(sk, nonblock);
while (!tls_strp_msg_ready(ctx)) {
...
if (!timeo)
return -EAGAIN;
...
}
As a result, MSG_DONTWAIT, O_NONBLOCK and SO_RCVTIMEO never come into
play. The only way out is this check at the top of the loop:
if (nodata && signal_pending(current)) {
So if a peer keeps validly encrypted empty application_data records ready,
can a nonblocking or timed reader with partial data stay in the kernel?
It would hold the socket and reader locks and withhold the data it has
already copied.
The commit message describes that outcome as "the reader does not get the
data already copied until the stream stops or a signal is pending". The
same applies to a reader that has copied nothing, which the commit message
mentions.
tls_sw_splice_read() and tls_sw_read_sock() in the same file already stop a
run of empty records with a counter:
if (++nodata >= TLS_RX_NODATA_LIMIT) {
err = -EAGAIN;
goto splice_read_end;
}
Would a consecutive-empty-record cap like TLS_RX_NODATA_LIMIT in
tls_sw_recvmsg() also cover the below-target and zero-copied readers? It
would also cover the case this patch handles. TLS_RX_NODATA_LIMIT is
currently defined after tls_sw_recvmsg(), so it would need to move up.
> }
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261014-tls-follow-on-v5-0-e76c301d4f05%40kernel.org
Technical Details
Message-ID:
<179235138070.3135.12865177018877469954@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-348163-linux-kernel-netdev=dewy.ruReferences:
<20261014-tls-follow-on-v5-6-e76c301d4f05@kernel.org>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-348163-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 06/10] tls: Return copied data ahead of a run of empty records Date: Sun, 18 Oct 2026 19:23:00 +0000 Organization: Usenet Network Message-ID: <179235138070.3135.12865177018877469954@kernel.org> References: <20261014-tls-follow-on-v5-6-e76c301d4f05@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3408196"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KNuT/Zd/CgUjsAvaOkr1TuxR8gY= sha256:CkPvuVi0f4wRhxbqAQsmY7B6z5JpZywNdmLee9KKQ6I= sha1:wCQJN8rkl5vyIhFDfNADsWQjL3c= sha256:LPcg+5YBmcgk88pL9kGex6jhLnb1KPxZrYxtJ3nDmdI= 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 0E8E011088E; Sun, 18 Oct 2026 22:24:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.739 X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.34, 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 GaCk1WlZDE5Z; Sun, 18 Oct 2026 22:24:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348163-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 BBC01110856; Sun, 18 Oct 2026 22:24:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id B9BC838562; Sun, 18 Oct 2026 19:23:03 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EB22434E39; Sun, 18 Oct 2026 19:23:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jE6CClyV" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A32942C518; Sun, 18 Oct 2026 19:23:02 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792351383; cv=none; b=mOPwU9K6eXKZi0DyI4soYdqFxLpBW6q5KvcRAATSkqJSrH9urQz0TqY+AtjA0M4de936gymbM504kbjUB/+ojuJp2kuUiNd7lFKlytavym5qQyHmbWnxYbMQY/3R9gTvUvocTKV5vmfXaCeKtlsXdB55bWIq5hixy554BfxOYMk= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792351383; c=relaxed/simple; bh=B37RTulw4RX1Ff9FqeqMQ+FAneV8Yl3f0jLUHusMLF4=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Ntrb7vCw0jXFn3lKTJGHvz+svJkjZJhc3eRxvK1tmnJyk4Qaq7+fe275JR2YdvqljAlwjcVrlSAdvidrvkmTVx4XM9f9JQkqJm3vy2OFJNg84AbNX/1LDPX00G4k+EobLn3fC9WPkKyIrI0VE9GcF9x/vU4kMXbO+Kj7hbYiuJ0= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jE6CClyV; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333B21F000C5; Sun, 18 Oct 2026 19:23:01 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792351382; bh=mEcpHdoCCwqcpv4/GZZ9AiedtffME2iXy+yfQZbjY4I=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=jE6CClyVU4vSTbyhoNYVxzgGywNENIcYeLJUwid9rPOAUYR97VUeFZjY40qBe7XyG N5IaTbQRzF9VGU5Du7Bj8/UxamIbtMfks1YDYftXnGRNYkNafEcRSm/IisPvDj/3Ko x35qehsaLq4F8y9TZ4IbTGPtYYYNx6nA1p5KpzaRED4PaWZVBzoxRku7iHhRwrgsjD VjfZMrbBRTeChdmXETg9g3Rz/refv03fdCgd6tGpTkyB4alsFDTzSihBfuV+OzWBg8 gx8KIAa0rRTyqMNgwF9CULm+0SpgbsuHtiflBHjyDmnsJeuv/s2T8Fc1w5X8RM/wXY HOTf0zpjBzkMQ== X-Cc: john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, pabeni@redhat.com, horms@kernel.org, davejwatson@fb.com, shuah@kernel.org, qingfang.deng@linux.dev, edumazet@kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261014-tls-follow-on-v5-6-e76c301d4f05@kernel.org> X-sashiko-severity: High X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>