[compiler-rt] 18263c3 - [compiler-rt][rtsan] Add scoped reporting lock (#107167)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 16:34:08 PDT 2024


Author: Chris Apple
Date: 2024-09-03T16:34:05-07:00
New Revision: 18263c319092b878f25dd4025830f8e6691245d4

URL: https://github.com/llvm/llvm-project/commit/18263c319092b878f25dd4025830f8e6691245d4
DIFF: https://github.com/llvm/llvm-project/commit/18263c319092b878f25dd4025830f8e6691245d4.diff

LOG: [compiler-rt][rtsan] Add scoped reporting lock (#107167)

Uses a static lock to ensure multiple threads reporting issues at the
same time don't have printing collisions. This isn't so important now,
but will be with continue mode in the future.

Added: 
    

Modified: 
    compiler-rt/lib/rtsan/rtsan_context.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/rtsan/rtsan_context.cpp b/compiler-rt/lib/rtsan/rtsan_context.cpp
index abeaa1e8483493..97f18dfbbcca8e 100644
--- a/compiler-rt/lib/rtsan/rtsan_context.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_context.cpp
@@ -91,6 +91,8 @@ bool __rtsan::Context::IsBypassed() const { return bypass_depth_ > 0; }
 
 void __rtsan::PrintDiagnostics(const char *intercepted_function_name, uptr pc,
                                uptr bp) {
+  ScopedErrorReportLock l;
+
   fprintf(stderr,
           "Real-time violation: intercepted call to real-time unsafe function "
           "`%s` in real-time context! Stack trace:\n",


        


More information about the llvm-commits mailing list