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

Initialize sigset in asan_interceptors #69502

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

itf
Copy link
Contributor

@itf itf commented Oct 18, 2023

When compiling for Darwin, sigset is not initialized.

When -Werror,-Wuninitialized-const-reference are enabled we see the error:
asan_interceptors.cpp:260:38: error: variable 'sigset' is uninitialized when passed as a const reference argument here [-Werror,-Wuninitialized-const-reference]

This fixes the error

When compiling for Darwin, sigset is not initialized. 
When -Werror,-Wuninitialized-const-reference are enabled we 
see the error:
asan_interceptors.cpp:260:38: error: variable 'sigset' is uninitialized when passed as a const reference argument here [-Werror,-Wuninitialized-const-reference]
This fixes that error
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2023

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

Author: Ivan Tadeu Ferreira Antunes Filho (itf)

Changes

When compiling for Darwin, sigset is not initialized.

When -Werror,-Wuninitialized-const-reference are enabled we see the error:
asan_interceptors.cpp:260:38: error: variable 'sigset' is uninitialized when passed as a const reference argument here [-Werror,-Wuninitialized-const-reference]

This fixes the error


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

1 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+1-1)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index fc7c5b7b8fbfade..876682c3b6b3a35 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -251,7 +251,7 @@ INTERCEPTOR(int, pthread_create, void *thread, void *attr,
 
   u32 current_tid = GetCurrentTidOrInvalid();
 
-  __sanitizer_sigset_t sigset;
+  __sanitizer_sigset_t sigset = {};
 #    if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
         SANITIZER_SOLARIS
   ScopedBlockSignals block(&sigset);

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.

3 participants