Skip to content

[compiler-rt][rtsan] Add scoped reporting lock #107167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

cjappl
Copy link
Contributor

@cjappl cjappl commented Sep 3, 2024

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.

@cjappl
Copy link
Contributor Author

cjappl commented Sep 3, 2024

CC @davidtrevelyan

@cjappl cjappl merged commit 18263c3 into llvm:main Sep 3, 2024
8 of 9 checks passed
@cjappl cjappl deleted the ScopedReportingLock branch September 3, 2024 23:34
@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

Changes

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 --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",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants