Re: [PATCH net 1/2] tls: don't hide a queued KeyUpdate from poll()

From: Sabrina Dubroca

Date: Wed Nov 25 2026 - 11:40:06 EST


2026-11-18, 17:35:48 -0300, Felipe Pereira Stival via B4 Relay wrote:
> From: Felipe Pereira Stival <v0idpwn@xxxxxxxxx>
>
> When application data and a KeyUpdate are both queued, the recv() for
> the data can also decrypt the KeyUpdate. That makes a rekey pending,
> and the KeyUpdate is left on rx_list because its record type differs.
> tls_sk_poll() reports no read events while a rekey is pending, so the
> socket doesn't poll readable although a recvmsg() would return the
> KeyUpdate. A reader that waits for a read event before each recv()
> never reads it, never provides the new key and receives nothing more.
>
> Report read events for records on rx_list while a rekey is pending,
> since they are already decrypted. Keep ignoring the records still in
> the strparser, so once the KeyUpdate has been read there are no read
> events until the new key is provided, as before. Update the
> documentation to say so.
>
> Found with a level-triggered epoll reader that does one recv() per
> read event. Without this patch it gets the data and then no read event
> for the KeyUpdate; with it, the KeyUpdate is reported and the rekey
> completes.
>
> Fixes: 47069594e67e ("tls: implement rekey for TLS1.3")
> Assisted-by: Claude:claude-fable-5-2
> Signed-off-by: Felipe Pereira Stival <v0idpwn@xxxxxxxxx>
> ---
> Documentation/networking/tls.rst | 7 ++++---
> net/tls/tls_main.c | 6 +++---
> 2 files changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>

--
Sabrina