Author Alexey Baldin
Recipients Alexey Baldin, christian.heimes
Date 2018-01-11.13:41:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515678068.63.0.467229070634.issue32533@psf.upfronthosting.co.za>
In-reply-to
Content
_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.
History
Date User Action Args
2018-01-11 13:41:08Alexey Baldinsetrecipients: + Alexey Baldin, christian.heimes
2018-01-11 13:41:08Alexey Baldinsetmessageid: <1515678068.63.0.467229070634.issue32533@psf.upfronthosting.co.za>
2018-01-11 13:41:08Alexey Baldinlinkissue32533 messages
2018-01-11 13:41:08Alexey Baldincreate