public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v2 proxmox 0/3] Fix #5105: Overhaul TLS Handshake Checking Logic
@ 2024-07-08 16:48 Max Carrara
  2024-07-08 16:48 ` [pbs-devel] [PATCH v2 proxmox 1/3] rest-server: connection: clean up accept data flow Max Carrara
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Max Carrara @ 2024-07-08 16:48 UTC (permalink / raw)
  To: pbs-devel; +Cc: Wolfgang Bumiller

Fix #5105: Overhaul TLS Handshake Checking Logic - v2
=====================================================

Notable Changes Since v1
------------------------

As discussed with Wolfgang off-list, instead of busy-waiting and
continuously yielding back to the event loop, patch 03 now makes use of
some lower-level functionality in tokio, which allows us to "retry"
peeking into the TCP stream's queue and raise an EAGAIN / EWOULDBLOCK if
we haven't received all required bytes to perform the TLS handshake
check.

The reason for this change is that streams behave incorrectly in terms
of edge-triggering [1], and we currently have no guarantee that we won't
run into related bugs when we're peeking into the stream's queue (or
that they won't affect us) in the future.

In short, the event loop isn't supposed to wake the task again if we
didn't receive enough bytes yet. With the change made to patch 03, what
happens is that we're only peeking into the stream's queue if we're told
that we can actually peek again.

All in all, we're not busy-waiting anymore while simultaneously ensuring
that our implementation will remain correct in the future.

Thanks to Wolfgang for all the help in this regard!

Older Versions
--------------

v1: https://lists.proxmox.com/pipermail/pbs-devel/2024-July/010091.html

References
----------

[1]: https://lwn.net/Articles/864947/

Summary of Changes
------------------

Max Carrara (3):
  rest-server: connection: clean up accept data flow
  rest-server: connection: log peer address on error
  fix #5105: rest-server: connection: overhaul TLS handshake check logic

 proxmox-rest-server/src/connection.rs | 206 ++++++++++++++------------
 1 file changed, 115 insertions(+), 91 deletions(-)

-- 
2.39.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

end of thread, other threads:[~2024-07-09 11:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-08 16:48 [pbs-devel] [PATCH v2 proxmox 0/3] Fix #5105: Overhaul TLS Handshake Checking Logic Max Carrara
2024-07-08 16:48 ` [pbs-devel] [PATCH v2 proxmox 1/3] rest-server: connection: clean up accept data flow Max Carrara
2024-07-08 16:48 ` [pbs-devel] [PATCH v2 proxmox 2/3] rest-server: connection: log peer address on error Max Carrara
2024-07-08 16:48 ` [pbs-devel] [PATCH v2 proxmox 3/3] fix #5105: rest-server: connection: overhaul TLS handshake check logic Max Carrara
2024-07-09 10:29   ` Wolfgang Bumiller
2024-07-09 11:32     ` Max Carrara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal