[PATCH] D74828: tsan: fix pthread_detach with called_from_lib suppressions

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 05:34:11 PST 2020


dvyukov created this revision.
dvyukov added reviewers: vitalybuka, yln.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Generally we ignore interceptors coming from called_from_lib-suppressed libraries.
However, we must not ignore critical interceptors like e.g. pthread_create,
otherwise runtime will lost track of threads.
pthread_detach is one of these interceptors we should not ignore as it affects
thread states and behavior of pthread_join which we don't ignore as well.
Currently we can produce very obscure false positives. For more context see:
https://groups.google.com/forum/#!topic/thread-sanitizer/ecH2P0QUqPs
The added test captures this pattern.

While we are here rename ThreadTid to ThreadConsumeTid to make it clear that
it's not just a "getter", it resets user_id to 0. This lead to confusion recently.


https://reviews.llvm.org/D74828

Files:
  compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
  compiler-rt/lib/tsan/rtl/tsan_rtl.h
  compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
  compiler-rt/test/tsan/ignore_lib6.cpp
  compiler-rt/test/tsan/ignore_lib6.cpp.supp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74828.245386.patch
Type: text/x-patch
Size: 6788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200219/ed91d3a2/attachment.bin>


More information about the llvm-commits mailing list