diff options
Diffstat (limited to 'test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc')
-rw-r--r-- | test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc b/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc index ee3d59c72172..fdb68c0cdea5 100644 --- a/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc +++ b/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc @@ -1,11 +1,9 @@ // RUN: %clangxx -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s -// Check __sanitizer_set_death_callback. Not all sanitizers implement it yet. -// XFAIL: lsan -// XFAIL: tsan + +// REQUIRES: stable-runtime #include <sanitizer/common_interface_defs.h> #include <stdio.h> -#include <pthread.h> volatile char *zero = 0; @@ -14,14 +12,9 @@ void Death() { } // CHECK: DEATH CALLBACK EXECUTED -int global[10]; +char global; volatile char *sink; -void *Thread(void *x) { - global[0]++; - return x; -} - __attribute__((noinline)) void MaybeInit(int *uninitialized) { if (zero) @@ -38,12 +31,10 @@ int main(int argc, char **argv) { __sanitizer_set_death_callback(Death); MaybeInit(&uninitialized); if (uninitialized) // trigger msan report. - global[0] = 77; - pthread_t t; - pthread_create(&t, 0, Thread, 0); - global[0]++; // trigger tsan report. - pthread_join(t, 0); - global[argc + 10]++; // trigger asan report. + global = 77; + sink = new char[100]; + delete[] sink; + global = sink[0]; // use-after-free: trigger asan/tsan report. Leak(); sink = 0; } |