bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957) by tiran · Pull Request #24957 · python/cpython

@tiran tiran changed the title Fix deadlock with SSLContext._msg_callback and sni_callback bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback

Mar 21, 2021

@tiran

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>

@tiran tiran changed the title bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)

Mar 21, 2021

@tiran tiran deleted the bpo-43577-ssl-deadlock branch

March 21, 2021 15:13

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Mar 21, 2021
pythonGH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 77cde50)

Co-authored-by: Christian Heimes <christian@python.org>

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Mar 21, 2021
pythonGH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 77cde50)

Co-authored-by: Christian Heimes <christian@python.org>

miss-islington added a commit that referenced this pull request

Mar 21, 2021
GH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 77cde50)

Co-authored-by: Christian Heimes <christian@python.org>

miss-islington added a commit that referenced this pull request

Mar 21, 2021
GH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 77cde50)

Co-authored-by: Christian Heimes <christian@python.org>