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