File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
compiler-rt/test/hwasan/TestCases/Posix Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ // Make sure dlerror is not classified as a leak even if we use dynamic TLS.
2+ // RUN: %clangxx_hwasan -O0 %s -o %t && HWASAN_OPTIONS=detect_leaks=1 %run %t
3+ // XFAIL: *
4+
5+ #include < assert.h>
6+ #include < dlfcn.h>
7+ #include < pthread.h>
8+ #include < sanitizer/hwasan_interface.h>
9+ #include < stdlib.h>
10+ #include < string.h>
11+ #include < unistd.h>
12+
13+ constexpr auto kKeys = 100 ;
14+
15+ int main (int argc, char **argv) {
16+ __hwasan_enable_allocator_tagging ();
17+ // Exhaust static TLS slots to force use of dynamic TLS.
18+ pthread_key_t keys[kKeys ];
19+ for (int i = 0 ; i < kKeys ; ++i) {
20+ assert (pthread_key_create (&keys[i], nullptr ) == 0 );
21+ }
22+ void * o = dlopen (" invalid_file_name.so" , 0 );
23+ const char * err = dlerror ();
24+ for (int i = 0 ; i < kKeys ; ++i) {
25+ assert (pthread_key_delete (keys[i]) == 0 );
26+ }
27+ return 0 ;
28+ }
You can’t perform that action at this time.
0 commit comments