Skip to content

Commit

Permalink
Revert "[LSAN] Fix pthread_create interceptor to ignore leaks in real…
Browse files Browse the repository at this point in the history
… pthread_create."

This reverts commit a7db3cb.
  • Loading branch information
kstoimenov committed Feb 8, 2023
1 parent 401dee4 commit 550cb76
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
11 changes: 2 additions & 9 deletions compiler-rt/lib/hwasan/hwasan_interceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 550cb76

Please sign in to comment.