-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
My test suite literally started deadlocking when I upgraded to 1.1.1. It's a test where the client does
SSL_do_handshake
→SSL_write
, while the server doesSSL_do_handshake
→SSL_read
, and the transport layer between them has minimal buffering. This is the same communication pattern used by e.g. HTTP/1.1, and it worked fine with previous versions of openssl.The deadlock happens because the server's
SSL_do_handshake
doesn't return until it finishes writing out the session tickets, but by the time the server starts trying to write the tickets, the client'sSSL_do_handshake
has already completed and the client has switched toSSL_write
. Neither write can complete because neither side is reading → deadlock.I could make a standalone reproducer (in Python, say), if that would be helpful, but the problem is very straightforward. As long as the server's
SSL_do_handshake
sends session tickets but the client'sSSL_do_handshake
doesn't read them, you have a deadlock hazard here.
I assume that this is with both sides having blocking sockets. Both sides doing a write and blocking on it is always going to deadlock.
One difference between TLS 1.2 and 1.3 is that in TLS 1.2 the server sends the last message of the handshake, while in TLS 1.3 the client does it. In TLS 1.3 the client can directly start sending after it has sent the finish message, while in TLS 1.2 it needs to wait for finish message from the server.
OpenSSL seems to currently hang in SSL_do_handshake() to sent the session tickets. I guess we could make SSL_do_handshake() return when we received the finish message from the client, but I don't think this solves anything. We would then just have to send them in SSL_read(), and we'd hang in SSL_read() instead of SSL_do_handshake().
I currently don't see how we can support TLS 1.3 with blocking sockets on both the client and the server where the first thing the client wants to do is write and the server wants to send session tickets.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status