[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
GitOrigin-RevId: cebadce0f60f5542a816fff0c559032fd8751a3d
7 files changed