Summary: This interceptor is useful on its own, but the main purpose of this change is to intercept libpthread initialization on linux/glibc in order to run __msan_init before any .preinit_array constructors. We used to trigger on pthread_initialize_minimal -> getrlimit(), but that call has changed to __getrlimit at some point. Reviewers: vitalybuka, pcc Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68168 llvm-svn: 373239
17 lines
309 B
C++
17 lines
309 B
C++
// RUN: %clangxx_msan -O0 %s -o %t && %run %t
|
|
|
|
#include <sanitizer/msan_interface.h>
|
|
|
|
volatile int global;
|
|
static void pre_ctor() {
|
|
volatile int local;
|
|
global = 42;
|
|
local = 42;
|
|
}
|
|
|
|
__attribute__((section(".preinit_array"), used)) void(*__local_pre_ctor)(void) = pre_ctor;
|
|
|
|
int main(void) {
|
|
return 0;
|
|
}
|