From: AZero13 Date: Thu, 11 Dec 2025 14:30:39 +0000 (-0500) Subject: gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is... X-Git-Tag: v3.15.0a3~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44d3dc64914d5e97708c466c0414ccb2698e38d6;p=thirdparty%2FPython%2Fcpython.git gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is unset (gh-142439) --- diff --git a/Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst b/Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst new file mode 100644 index 000000000000..ec6b3ff09e3a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst @@ -0,0 +1 @@ +Fixed a possible leaked GIL in _PySSL_keylog_callback. diff --git a/Modules/_ssl/debughelpers.c b/Modules/_ssl/debughelpers.c index aee446d0ccb1..866c172e4996 100644 --- a/Modules/_ssl/debughelpers.c +++ b/Modules/_ssl/debughelpers.c @@ -131,7 +131,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line) PyThread_type_lock lock = get_state_sock(ssl_obj)->keylog_lock; assert(lock != NULL); if (ssl_obj->ctx->keylog_bio == NULL) { - return; + goto done; } /* * The lock is neither released on exit nor on fork(). The lock is @@ -155,6 +155,8 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line) ssl_obj->ctx->keylog_filename); ssl_obj->exc = PyErr_GetRaisedException(); } + +done: PyGILState_Release(threadstate); }