diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-03-04 14:28:33 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-03-04 17:15:54 +0100 |
commit | 4a804f87eba3a0e4cc8777a1e76d5f1fb06037c6 (patch) | |
tree | 0c9562c533746065c7392810757cb286714e40a6 /external | |
parent | 92e835dbf00590c9c29509d2995cc7918a9bbb90 (diff) |
external/python3: Avoid "ThreadSanitizer: destroy of a locked mutex"
..when building ExternalProject_python3 with Clang -fsanitize=thread,
> WARNING: ThreadSanitizer: destroy of a locked mutex (pid=973799)
> #0 in AnnotateRWLockDestroy at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp:184:3 (workdir/UnpackedTarball/python3/python +0x498460)
> #1 in recreate_gil at workdir/UnpackedTarball/python3/Python/ceval_gil.h:138:5 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0xe84aa9)
> #2 in _PyEval_ReInitThreads at workdir/UnpackedTarball/python3/Python/ceval.c:350:5 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0xe847c7)
> #3 in PyOS_AfterFork_Child at workdir/UnpackedTarball/python3/./Modules/posixmodule.c:469:5 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x1163dbd)
> #4 in os_fork_impl at workdir/UnpackedTarball/python3/./Modules/posixmodule.c:6253:9 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x11adcad)
> #5 in os_fork at workdir/UnpackedTarball/python3/./Modules/clinic/posixmodule.c.h:2750:12 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x117b481)
> #6 in cfunction_vectorcall_NOARGS at workdir/UnpackedTarball/python3/Objects/methodobject.c:463:24 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x9db7e1)
> #7 in _PyObject_Vectorcall at workdir/UnpackedTarball/python3/./Include/cpython/abstract.h:127:11 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0xf0225e)
> #8 in call_function at workdir/UnpackedTarball/python3/Python/ceval.c:4963:13 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0xef3f4a)
> #9 in _PyEval_EvalFrameDefault at workdir/UnpackedTarball/python3/Python/ceval.c:3469:23 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0xedc5d8)
[...]
> #143 in pymain_run_python at workdir/UnpackedTarball/python3/Modules/main.c:610:21 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x1149f6c)
> #144 in Py_RunMain at workdir/UnpackedTarball/python3/Modules/main.c:689:5 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x11495e9)
> #145 in pymain_main at workdir/UnpackedTarball/python3/Modules/main.c:719:12 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x114a299)
> #146 in Py_BytesMain at workdir/UnpackedTarball/python3/Modules/main.c:743:12 (workdir/UnpackedTarball/python3/libpython3.8d.so.1.0 +0x114a30d)
> #147 in main at workdir/UnpackedTarball/python3/./Programs/python.c:16:12 (workdir/UnpackedTarball/python3/python +0x4d00f8)
Assuming that the GIL is always locked before the fork, better tell TSan about a
fake RELEASED before telling it about a fake DESTROY, to keep TSan's model
consistent.
Change-Id: I6c68d7e415aa0ffc3047e5a5c4c4aca6b0cce8cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130985
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/python3/UnpackedTarball_python3.mk | 1 | ||||
-rw-r--r-- | external/python3/tsan.patch.0 | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk index 31b6a166e6ae..06c64d7d5688 100644 --- a/external/python3/UnpackedTarball_python3.mk +++ b/external/python3/UnpackedTarball_python3.mk @@ -28,6 +28,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\ external/python3/python-3.5.tweak.strip.soabi.patch \ external/python3/darwin.patch.0 \ external/python3/macos-11.patch.0 \ + external/python3/tsan.patch.0 \ )) ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),) diff --git a/external/python3/tsan.patch.0 b/external/python3/tsan.patch.0 new file mode 100644 index 000000000000..d599ec046109 --- /dev/null +++ b/external/python3/tsan.patch.0 @@ -0,0 +1,10 @@ +--- Python/ceval_gil.h ++++ Python/ceval_gil.h +@@ -135,6 +135,7 @@ + + static void recreate_gil(struct _gil_runtime_state *gil) + { ++ _Py_ANNOTATE_RWLOCK_RELEASED(&gil->locked, 1); + _Py_ANNOTATE_RWLOCK_DESTROY(&gil->locked); + /* XXX should we destroy the old OS resources here? */ + create_gil(gil); |