[New-bugs-announce] [issue32533] SSLSocket read/write thread-unsafety
Alexey Baldin
report at bugs.python.org
Thu Jan 11 08:41:08 EST 2018
New submission from Alexey Baldin <alexeyb17 at gmail.com>:
_ssl.c has thread-usafe code in implementation of read, write and other methods. E.g. 'write' method:
2099 PySSL_BEGIN_ALLOW_THREADS
2100 len = SSL_write(self->ssl, b->buf, (int)b->len);
2101 _PySSL_UPDATE_ERRNO_IF(len <= 0, self, len);
2102 PySSL_END_ALLOW_THREADS
2103 err = self->ssl_errno;
_PySSL_UPDATE_ERRNO_IF updates self->ssl_errno without lock. Similar code used in 'read' method. Later self->ssl_errno is used for decision on retrying the operation. As result, SSL_write can be incorrectly repeated because ssl_errno was updated by 'read' method to SSL_ERROR_WANT_READ from another thread.
Looks like commit e6eb48c10dc389d1d70657593de6a6cb3087d3d1 is the cause.
----------
assignee: christian.heimes
components: SSL
messages: 309805
nosy: Alexey Baldin, christian.heimes
priority: normal
severity: normal
status: open
title: SSLSocket read/write thread-unsafety
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32533>
_______________________________________
More information about the New-bugs-announce
mailing list