[sanitizer-common] Run module msan init before early sigaction test
authorDaniel Thornburgh <dthorn@google.com>
Tue, 18 Jul 2023 21:51:10 +0000 (14:51 -0700)
committerDaniel Thornburgh <dthorn@google.com>
Wed, 19 Jul 2023 17:59:05 +0000 (10:59 -0700)
MSAN wrappers can be inserted for e.g. the access to stderr in the
constructor of the test, which can segfault if the constructor function
runs before these data structures have been initialized.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D155648

compiler-rt/test/ubsan/TestCases/Misc/Linux/sigaction.cpp

index db17b5d..0ab65bd 100644 (file)
@@ -11,7 +11,7 @@
 #include <signal.h>
 #include <stdio.h>
 
-__attribute__((constructor(0))) void ctor() {
+__attribute__((constructor(1))) void ctor() {
   fprintf(stderr, "INIT\n");
   struct sigaction old;
   assert(!sigaction(SIGSEGV, nullptr, &old));