[all-commits] [llvm/llvm-project] 92a3a2: sanitizer_common: introduce kInvalidTid/kMainTid

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Fri Apr 30 06:58:29 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 92a3a2dc3eb69ff4f20ec27f68d9923cf3201bf3
      https://github.com/llvm/llvm-project/commit/92a3a2dc3eb69ff4f20ec27f68d9923cf3201bf3
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-04-30 (Fri, 30 Apr 2021)

  Changed paths:
    M compiler-rt/lib/asan/asan_allocator.cpp
    M compiler-rt/lib/asan/asan_descriptions.cpp
    M compiler-rt/lib/asan/asan_thread.cpp
    M compiler-rt/lib/asan/asan_thread.h
    M compiler-rt/lib/lsan/lsan_common.h
    M compiler-rt/lib/lsan/lsan_interceptors.cpp
    M compiler-rt/lib/lsan/lsan_posix.cpp
    M compiler-rt/lib/lsan/lsan_thread.cpp
    M compiler-rt/lib/memprof/memprof_descriptions.cpp
    M compiler-rt/lib/memprof/memprof_thread.cpp
    M compiler-rt/lib/memprof/memprof_thread.h
    M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
    M compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cpp
    M compiler-rt/lib/tsan/rtl/tsan_clock.h
    M compiler-rt/lib/tsan/rtl/tsan_defs.h
    M compiler-rt/lib/tsan/rtl/tsan_report.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl.h
    M compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
    M compiler-rt/lib/tsan/rtl/tsan_sync.h

  Log Message:
  -----------
  sanitizer_common: introduce kInvalidTid/kMainTid

Currently we have a bit of a mess related to tids:
 - sanitizers re-declare kInvalidTid multiple times
 - some call it kUnknownTid
 - implicit assumptions that main tid is 0
 - asan/memprof claim their tids need to fit into 24 bits,
   but this does not seem to be true anymore
 - inconsistent use of u32/int to store tids

Introduce kInvalidTid/kMainTid in sanitizer_common
and use them consistently.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D101428




More information about the All-commits mailing list