Skip to content

Commit 2533bc2

Browse files
committed
Revert "[lsan] Support LeakSanitizer runtime on Fuchsia"
This reverts commit d59e342.
1 parent 57540c9 commit 2533bc2

15 files changed

+20
-417
lines changed

compiler-rt/cmake/config-ix.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ else()
640640
endif()
641641

642642
if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
643-
OS_NAME MATCHES "Darwin|Linux|NetBSD|Fuchsia")
643+
OS_NAME MATCHES "Darwin|Linux|NetBSD")
644644
set(COMPILER_RT_HAS_LSAN TRUE)
645645
else()
646646
set(COMPILER_RT_HAS_LSAN FALSE)

compiler-rt/lib/asan/asan_thread.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,6 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
480480
return true;
481481
}
482482

483-
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
484-
485483
void ForEachExtraStackRange(tid_t os_id, RangeIteratorCallback callback,
486484
void *arg) {
487485
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);

compiler-rt/lib/lsan/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ append_rtti_flag(OFF LSAN_CFLAGS)
55

66
set(LSAN_COMMON_SOURCES
77
lsan_common.cpp
8-
lsan_common_fuchsia.cpp
98
lsan_common_linux.cpp
109
lsan_common_mac.cpp
1110
)
1211

1312
set(LSAN_SOURCES
1413
lsan.cpp
1514
lsan_allocator.cpp
16-
lsan_fuchsia.cpp
1715
lsan_interceptors.cpp
1816
lsan_linux.cpp
1917
lsan_mac.cpp

compiler-rt/lib/lsan/lsan.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "sanitizer_common/sanitizer_flags.h"
1717
#include "sanitizer_common/sanitizer_flag_parser.h"
18+
#include "sanitizer_common/sanitizer_stacktrace.h"
1819
#include "lsan_allocator.h"
1920
#include "lsan_common.h"
2021
#include "lsan_thread.h"
@@ -86,6 +87,17 @@ static void InitializeFlags() {
8687
__sanitizer_set_report_path(common_flags()->log_path);
8788
}
8889

90+
static void OnStackUnwind(const SignalContext &sig, const void *,
91+
BufferedStackTrace *stack) {
92+
stack->Unwind(StackTrace::GetNextInstructionPc(sig.pc), sig.bp, sig.context,
93+
common_flags()->fast_unwind_on_fatal);
94+
}
95+
96+
static void LsanOnDeadlySignal(int signo, void *siginfo, void *context) {
97+
HandleDeadlySignal(siginfo, context, GetCurrentThread(), &OnStackUnwind,
98+
nullptr);
99+
}
100+
89101
extern "C" void __lsan_init() {
90102
CHECK(!lsan_init_is_running);
91103
if (lsan_inited)

compiler-rt/lib/lsan/lsan.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "lsan_thread.h"
1515
#if SANITIZER_POSIX
1616
#include "lsan_posix.h"
17-
#elif SANITIZER_FUCHSIA
18-
#include "lsan_fuchsia.h"
1917
#endif
2018
#include "sanitizer_common/sanitizer_flags.h"
2119
#include "sanitizer_common/sanitizer_stacktrace.h"
@@ -38,7 +36,6 @@ namespace __lsan {
3836

3937
void InitializeInterceptors();
4038
void ReplaceSystemMalloc();
41-
void LsanOnDeadlySignal(int signo, void *siginfo, void *context);
4239

4340
#define ENSURE_LSAN_INITED do { \
4441
CHECK(!lsan_init_is_running); \

compiler-rt/lib/lsan/lsan_allocator.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ template <typename AddressSpaceView>
6666
using PrimaryAllocatorASVT = SizeClassAllocator32<AP32<AddressSpaceView>>;
6767
using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
6868
#elif defined(__x86_64__) || defined(__powerpc64__)
69-
# if SANITIZER_FUCHSIA
70-
const uptr kAllocatorSpace = ~(uptr)0;
71-
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
72-
# elif defined(__powerpc64__)
69+
# if defined(__powerpc64__)
7370
const uptr kAllocatorSpace = 0xa0000000000ULL;
7471
const uptr kAllocatorSize = 0x20000000000ULL; // 2T.
7572
# else

compiler-rt/lib/lsan/lsan_common.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,6 @@ void ForEachExtraStackRangeCb(uptr begin, uptr end, void* arg) {
211211
ScanRangeForPointers(begin, end, frontier, "FAKE STACK", kReachable);
212212
}
213213

214-
#if SANITIZER_FUCHSIA
215-
216-
// Fuchsia handles all threads together with its own callback.
217-
static void ProcessThreads(SuspendedThreadsList const &, Frontier *) {}
218-
219-
#else
220-
221214
// Scans thread data (stacks and TLS) for heap pointers.
222215
static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
223216
Frontier *frontier) {
@@ -315,8 +308,6 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
315308
}
316309
}
317310

318-
#endif // SANITIZER_FUCHSIA
319-
320311
void ScanRootRegion(Frontier *frontier, const RootRegion &root_region,
321312
uptr region_begin, uptr region_end, bool is_readable) {
322313
uptr intersection_begin = Max(root_region.begin, region_begin);
@@ -540,14 +531,6 @@ static void ReportIfNotSuspended(ThreadContextBase *tctx, void *arg) {
540531
}
541532
}
542533

543-
#if SANITIZER_FUCHSIA
544-
545-
// Fuchsia provides a libc interface that guarantees all threads are
546-
// covered, and SuspendedThreadList is never really used.
547-
static void ReportUnsuspendedThreads(const SuspendedThreadsList &) {}
548-
549-
#else // !SANITIZER_FUCHSIA
550-
551534
static void ReportUnsuspendedThreads(
552535
const SuspendedThreadsList &suspended_threads) {
553536
InternalMmapVector<tid_t> threads(suspended_threads.ThreadCount());
@@ -560,8 +543,6 @@ static void ReportUnsuspendedThreads(
560543
&ReportIfNotSuspended, &threads);
561544
}
562545

563-
#endif // !SANITIZER_FUCHSIA
564-
565546
static void CheckForLeaksCallback(const SuspendedThreadsList &suspended_threads,
566547
void *arg) {
567548
CheckForLeaksParam *param = reinterpret_cast<CheckForLeaksParam *>(arg);

compiler-rt/lib/lsan/lsan_common.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#elif defined(__arm__) && \
4141
SANITIZER_LINUX && !SANITIZER_ANDROID
4242
#define CAN_SANITIZE_LEAKS 1
43-
#elif SANITIZER_NETBSD || SANITIZER_FUCHSIA
43+
#elif SANITIZER_NETBSD
4444
#define CAN_SANITIZE_LEAKS 1
4545
#else
4646
#define CAN_SANITIZE_LEAKS 0
@@ -223,7 +223,6 @@ ThreadRegistry *GetThreadRegistryLocked();
223223
bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
224224
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
225225
uptr *cache_end, DTLS **dtls);
226-
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches);
227226
void ForEachExtraStackRange(tid_t os_id, RangeIteratorCallback callback,
228227
void *arg);
229228
// If called from the main thread, updates the main thread's TID in the thread

compiler-rt/lib/lsan/lsan_common_fuchsia.cpp

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)