[compiler-rt] 550cb76 - Revert "[LSAN] Fix pthread_create interceptor to ignore leaks in real pthread_create."

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 13:56:18 PST 2023


Author: Kirill Stoimenov
Date: 2023-02-08T21:55:55Z
New Revision: 550cb763dac4234b5d76bcafdda0471e38be05fa

URL: https://github.com/llvm/llvm-project/commit/550cb763dac4234b5d76bcafdda0471e38be05fa
DIFF: https://github.com/llvm/llvm-project/commit/550cb763dac4234b5d76bcafdda0471e38be05fa.diff

LOG: Revert "[LSAN] Fix pthread_create interceptor to ignore leaks in real pthread_create."

This reverts commit a7db3cb257ff6396481f44427bccd0ca5abf4d63.

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_interceptors.cpp
    compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c
    compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp
    compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index 16ac85eb85894..c1ed2cd60580c 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -40,18 +40,11 @@ static void *HwasanThreadStartFunc(void *arg) {
 INTERCEPTOR(int, pthread_create, void *th, void *attr, void *(*callback)(void*),
             void * param) {
   EnsureMainThreadIDIsCorrect();
-  ScopedTaggingDisabler tagging_disabler;
+  ScopedTaggingDisabler disabler;
   ThreadStartArg *A = reinterpret_cast<ThreadStartArg *> (MmapOrDie(
       GetPageSizeCached(), "pthread_create"));
   *A = {callback, param};
-  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);
-  }
+  int 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
index 6e3a9b349fc4e..a590cfb8b621a 100644
--- 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,6 +2,9 @@
 // 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 <assert.h>
 #include <pthread.h>
 #include <stdio.h>

diff  --git a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp
index e1ee9ce11833a..c3e4c01cbfb14 100644
--- a/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp
+++ b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp
@@ -2,6 +2,9 @@
 // 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 <assert.h>
 #include <pthread.h>
 #include <stdlib.h>

diff  --git a/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cpp b/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cpp
index 04f23878ca009..68eea93a81e57 100644
--- a/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cpp
+++ b/compiler-rt/test/lsan/TestCases/leak_check_before_thread_started.cpp
@@ -3,6 +3,9 @@
 // RUN: %clangxx_lsan %s -o %t
 // RUN: %env_lsan_opts="log_pointers=1:log_threads=1" %run %t
 
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
 #include <assert.h>
 #include <pthread.h>
 #include <stdio.h>


        


More information about the llvm-commits mailing list