diff --git a/SOURCES/00362-threading-enumerate-rlock.patch b/SOURCES/00362-threading-enumerate-rlock.patch new file mode 100644 index 0000000..9a8e064 --- /dev/null +++ b/SOURCES/00362-threading-enumerate-rlock.patch @@ -0,0 +1,36 @@ +bpo-44422: Fix threading.enumerate() reentrant call (GH-26727) + +The threading.enumerate() function now uses a reentrant lock to +prevent a hang on reentrant call. + +https://github.com/python/cpython/commit/243fd01047ddce1a7eb0f99a49732d123e942c63 + +Resolves: rhbz#1959459 + +diff --git a/Lib/threading.py b/Lib/threading.py +index 0ab1e46..7ab9ad8 100644 +--- a/Lib/threading.py ++++ b/Lib/threading.py +@@ -727,8 +727,11 @@ _counter() # Consume 0 so first non-main thread has id 1. + def _newname(template="Thread-%d"): + return template % _counter() + +-# Active thread administration +-_active_limbo_lock = _allocate_lock() ++# Active thread administration. ++# ++# bpo-44422: Use a reentrant lock to allow reentrant calls to functions like ++# threading.enumerate(). ++_active_limbo_lock = RLock() + _active = {} # maps thread id to Thread object + _limbo = {} + _dangling = WeakSet() +@@ -1325,7 +1328,7 @@ def _after_fork(): + # Reset _active_limbo_lock, in case we forked while the lock was held + # by another (non-forked) thread. http://bugs.python.org/issue874900 + global _active_limbo_lock, _main_thread +- _active_limbo_lock = _allocate_lock() ++ _active_limbo_lock = RLock() + + # fork() only copied the current thread; clear references to others. + new_active = {} diff --git a/SPECS/python3.spec b/SPECS/python3.spec index 1f4699d..f18cb37 100644 --- a/SPECS/python3.spec +++ b/SPECS/python3.spec @@ -14,7 +14,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.8 -Release: 37%{?dist} +Release: 38%{?dist} License: Python @@ -591,6 +591,13 @@ Patch357: 00357-CVE-2021-3177.patch # Main BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1928904 Patch359: 00359-CVE-2021-23336.patch +# 00362 # +# The threading.enumerate() function now uses a reentrant lock to +# prevent a hang on reentrant call. +# Upstream: https://bugs.python.org/issue44422 +# Main BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1990860 +Patch362: 00362-threading-enumerate-rlock.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -918,6 +925,7 @@ git apply %{PATCH351} %patch356 -p1 %patch357 -p1 %patch359 -p1 +%patch362 -p1 # Remove files that should be generated by the build # (This is after patching, so that we can use patches directly from upstream) @@ -1843,6 +1851,10 @@ fi # ====================================================== %changelog +* Wed Aug 11 2021 Charalampos Stratakis - 3.6.8-38 +- Fix reentrant call to threading.enumerate() +Resolves: rhbz#1990860 + * Thu Mar 04 2021 Petr Viktorin - 3.6.8-37 - Fix for CVE-2021-23336 Resolves: rhbz#1928904