From: Sabrina Dubroca <sd@queasysnail.net>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Wilfred Mallawa <wilfred.opensource@gmail.com>,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Jonathan Corbet <corbet@lwn.net>,
Simon Horman <horms@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH net-next v8 1/2] net/tls: support setting the maximum payload size
Date: Mon, 27 Oct 2025 12:32:02 +0100 [thread overview]
Message-ID: <aP9YMiW9V7Dkhu_1@krikkit> (raw)
In-Reply-To: <20251024163336.5fba5cd1@kernel.org>
2025-10-24, 16:33:36 -0700, Jakub Kicinski wrote:
> On Fri, 24 Oct 2025 12:11:11 +1000 Wilfred Mallawa wrote:
> > In the previous record_size_limit approach for TLS 1.3, we need to
> > account for the ContentType byte. Which complicates get/setsockopt()
> > and tls_get_info(), where in setsockopt() for TLS 1.3 we need to
> > subtract 1 to the user provided value and in getsockopt() we need add 1
> > to keep the symmetry between the two (similarly in tls_get_info()). The
> > underlying assumption was that userspace passes up directly what the
> > endpoint specified as the record_size_limit.
> >
> > With this approach we don't need to worry about it and we can pass the
> > responsibility to user-space as documented, which I think makes the
> > kernel code simpler.
>
> But we haven't managed to avoid that completely:
>
> + if (value < TLS_MIN_RECORD_SIZE_LIM - (tls_13 ? 1 : 0) ||
We could, by taking a smaller minimum payload size than what the RFC
says (anything that allows us to make progress, maybe 8B?). ie, I
don't think we have to be as strict as rfc8449 (leave the userspace
library in charge of rejecting bogus values during negotiation of this
extension).
> I understand the motivation, the kernel code is indeed simpler.
Also more consistent: the kernel syscalls work with record payload (at
the send()/recv() level). The rest is hidden. Userspace could try an
approximation by sending max_payload-sized chunks with MSG_EOR.
> Last night I read the RFC and then this patch, and it took me like
> 10min to get all of it straight in my head.
I don't find this stuff very clear either tbh, but maybe that's a
problem in the RFC itself.
> Maybe I was tried but
> I feel like the user space developers will judge us harshly for
> the current uAPI.
But userspace libraries have to do the same computations on their side
if they want to implement this RFC. They have to figure out what the
max payload size is as they're building the record, they can't just
chop off a bit at the end after filling it.
Quick grepping through gnutls got me to this:
https://gitlab.com/gnutls/gnutls/-/blob/eb3c9febfa9969792b8ac0ca56ee9fbd9b0bd7ee/lib/ext/record_size_limit.c#L104-106
So I have a slight preference for not being tied to a (kind of
confusing) RFC.
--
Sabrina
next prev parent reply other threads:[~2025-10-27 11:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 0:19 [PATCH net-next v8 1/2] net/tls: support setting the maximum payload size Wilfred Mallawa
2025-10-22 0:19 ` [PATCH net-next v8 2/2] selftests: tls: add tls record_size_limit test Wilfred Mallawa
2025-10-22 21:51 ` Sabrina Dubroca
2025-10-22 21:51 ` [PATCH net-next v8 1/2] net/tls: support setting the maximum payload size Sabrina Dubroca
2025-10-24 1:44 ` Jakub Kicinski
2025-10-24 2:11 ` Wilfred Mallawa
2025-10-24 23:33 ` Jakub Kicinski
2025-10-26 8:50 ` Wilfred Mallawa
2025-10-27 11:32 ` Sabrina Dubroca [this message]
2025-10-27 23:13 ` Jakub Kicinski
2025-10-27 23:30 ` patchwork-bot+netdevbpf
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=aP9YMiW9V7Dkhu_1@krikkit \
--to=sd@queasysnail.net \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=wilfred.opensource@gmail.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;
as well as URLs for NNTP newsgroup(s).