[all-commits] [llvm/llvm-project] cebadc: [TSan] Release locks before OutputReport on all pl...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Sat Oct 3 09:53:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cebadce0f60f5542a816fff0c559032fd8751a3d
      https://github.com/llvm/llvm-project/commit/cebadce0f60f5542a816fff0c559032fd8751a3d
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2026-10-03 (Sat, 03 Oct 2026)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
    M compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
    M compiler-rt/lib/tsan/rtl/tsan_mman.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
    A compiler-rt/test/tsan/signal_abort_on_error.cpp

  Log Message:
  -----------
  [TSan] Release locks before OutputReport on all platforms (#228554)

https://github.com/llvm/llvm-project/pull/151495 moved OutputReport
outside the lock scope (ThreadRegistryLock, slot_lock, slots_lock) on
Apple platforms only.

Holding these locks during OutputReport can also deadlock on non-Apple
platforms. For example, when halt_on_error=1, abort_on_error=1, and
handle_abort=0 are set, OutputReport calls Die() -> Abort(), which
raises SIGABRT and invokes a user signal handler via
CallUserSignalHandler with TSan instrumentation re-enabled. If the
signal handler executes enough instrumented code to overflow the
active TracePart, TraceSwitchPartImpl -> TracePartAlloc attempts to
acquire ctx->slot_mtx and self-deadlocks because slots_lock is still
held by ReportRace.

Remove the SANITIZER_APPLE conditional compilation so locks are
released before OutputReport across all platforms.

Assisted-by: Gemini



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list