[compiler-rt] [compiler-rt][rtsan] Add scoped reporting lock (PR #107167)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 16:34:21 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Chris Apple (cjappl)
<details>
<summary>Changes</summary>
>From the `ScopedReportingLock` docstring:
```
// Lock sanitizer error reporting and protects against nested errors.
```
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/107167.diff
1 Files Affected:
- (modified) compiler-rt/lib/rtsan/rtsan_context.cpp (+2)
``````````diff
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",
``````````
</details>
https://github.com/llvm/llvm-project/pull/107167
More information about the llvm-commits
mailing list