[compiler-rt] [rtsan] Make sure rtsan gets initialized on mac (PR #100188)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 13:05:23 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Chris Apple (cjappl)
<details>
<summary>Changes</summary>
Intermittently on my mac I was getting the same nullptr crash in dlsym.
We need to make sure rtsan gets initialized on mac between when the binary starts running, and the first intercepted function is called. Until that point we should use the DlsymAllocator.
---
Full diff: https://github.com/llvm/llvm-project/pull/100188.diff
1 Files Affected:
- (modified) compiler-rt/lib/rtsan/rtsan_interceptors.cpp (+3-1)
``````````diff
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 4d5423ec629d2..833062c3de41e 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -39,7 +39,6 @@
using namespace __sanitizer;
-using __rtsan::rtsan_init_is_running;
using __rtsan::rtsan_initialized;
namespace {
@@ -49,6 +48,9 @@ struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {
} // namespace
void ExpectNotRealtime(const char *intercepted_function_name) {
+ if (!rtsan_initialized)
+ __rtsan_init();
+
__rtsan::GetContextForThisThread().ExpectNotRealtime(
intercepted_function_name);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/100188
More information about the llvm-commits
mailing list