Linux Documentation
 help / color / mirror / Atom feed
* [PATCH net 0/2] tls: don't hide a queued KeyUpdate from poll()
@ 2026-11-18 20:35 Felipe Pereira Stival via B4 Relay
  2026-11-18 20:35 ` [PATCH net 1/2] " Felipe Pereira Stival via B4 Relay
  2026-11-18 20:35 ` [PATCH net 2/2] selftests: tls: add a poll test for a queued KeyUpdate Felipe Pereira Stival via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Felipe Pereira Stival via B4 Relay @ 2026-11-18 20:35 UTC (permalink / raw)
  To: John Fastabend, Jakub Kicinski, Sabrina Dubroca, David S. Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, Jonathan Corbet,
	Shuah Khan, Randy Dunlap, Shuah Khan
  Cc: netdev, linux-doc, linux-kernel, linux-kselftest,
	Felipe Pereira Stival

A kTLS reader that waits for a read event before each recv() can stall
after the peer sends a TLS 1.3 KeyUpdate. I ran into this while testing
a kTLS patch for Erlang/OTP.

Erlang does one recv() per read event, with level-triggered epoll.
When application data is followed by a KeyUpdate, one recv() can
decrypt both records, return the data without an error, and leave the
KeyUpdate queued. Because a rekey is now pending, poll() no longer
reports the socket as readable. Without another read event, the reader
never calls recv() again, never sees the -EIO for the KeyUpdate, and
never provides the new key.

Patch 1 keeps the socket readable until the reader has consumed the
KeyUpdate. As before, poll() doesn't report records after the
KeyUpdate until userspace provides the new key. Patch 2 adds a
selftest, which fails without patch 1.

I worked on this with an AI coding assistant (Claude). It wrote the
first drafts of the code and the commit messages, and I reviewed and
reworked them. I directed the whole process, from tracing the missing
read event to tls_sk_poll() to checking how other kinds of readers
are affected and testing in QEMU/KVM.

Signed-off-by: Felipe Pereira Stival <v0idpwn@gmail.com>
---
Felipe Pereira Stival (2):
      tls: don't hide a queued KeyUpdate from poll()
      selftests: tls: add a poll test for a queued KeyUpdate

 Documentation/networking/tls.rst  |  7 ++++---
 net/tls/tls_main.c                |  6 +++---
 tools/testing/selftests/net/tls.c | 40 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 6 deletions(-)
---
base-commit: 2a324a58a084c5cfd7e5a2f55e0786bee170a4a5
change-id: 20261118-v0idpwn-tls-poll-parked-keyupdate-21792b8cfe6d

Best regards,
--  
Felipe Pereira Stival <v0idpwn@gmail.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-22 21:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 20:35 [PATCH net 0/2] tls: don't hide a queued KeyUpdate from poll() Felipe Pereira Stival via B4 Relay
2026-11-18 20:35 ` [PATCH net 1/2] " Felipe Pereira Stival via B4 Relay
2026-11-22 21:26   ` netdev-bot+sashiko
2026-11-18 20:35 ` [PATCH net 2/2] selftests: tls: add a poll test for a queued KeyUpdate Felipe Pereira Stival via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox