Netdev List
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Chuck Lever <cel@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Shuah Khan <shuah@kernel.org>, Jeff Layton <jlayton@kernel.org>,
	NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: netdev@vger.kernel.org, kernel-tls-handshake@lists.linux.dev,
	linux-kselftest@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/6] net/tls: Bound consecutive no-data records in tls_sw_read_sock()
Date: Thu, 23 Jul 2026 09:11:03 +0200	[thread overview]
Message-ID: <b9d60674-1ba7-4f23-beee-4ddfffd4dda9@suse.de> (raw)
In-Reply-To: <20260720-tcp-read-sock-v2-1-29545d034f3c@kernel.org>

On 7/20/26 4:27 PM, Chuck Lever wrote:
> A record that delivers no payload -- an empty TLS 1.3 data record
> today, a control record once read_sock_rectype() lands -- leaves
> tls_sw_read_sock() in its loop without advancing the caller's read
> descriptor. A peer that streams such records keeps the receive loop
> running, and the socket lock held, for as long as the records
> arrive.
> 
> Cap the number of consecutive no-data records consumed per call. The
> count resets on any record that delivers bytes, so a normal stream
> is unaffected; a peer supplying only empty records is bounded to
> TLS_RX_NODATA_LIMIT iterations before the call returns 0. read_sock
> consumers treat that as "no progress, re-poll" rather than EOF, so
> the connection stays up and makes progress once real data arrives.
> 
> Only tls_sw_read_sock() needs this cap. Its consumers drive the receive
> loop from kernel context -- a work item or service thread holding the
> socket lock across the whole call with no return to userspace -- so an
> unbounded empty-record stream keeps that context and the lock pinned
> for as long as the flood lasts. The cap supplies the return boundary
> that a system call would otherwise provide. tls_sw_splice_read()
> and tls_sw_recvmsg() already have one: they run in the calling task's
> context, reschedule while draining the socket backlog (cond_resched()
> in __release_sock()), and drop the socket lock when the call returns. A
> flood there costs the caller only its own scheduler time, so the cap
> would add nothing.
> 
> Signed-off-by: Chuck Lever <cel@kernel.org>
> ---
>   net/tls/tls_sw.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
This is technically a fix, so it might be worthwhile sending it
on its own.

Otherwise:

Reviewed-by: Hannes Reinecke <hare@kernel.org>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

  reply	other threads:[~2026-07-23  7:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 14:27 [PATCH net-next v2 0/6] Deliver TLS control records to kernel read_sock consumers Chuck Lever
2026-07-20 14:27 ` [PATCH net-next v2 1/6] net/tls: Bound consecutive no-data records in tls_sw_read_sock() Chuck Lever
2026-07-23  7:11   ` Hannes Reinecke [this message]
2026-07-23 13:24     ` Chuck Lever
2026-07-23 14:23       ` Sabrina Dubroca
2026-07-23 14:29         ` Chuck Lever
2026-07-20 14:27 ` [PATCH net-next v2 2/6] net: Introduce read_sock_rectype proto_ops for control record delivery Chuck Lever
2026-07-23  7:14   ` Hannes Reinecke
2026-07-20 14:27 ` [PATCH net-next v2 3/6] tls: Implement read_sock_rectype for kTLS software path Chuck Lever
2026-07-23  7:14   ` Hannes Reinecke
2026-07-20 14:27 ` [PATCH net-next v2 4/6] selftests/tls: Add tests for data/control record interleaving Chuck Lever
2026-07-20 14:27 ` [PATCH net-next v2 5/6] SUNRPC: Use read_sock_rectype for svcsock TCP receives Chuck Lever
2026-07-20 14:28 ` [PATCH net-next v2 6/6] SUNRPC: Remove sock_recvmsg path from " Chuck Lever
2026-07-23  7:19 ` [PATCH net-next v2 0/6] Deliver TLS control records to kernel read_sock consumers Hannes Reinecke

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=b9d60674-1ba7-4f23-beee-4ddfffd4dda9@suse.de \
    --to=hare@suse.de \
    --cc=Dai.Ngo@oracle.com \
    --cc=cel@kernel.org \
    --cc=horms@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    --cc=tom@talpey.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