[compiler-rt] [tsan] Fix deadlock with dyld during symbolization on darwin platforms (PR #113661)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 01:11:53 PST 2024
pudge62 wrote:
@vitalybuka @melver @dvyukov Hi guys, I found my changes introduced another deadlock, because the lock ordering was changed. I have fixed it In the latest update. Here’s the new pattern for reporting an issue:
```c++
ScopedReport rep(typ);
{ // 1. Build the report
ThreadRegistryLock l(&ctx->thread_registry);
rep.AddStack(trace, true);
rep.AddLocation(addr, 1);
}
rep.SymbolizeReport(); // 2. Symbolize the report
OutputReport(thr, rep); // 3. Output the report
```
I removed the `ScopedErrorReportLock` in `ScopedReport` class, which caused the new deadlock before. While symbolizing the report, we don't hold any locks in the runtime, which prevents the deadlock with dyld. The logging process is made atomic by holding the `ctx->report_mtx` lock in the `OutputReport` function.
https://github.com/llvm/llvm-project/pull/113661
More information about the llvm-commits
mailing list