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] Replace AsanInited/ENSURE_ASAN_INITED with TryAsanInitFromRtl #74172

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 2, 2023

@llvm/pr-subscribers-llvm-selectiondag
@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-libc

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

Author: Vitaly Buka (vitalybuka)

Changes

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

1 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+2-4)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index a364b971bda8f32..7f2aecae2e3a52e 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -558,9 +558,8 @@ INTERCEPTOR(char *, strcpy, char *to, const char *from) {
 INTERCEPTOR(char*, strdup, const char *s) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, strdup);
-  if (UNLIKELY(!AsanInited()))
+  if (UNLIKELY(!TryAsanInitFromRtl()))
     return internal_strdup(s);
-  ENSURE_ASAN_INITED();
   uptr length = internal_strlen(s);
   if (flags()->replace_str) {
     ASAN_READ_RANGE(ctx, s, length + 1);
@@ -577,9 +576,8 @@ INTERCEPTOR(char*, strdup, const char *s) {
 INTERCEPTOR(char*, __strdup, const char *s) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, strdup);
-  if (UNLIKELY(!AsanInited()))
+  if (UNLIKELY(!TryAsanInitFromRtl()))
     return internal_strdup(s);
-  ENSURE_ASAN_INITED();
   uptr length = internal_strlen(s);
   if (flags()->replace_str) {
     ASAN_READ_RANGE(ctx, s, length + 1);

Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
Created using spr 1.3.4
@llvmbot llvmbot added the libc label Dec 4, 2023
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
Created using spr 1.3.4
@llvmbot llvmbot added backend:X86 llvm:SelectionDAG SelectionDAGISel as well labels Dec 4, 2023
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.nfcasan-replace-asaninitedensure_asan_inited-with-tryasaninitfromrtl to main December 4, 2023 19:13
Created using spr 1.3.4
@vitalybuka vitalybuka merged commit 7e3aeee into main Dec 4, 2023
2 of 3 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcasan-replace-asaninitedensure_asan_inited-with-tryasaninitfromrtl branch December 4, 2023 22:56
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