diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp --- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp +++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp @@ -40,11 +40,18 @@ INTERCEPTOR(int, pthread_create, void *th, void *attr, void *(*callback)(void*), void * param) { EnsureMainThreadIDIsCorrect(); - ScopedTaggingDisabler disabler; + ScopedTaggingDisabler tagging_disabler; ThreadStartArg *A = reinterpret_cast (MmapOrDie( GetPageSizeCached(), "pthread_create")); *A = {callback, param}; - int res = REAL(pthread_create)(th, attr, &HwasanThreadStartFunc, A); + int res; + { + // ASAN uses the same approach to disable leaks from pthread_create. +# if CAN_SANITIZE_LEAKS + __lsan::ScopedInterceptorDisabler lsan_disabler; +# endif + res = REAL(pthread_create)(th, attr, &HwasanThreadStartFunc, A); + } return res; } diff --git a/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c b/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c --- a/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c +++ b/compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c @@ -2,9 +2,6 @@ // RUN: %clang_lsan %s -o %t // RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0:use_tls=1:use_ld_allocations=0" %run %t -// Fixme: remove once test passes with hwasan -// UNSUPPORTED: hwasan - #include #include #include diff --git a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp --- a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp +++ b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp @@ -2,9 +2,6 @@ // Usage: ./a.out number_of_threads total_number_of_allocations // RUN: %clangxx_lsan %s -o %t // RUN: %env_lsan_opts=use_ld_allocations=0 %run %t 5 1000000 2>&1 - -// Fixme: remove once test passes with hwasan -// UNSUPPORTED: hwasan #include #include #include