Skip to content
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

[NFC][ASAN] Move ENSURE_ASAN_INITED into AsanInitFromRtl #74170

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

Created using spr 1.3.4
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 2, 2023

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

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/74170.diff

2 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.h (+3-6)
  • (modified) compiler-rt/lib/asan/asan_rtl.cpp (+3-1)
diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h
index e355c1258a9fe12..6a7748c8f9bb92a 100644
--- a/compiler-rt/lib/asan/asan_interceptors.h
+++ b/compiler-rt/lib/asan/asan_interceptors.h
@@ -24,12 +24,9 @@ namespace __asan {
 void InitializeAsanInterceptors();
 void InitializePlatformInterceptors();
 
-#define ENSURE_ASAN_INITED()       \
-  do {                             \
-    CHECK(!AsanInitIsRunning());   \
-    if (UNLIKELY(!AsanInited())) { \
-      AsanInitFromRtl();           \
-    }                              \
+#define ENSURE_ASAN_INITED() \
+  do {                       \
+    AsanInitFromRtl();       \
   } while (0)
 
 }  // namespace __asan
diff --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp
index d8bd19d8b79d4b9..b129e22813dac99 100644
--- a/compiler-rt/lib/asan/asan_rtl.cpp
+++ b/compiler-rt/lib/asan/asan_rtl.cpp
@@ -520,7 +520,9 @@ static void AsanInitInternal() {
 // Initialize as requested from some part of ASan runtime library (interceptors,
 // allocator, etc).
 void AsanInitFromRtl() {
-  AsanInitInternal();
+  CHECK(!AsanInitIsRunning());
+  if (UNLIKELY(!AsanInited()))
+    AsanInitInternal();
 }
 
 #if ASAN_DYNAMIC

@vitalybuka vitalybuka merged commit e893f69 into main Dec 4, 2023
5 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcasan-move-ensure_asan_inited-into-asaninitfromrtl branch December 4, 2023 18:59
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.

None yet

3 participants