[all-commits] [llvm/llvm-project] 1146d9: [TSAN] Add __tsan_check_no_mutexes_held helper (#7...

Kenny Yu via All-commits all-commits at lists.llvm.org
Tue Nov 7 23:02:28 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1146d96096022289eea050751a39f76ac3eebcfa
      https://github.com/llvm/llvm-project/commit/1146d96096022289eea050751a39f76ac3eebcfa
  Author: Kenny Yu <kennyyu at meta.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M compiler-rt/include/sanitizer/tsan_interface.h
    M compiler-rt/lib/tsan/rtl/tsan.syms.extra
    M compiler-rt/lib/tsan/rtl/tsan_debugging.cpp
    M compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
    M compiler-rt/lib/tsan/rtl/tsan_report.cpp
    M compiler-rt/lib/tsan/rtl/tsan_report.h
    M compiler-rt/lib/tsan/rtl/tsan_suppressions.cpp
    A compiler-rt/test/tsan/mutex_held_wrong_context.cpp

  Log Message:
  -----------
  [TSAN] Add __tsan_check_no_mutexes_held helper (#71568)

This adds a new helper that can be called from application code to
ensure that no mutexes are held on specific code paths. This is useful
for multiple scenarios, including ensuring no locks are held:

- at thread exit
- in peformance-critical code
- when a coroutine is suspended (can cause deadlocks)

See this discourse thread for more discussion:

https://discourse.llvm.org/t/add-threadsanitizer-check-to-prevent-coroutine-suspending-while-holding-a-lock-potential-deadlock/74051

This resubmits and fixes #69372 (was reverted because of build
breakage).
This also includes the followup change #71471 (to fix a land race).




More information about the All-commits mailing list