Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so |
| 2 | // RUN: %clangxx_tsan -O1 %s -o %t |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 3 | // RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 4 | |
| 5 | // Tests that unloading of a library matched against called_from_lib suppression |
| 6 | // causes program crash (this is not supported). |
| 7 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 8 | // Some aarch64 kernels do not support non executable write pages |
| 9 | // REQUIRES: stable-runtime |
| 10 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 11 | #ifndef LIB |
| 12 | |
| 13 | #include <dlfcn.h> |
| 14 | #include <stdlib.h> |
| 15 | #include <stdio.h> |
| 16 | #include <errno.h> |
| 17 | #include <libgen.h> |
| 18 | #include <string> |
| 19 | |
| 20 | int main(int argc, char **argv) { |
| 21 | std::string lib = std::string(dirname(argv[0])) + "/libignore_lib3.so"; |
| 22 | void *h = dlopen(lib.c_str(), RTLD_GLOBAL | RTLD_NOW); |
| 23 | dlclose(h); |
| 24 | fprintf(stderr, "OK\n"); |
| 25 | } |
| 26 | |
| 27 | #else // #ifdef LIB |
| 28 | |
| 29 | extern "C" void libfunc() { |
| 30 | } |
| 31 | |
| 32 | #endif // #ifdef LIB |
| 33 | |
| 34 | // CHECK: ThreadSanitizer: library {{.*}} that was matched against called_from_lib suppression 'ignore_lib3.so' is unloaded |
| 35 | // CHECK-NOT: OK |
| 36 | |