You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for thread sanitizer (TSAN) via --with-thread-sanitizer #112536
GCC and Clang provide ThreadSanitizer, a tool that detects data races. We should add support for thread sanitizer to CPython. Note that Python already supports the memory and address sanitizers.
Add --with-thread-sanitizer as a configure option
Define _Py_THREAD_SANITIZER if thread-sanitizer is enabled (see, e.g., _Py_ADDRESS_SANITIZER in pyport.h)
Move the definition of _Py_NO_SANITIZE_THREAD from obmalloc.c to a place that's more widely available (like pyport.h). We're going to need this in a few places
Eventually, it would be helpful to have a continuous build for the combination of --disable-gil --with-thread-sanitizer. Note that we probably won't want to run all the tests. ThreadSanitizer is slow and also not very useful for single-threaded tests. We should collect a subset of our tests that use threading for the ThreadSanitizer continuous build.
Unfortunately, 3.8 to 3.11 are security-only branches. As such, they would not accept such backports. The 3.11 backport was not merged since it was close to the last bugfix deadline.
Activity
samety commentedon Dec 3, 2023
Hey,
I would like to pick this up.
As a first step tried copying the struct for ASAN to TSAN
Here is a draft PR: #112648
Happy to get some initial feedback on it and then add remaining things like _Py_THREAD_SANITIZER etc.
samety commentedon Dec 17, 2023
Added
--with-thread-sanitizeras a configure option in pr 112648.Still looking for a good way to enable TSAN for the continuous build, I will make another PR when I find one.
gh-112536: Add support for thread sanitizer (TSAN) (gh-112648)
pythongh-112536: Add support for thread sanitizer (TSAN) (pythongh-11…
pythongh-112536: Add support for thread sanitizer (TSAN) (pythongh-11…
pythongh-112536: Set up TSAN CI for free-threading
pythongh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-t…
Revert "pythongh-112536: Define MI_TSAN to 1 for --with-mimalloc and …
gh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-thread-…
pythongh-112536: Add --tsan test for reasonable TSAN execution times.
41 remaining items
pythonGH-112536: Add more TSan tests (python#116911)
pythongh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is en…
gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (#…
pythongh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is en…
[3.12] gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is e…
pythongh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-t…
pythongh-112536: Add --tsan test for reasonable TSAN execution times. (…
pythongh-112536: Add TSAN builds on Github Actions (python#116872)
pythongh-112536: Add test_threading to TSAN tests (python#116898)
pythongh-112536: Add more TSAN tests (python#116896)
pythonGH-112536: Add more TSan tests (python#116911)
pythongh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is en…
comicfans commentedon Aug 27, 2024
hello, possible to backport this to 3.10 too ?
pythongh-112536: Add support for thread sanitizer (TSAN) (pythongh-11…
picnixz commentedon Sep 8, 2024
Unfortunately, 3.8 to 3.11 are security-only branches. As such, they would not accept such backports. The 3.11 backport was not merged since it was close to the last bugfix deadline.