Closed colesbury closed 7 months ago
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: https://github.com/python/cpython/pull/112648
Happy to get some initial feedback on it and then add remaining things like _Py_THREAD_SANITIZER etc.
Added --with-thread-sanitizer
as 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.
Do we want to backport these at some point?
~@pitrou We can go for the default build. I will submit the PR soon~
Ah but the problem is —tsan flag..
If we want to backport the TSAN test, the following PRs should be backported, but this is not a bug or security fix. We may need some discussion.
Right. Perhaps ask on Discourse?
Right. Perhaps ask on Discourse?
Good, do you want to write it? (I can write it but, since you proposed the suggestion first, I am asking)
@pitrou cc @colesbury By the way, once the backport patches are completed, let's close this issue. Expanding TSAN test can be tracked from the new issue. (I prefer to cut off the issues as the checkpoint)
Ok, closing as done now.
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.
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-sanitizer
as a configure option_Py_THREAD_SANITIZER
if thread-sanitizer is enabled (see, e.g.,_Py_ADDRESS_SANITIZER
inpyport.h
)_Py_NO_SANITIZE_THREAD
fromobmalloc.c
to 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