[compiler-rt] [tsan] Fix deadlock with dyld during symbolization on darwin platforms (PR #113661)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 02:27:01 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7aabdb8776eb11b90d43162254db47df46806ec9 6b918e4e2dba8aff75175a70c30312c5eb214349 --extensions h,cpp -- compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp compiler-rt/lib/tsan/rtl/tsan_mman.cpp compiler-rt/lib/tsan/rtl/tsan_report.h compiler-rt/lib/tsan/rtl/tsan_rtl.h compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp compiler-rt/lib/tsan/rtl/tsan_stack_trace.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
index 288d3d6da3d..9ff22831e86 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
@@ -175,18 +175,15 @@ bool ShouldReport(ThreadState *thr, ReportType typ) {
   }
 }
 
-ScopedReportBase::ScopedReportBase() {
-  rep_ = New<ReportDesc>();
-}
+ScopedReportBase::ScopedReportBase() { rep_ = New<ReportDesc>(); }
 
-ScopedReportBase::ScopedReportBase(ReportType typ, uptr tag) : ScopedReportBase() {
+ScopedReportBase::ScopedReportBase(ReportType typ, uptr tag)
+    : ScopedReportBase() {
   rep_->typ = typ;
   rep_->tag = tag;
 }
 
-ScopedReportBase::~ScopedReportBase() {
-  DestroyAndFree(rep_);
-}
+ScopedReportBase::~ScopedReportBase() { DestroyAndFree(rep_); }
 
 void ScopedReportBase::SetKindAndTag(ReportType typ, uptr tag) {
   rep_->typ = typ;
@@ -413,8 +410,7 @@ void ScopedReportBase::SymbolizeReport() {
 
 const ReportDesc *ScopedReportBase::GetReport() const { return rep_; }
 
-ScopedReport::ScopedReport()
-    : ScopedReportBase() {}
+ScopedReport::ScopedReport() : ScopedReportBase() {}
 
 ScopedReport::ScopedReport(ReportType typ, uptr tag)
     : ScopedReportBase(typ, tag) {}
@@ -779,8 +775,9 @@ static bool SpuriousRace(Shadow old) {
   return last.sid() == old.sid() && last.epoch() == old.epoch();
 }
 
-static bool BuildRaceReport(ScopedReport &rep, ThreadState *thr, RawShadow *shadow_mem,
-                     Shadow &cur, Shadow &old, AccessType typ0) {
+static bool BuildRaceReport(ScopedReport &rep, ThreadState *thr,
+                            RawShadow *shadow_mem, Shadow &cur, Shadow &old,
+                            AccessType typ0) {
   uptr addr = ShadowToMem(shadow_mem);
   DPrintf("#%d: ReportRace %p\n", thr->tid, (void *)addr);
   if (!ShouldReport(thr, ReportTypeRace))
diff --git a/compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp b/compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp
index 8dd42006e1f..a4976d656a3 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp
@@ -40,7 +40,8 @@ void VarSizeStackTrace::Init(const uptr *pcs, uptr cnt, uptr extra_top_pc) {
 
 void VarSizeStackTrace::Init(const StackTrace &trace) {
   ResizeBuffer(trace.size);
-  internal_memcpy(trace_buffer, trace.trace, trace.size * sizeof(trace.trace[0]));
+  internal_memcpy(trace_buffer, trace.trace,
+                  trace.size * sizeof(trace.trace[0]));
 }
 
 void VarSizeStackTrace::ReverseOrder() {

``````````

</details>


https://github.com/llvm/llvm-project/pull/113661


More information about the llvm-commits mailing list