[all-commits] [llvm/llvm-project] 2dcbdb: tsan: fix pthread_detach with called_from_lib supp...

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Wed Feb 26 03:59:55 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2dcbdba85406e498b885570c05e9573ddc3e4a81
      https://github.com/llvm/llvm-project/commit/2dcbdba85406e498b885570c05e9573ddc3e4a81
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl.h
    M compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
    A compiler-rt/test/tsan/ignore_lib6.cpp
    A compiler-rt/test/tsan/ignore_lib6.cpp.supp

  Log Message:
  -----------
  tsan: fix pthread_detach with called_from_lib suppressions

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.

Reviewed in https://reviews.llvm.org/D74828




More information about the All-commits mailing list