Repository navigation
Add support for thread sanitizer (TSAN) via --with-thread-sanitizer #112536
Copy link
Copy link
Closed
Labels
3.13only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancement3.13only security fixesonly security fixes
on Nov 29, 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: #112648Happy to get some initial feedback on it and then add remaining things like _Py_THREAD_SANITIZER etc.
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.
- addedbuildThe build process and cross-buildThe build process and cross-build
on Jan 28, 2024 - added 5 commits that reference this issue
on Mar 10, 2024 41 remaining items
- added a commit that references this issue
on Apr 10, 2024 - added 7 commits that reference this issue
on Apr 17, 2024 hello, possible to backport this to 3.10 too ?
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.
Metadata
Metadata
Assignees
Labels
3.13only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
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.
--with-thread-sanitizeras a configure option_Py_THREAD_SANITIZERif thread-sanitizer is enabled (see, e.g.,_Py_ADDRESS_SANITIZERinpyport.h)_Py_NO_SANITIZE_THREADfromobmalloc.cto a place that's more widely available (likepyport.h). We're going to need this in a few placesEventually, 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.Linked PRs
_Py_THREAD_SANITIZERon GCC when TSan is enabled #117702_Py_THREAD_SANITIZERon GCC when TSan is enabled (GH-117702) #117713