]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/esan/TestCases/workingset-early-fault.c
1 // Test shadow faults during esan initialization as well as
2 // faults during dlsym's calloc during interceptor init.
4 // RUN: %clang_esan_wset %s -o %t
5 // RUN: %run %t 2>&1 | FileCheck %s
11 // Our goal is to emulate an instrumented allocator, whose calloc
12 // invoked from dlsym will trigger shadow faults, to test an
13 // early shadow fault during esan interceptor init.
14 // We do this by replacing calloc:
15 void *calloc(size_t size
, size_t n
) {
16 // Unfortunately we can't print anything to make the test
17 // ensure we got here b/c the sanitizer interceptors can't
18 // handle that during interceptor init.
20 // Ensure we trigger a shadow write fault:
23 // Now just emulate calloc.
24 void *res
= malloc(size
*n
);
25 memset(res
, 0, size
*n
);
29 int main(int argc
, char **argv
) {