!228 bpo-44434: Don't call PyThread_exit_thread() explicitly
From: @ultra_planet Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
e091884edd
@ -0,0 +1,63 @@
|
||||
From 83ad40efc3e299d1e94692d958111a63c2fd6775 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <vstinner@python.org>
|
||||
Date: Mon, 21 Jun 2021 14:22:56 +0200
|
||||
Subject: [PATCH] bpo-44434: Don't call PyThread_exit_thread() explicitly
|
||||
(GH-26758) (GH-26825)
|
||||
|
||||
_thread.start_new_thread() no longer calls PyThread_exit_thread()
|
||||
explicitly at the thread exit, the call was redundant.
|
||||
|
||||
On Linux with the glibc, pthread_cancel() loads dynamically the
|
||||
libgcc_s.so.1 library. dlopen() can fail if there is no more
|
||||
available file descriptor to open the file. In this case, the process
|
||||
aborts with the error message:
|
||||
|
||||
"libgcc_s.so.1 must be installed for pthread_cancel to work"
|
||||
|
||||
pthread_cancel() unwinds back to the thread's wrapping function that
|
||||
calls the thread entry point.
|
||||
|
||||
The unwind function is dynamically loaded from the libgcc_s library
|
||||
since it is tightly coupled to the C compiler (GCC). The unwinder
|
||||
depends on DWARF, the compiler generates DWARF, so the unwinder
|
||||
belongs to the compiler.
|
||||
|
||||
Thanks Florian Weimer and Carlos O'Donell for their help on
|
||||
investigating this issue.
|
||||
|
||||
(cherry picked from commit 45a78f906d2d5fe5381d78466b11763fc56d57ba)
|
||||
---
|
||||
.../next/Library/2021-06-16-16-52-14.bpo-44434.SQS4Pg.rst | 4 ++++
|
||||
Modules/_threadmodule.c | 5 ++++-
|
||||
2 files changed, 8 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Library/2021-06-16-16-52-14.bpo-44434.SQS4Pg.rst
|
||||
|
||||
diff --git a/Misc/NEWS.d/next/Library/2021-06-16-16-52-14.bpo-44434.SQS4Pg.rst b/Misc/NEWS.d/next/Library/2021-06-16-16-52-14.bpo-44434.SQS4Pg.rst
|
||||
new file mode 100644
|
||||
index 0000000000..37b5b57ce6
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Library/2021-06-16-16-52-14.bpo-44434.SQS4Pg.rst
|
||||
@@ -0,0 +1,4 @@
|
||||
+_thread.start_new_thread() no longer calls PyThread_exit_thread() explicitly
|
||||
+at the thread exit, the call was redundant. On Linux with the glibc,
|
||||
+pthread_exit() aborts the whole process if dlopen() fails to open
|
||||
+libgcc_s.so file (ex: EMFILE error). Patch by Victor Stinner.
|
||||
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
|
||||
index 77baba4847..a370352238 100644
|
||||
--- a/Modules/_threadmodule.c
|
||||
+++ b/Modules/_threadmodule.c
|
||||
@@ -1056,7 +1056,10 @@ t_bootstrap(void *boot_raw)
|
||||
tstate->interp->num_threads--;
|
||||
PyThreadState_Clear(tstate);
|
||||
PyThreadState_DeleteCurrent();
|
||||
- PyThread_exit_thread();
|
||||
+
|
||||
+ // bpo-44434: Don't call explicitly PyThread_exit_thread(). On Linux with
|
||||
+ // the glibc, pthread_exit() can abort the whole process if dlopen() fails
|
||||
+ // to open the libgcc_s.so library (ex: EMFILE error).
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
--
|
||||
2.27.0
|
||||
|
||||
10
python3.spec
10
python3.spec
@ -3,7 +3,7 @@ Summary: Interpreter of the Python3 programming language
|
||||
URL: https://www.python.org/
|
||||
|
||||
Version: 3.7.9
|
||||
Release: 31
|
||||
Release: 32
|
||||
License: Python-2.0
|
||||
|
||||
%global branchversion 3.7
|
||||
@ -165,6 +165,7 @@ Patch6055: backport-CVE-2021-28861.patch
|
||||
Patch6056: backport-CVE-2020-10735.patch
|
||||
Patch6057: backport-CVE-2022-45061.patch
|
||||
Patch6058: backport-CVE-2022-37454.patch
|
||||
Patch6059: backport-bpo-44434-Don-t-call-PyThread_exit_thread-explicitly.patch
|
||||
|
||||
patch9000: Don-t-override-PYTHONPATH-which-is-already-set.patch
|
||||
patch9001: add-the-sm3-method-for-obtaining-the-salt-value.patch
|
||||
@ -317,6 +318,7 @@ rm Lib/ensurepip/_bundled/*.whl
|
||||
%patch6056 -p1
|
||||
%patch6057 -p1
|
||||
%patch6058 -p1
|
||||
%patch6059 -p1
|
||||
|
||||
%patch9000 -p1
|
||||
%patch9001 -p1
|
||||
@ -921,6 +923,12 @@ export BEP_GTDLIST="$BEP_GTDLIST_TMP"
|
||||
%{_mandir}/*/*
|
||||
|
||||
%changelog
|
||||
* Sat Dec 17 2022 lingsheng <lingsheng@xfusion.com> - 3.7.9-32
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:bpo-44434: Don't call PyThread_exit_thread() explicitly
|
||||
|
||||
* Thu Dec 15 2022 zhuofeng<zhuofeng2@huawei.com> - 3.7.9-31
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user