From: Martin Belanger <martin.nvme.dev@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH net-next v5 5/6] tls: send a KeyUpdate at the record limit and on request
Date: Wed, 4 Nov 2026 17:59:33 -0500 [thread overview]
Message-ID: <14067bc2-41fc-40ab-84be-adea737479ab@gmail.com> (raw)
In-Reply-To: <sashiko-outbox-198141@kernel.org>
On 11/4/26 16:43, sashiko-bot@kernel.org wrote:
> > + ret = tls_encrypt_async_wait(ctx);
> > + if (!ret)
> > + ret = tls_keyupdate_rekey(sk, 1);
>
> [Severity: Medium]
> As reported by Sashiko on v4 [1], can tls_tx_key_update() ignore fatal
> transmission errors and rotate the TX key anyway when
tls_tx_records() fails
> with -EPIPE or -ECONNRESET?
Yes, but this is not specific to KeyUpdate. After shutdown(SHUT_WR),
send() on a kTLS socket with no KeyUpdate also returns the full
length. I tested this with TLS 1.3 AES-GCM. As I read the code, the
KeyUpdate record then stays queued and TCP does not send it, so the
peer never sees a record with the next key.
This corrects my note in the v2 changes, "The next call reports the
error". In the same test, the next send() also returned success.
> [Severity: High]
> As reported by Sashiko on v4 [2], how is the KeyUpdate state in struct
> tls_context synchronized when sk_stream_wait_memory() drops lock_sock(sk)
> during a send or TLS_TX_KEY_UPDATE?
No change, for the reasons in the v4 changes. I checked these points
by reading the code.
Points 1 and 2 need a TLS_TX or TLS_RX setsockopt() during a blocked
sendmsg(), which is an application error.
Point 3: tx_key_update_reply stays set after the update_requested
KeyUpdate, so the reply still goes out before the next Application
Data record.
Point 4: a record that was already being written can go out before
the reply. RFC 9846 section 4.7.3 allows this for records in flight.
Martin
next prev parent reply other threads:[~2026-11-04 22:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 21:43 [PATCH net-next v5 0/6] tls: perform TLS 1.3 KeyUpdate in the kernel Martin Belanger via B4 Relay
2026-11-03 21:43 ` [PATCH net-next v5 1/6] tls: add HKDF-Expand-Label for the TLS 1.3 key schedule Martin Belanger via B4 Relay
2026-11-03 21:43 ` [PATCH net-next v5 2/6] tls: add socket options to register the traffic secrets Martin Belanger via B4 Relay
2026-11-03 21:43 ` [PATCH net-next v5 3/6] tls: loop in tls_sw_splice_read() until it has a record Martin Belanger via B4 Relay
2026-11-04 7:42 ` Hannes Reinecke
2026-11-03 21:43 ` [PATCH net-next v5 4/6] tls: update the RX key when a KeyUpdate is received Martin Belanger via B4 Relay
2026-11-04 7:42 ` Hannes Reinecke
2026-11-04 21:43 ` sashiko-bot
2026-11-04 22:57 ` Martin Belanger
2026-11-04 23:34 ` Martin Belanger
2026-11-03 21:43 ` [PATCH net-next v5 5/6] tls: send a KeyUpdate at the record limit and on request Martin Belanger via B4 Relay
2026-11-04 21:43 ` sashiko-bot
2026-11-04 22:59 ` Martin Belanger [this message]
2026-11-04 23:35 ` Martin Belanger
2026-11-03 21:43 ` [PATCH net-next v5 6/6] selftests/tls: add KeyUpdate tests Martin Belanger via B4 Relay
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=14067bc2-41fc-40ab-84be-adea737479ab@gmail.com \
--to=martin.nvme.dev@gmail.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
/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