Linux Documentation
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Rishikesh Jethwani <rjethwani@everpuredata.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] tls: refuse RX records after record-number exhaustion
Date: Fri, 16 Oct 2026 10:39:23 +0200	[thread overview]
Message-ID: <atHiu9gmKQAoqTD0@krikkit> (raw)
In-Reply-To: <CAKaoeS1E7jMyP8F9a+SAheE4+o6RG2VOdA5uiSjZe5yX+E0wEg@mail.gmail.com>

2026-10-13, 10:55:26 -0700, Rishikesh Jethwani wrote:
> On Tue, Oct 13, 2026 at 2:38 AM Sabrina Dubroca <sd@queasysnail.net> wrote:
> >
> > 2026-10-12, 18:27:01 -0600, Rishikesh Jethwani wrote:
> > > A receive socket records sequence-number exhaustion only in sk_err.
> > > After processing record UINT64_MAX, it advances the counter to zero and
> > > reports EBADMSG, but SO_ERROR or sock_error() can clear that error.
> >
> > I vaguely remember a discussion around making some fatal errors more
> > permanent (ie not use sk_err).
> 
> Do you have a pointer to that thread? If there's a preferred way to make
> these errors sticky, I'd rather use it than add a one-off flag.

https://lore.kernel.org/all/ajFpejsl1ukTbG96@krikkit/

and I had a suggestion at the end, but I guess I got interrupted and
never got back to it.

> 
> > > parser-ready record also bypasses the socket-error check in the record
> > > wait. The receiver can then accept a record authenticated for sequence
> > > zero under the same exhausted key.
> >
> > I guess, but what's the problem with wrapping as long as we don't
> > reuse the same record number?
> 
> You're right, in practice there isn't one. The only way to get there is
> for userspace to install a rec_seq close to the limit, so sequence 0 was
> never used under that key and nothing can be replayed. Starting there
> already breaks RFC 8446 5.3, which requires the first record under a
> key to use sequence number 0.
> 
> What's left is consistency. Today the wrap gives at most one EBADMSG,
> and none if the next record has already been parsed. After that recv

I'm not seeing the "none if the next record has already been parsed"
flow. Can you describe the sequence of events?

> continues at record 0, which is neither rekeying nor terminating. TX
> behaves the same way: the UINT64_MAX record is queued, and it goes out
> once SO_ERROR is cleared.

Then why are you patching only RX here? Both are just as problematic?


If we implement the "abort with (some error code) is actually final,
and not cleared with sk_err" idea, all this goes away?


> So I'll drop the security framing and the Fixes tag. I can either drop
> the patch, or send a minimal version for net/net-next that makes the wrap
> error stick on both RX and TX, without touching the rekey path. Which
> would you prefer?

For this, net-next should be fine.


> > For 1.3, just do a "silent rekey" (change the key but don't send a
> > keyupdate) on the TX side to record number 0 with the same key? And it
> > should be enough to test this with just 1.3.
> 
> Agreed, that gets rid of the fixed vectors. Since 1.3 only uses the
> record number in the nonce, TX can also produce the UINT64_MAX record
> cleanly, using rec_seq 0 and the IV XORed with UINT64_MAX. If the patch

I don't get this rec_seq 0 and IV to reach UINT64_MAX. Why not just
pass rec_seq = 0xff..., like the current recseq_wrap test?

-- 
Sabrina

  reply	other threads:[~2026-10-16  8:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  0:27 [PATCH net] tls: refuse RX records after record-number exhaustion Rishikesh Jethwani
2026-10-13  0:29 ` netdev-bot+sinfo
2026-10-13  9:38 ` Sabrina Dubroca
2026-10-13 17:55   ` Rishikesh Jethwani
2026-10-16  8:39     ` Sabrina Dubroca [this message]
2026-10-14  1:21 ` netdev-bot+sashiko

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=atHiu9gmKQAoqTD0@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=rjethwani@everpuredata.com \
    --cc=skhan@linuxfoundation.org \
    /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