From: Sabrina Dubroca <sd@queasysnail.net>
To: Chuck Lever <cel@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
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>,
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 2/6] net: Introduce read_sock_rectype proto_ops for control record delivery
Date: Fri, 31 Jul 2026 10:36:46 +0200 [thread overview]
Message-ID: <amxenihnJifrwuYv@krikkit> (raw)
In-Reply-To: <6deaada6-b916-4232-9df9-fff27472e98c@app.fastmail.com>
2026-07-30, 20:12:22 -0400, Chuck Lever wrote:
>
>
> On Thu, Jul 30, 2026, at 5:35 PM, Jakub Kicinski wrote:
> > On Thu, 30 Jul 2026 16:16:33 +0200 Sabrina Dubroca wrote:
> >> 2026-07-29, 16:31:42 -0700, Jakub Kicinski wrote:
>
> >> > Off the top of my head I think a setsockopt which pre-seeds the content
> >> > type so that the read returns an errno if the queued content type is
> >> > different could be a simple fix. You'd configure that on your sockets
> >> > to DATA and once you see a EWHATEVER you'd assume that some special
> >> > record arrived and the socket has to be handed back over to the TLS
> >> > control path. This is literally the first thing that comes to mind,
> >> > IDK how ugly it will look in reality so no promises.
> >>
> >> But then you're back to "read_sock stopped, caller has to take some
> >> special action to handle the next bit of payload". It's not better
> >> than "read_sock, and do a recvmsg when read_sock says it's not DATA".
>
> But the “recover the control type with a separate operation” is strictly
> better than “pass a CMSG buffer to every I/O operation just in case” ;-)
That's up to every user to decide :)
> > My bad, I replied without looking at the code.
> > We already constrain control records in the way I proposed.
> > rcvmsg (w/o cmsg) and read_sock will error out if the next
> > record is control.
>
> Almost.
>
> There is no API contract for ->read_sock, but the TLS read_sock
> implementation itself will return -EINVAL for two unrelated reasons:
>
> - net/tls/tls_sw.c:2068-2072 — entry gate: sk_psock_get(sk) returns
> non-NULL, so the socket is under sockmap/BPF. Drop the ref and
> refuse before even acquiring the reader.
You can ignore this one, it's just a leftover that 79511603a65b ("tls:
remove dead sockmap (psock) handling from the SW path") missed. I'll
get back to cleaning all this up once I'm not drowning in reviews
(I'm sure being on holidays next week will help with that).
> - net/tls/tls_sw.c:2111-2115 — per-record: tlm->control !=
> TLS_RECORD_TYPE_DATA. The record is requeued rather than consumed.
>
> As far as I can tell, no other socket provider that implements read_sock
> will return -EINVAL. But this isn’t a documented guarantee that a
> socket consumer can depend on, currently.
>
> What would make this just a little friendlier is having distinct errnos
> for these two conditions, and a kdoc API contract that documents them.
+1 on the API contract doc. I have no idea what read_actor does to
desc, how that relates to the returned value, and if it modifies the
skb it gets in any way. That makes it hard to figure out the correct
behavior for tls_sw_read_sock().
Maybe we should even come up with some new internal errno (like one of
the >=512 in include/linux/errno.h). And maybe this -errno return
should be desc->error instead. I really don't know how read_sock is
supposed to behave.
--
Sabrina
next prev parent reply other threads:[~2026-07-31 8:36 UTC|newest]
Thread overview: 36+ 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
2026-07-23 13:24 ` Chuck Lever
2026-07-23 14:23 ` Sabrina Dubroca
2026-07-23 14:29 ` Chuck Lever
2026-07-23 22:05 ` Sabrina Dubroca
2026-07-29 1:47 ` Jakub Kicinski
2026-07-29 3:17 ` 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-29 1:51 ` Jakub Kicinski
2026-07-29 1:57 ` Chuck Lever
2026-07-29 2:30 ` Jakub Kicinski
2026-07-29 2:51 ` Chuck Lever
2026-07-29 12:23 ` Sabrina Dubroca
2026-07-29 13:13 ` Chuck Lever
2026-07-29 23:31 ` Jakub Kicinski
2026-07-30 14:16 ` Sabrina Dubroca
2026-07-30 21:35 ` Jakub Kicinski
2026-07-30 23:09 ` Sabrina Dubroca
2026-07-30 23:34 ` Jakub Kicinski
2026-07-30 23:40 ` Sabrina Dubroca
2026-07-31 0:12 ` Chuck Lever
2026-07-31 8:36 ` Sabrina Dubroca [this message]
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
2026-07-29 1:43 ` Jakub Kicinski
2026-07-29 1:46 ` Chuck Lever
2026-07-29 1:55 ` Jakub Kicinski
2026-07-29 2:16 ` Chuck Lever
2026-07-29 2:24 ` Jakub Kicinski
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=amxenihnJifrwuYv@krikkit \
--to=sd@queasysnail.net \
--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=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