llvm-project/compiler-rt/lib/lsan
Leonard Grey f458d9f6f8 [lsan][darwin] Unmask camouflaged class_rw_t pointers
Detailed motivation here: https://docs.google.com/document/d/1xUNo5ovPKJMYxitiHUQVRxGI3iUmspI51Jm4w8puMwo

check-asan (with LSAN enabled) and check-lsan are currently broken on recent macOS versions, due to pervasive false positives. Whenever the Objective-C runtime realizes a class, it allocates data for it, then stores that data with flags in the low bits. This means LSAN can not recognize it as a pointer while scanning.

This change checks every potential pointer on Apple platforms, and if the high bit is set, attempts to extract a pointer by masking out the high bit and flags. This is ugly, but it's also the best approach I could think of (see doc above); very open to other suggestions.

Differential Revision: https://reviews.llvm.org/D133126
2022-09-02 11:25:22 -04:00
..
.clang-format Revert "sanitizers: increase .clang-format columns to 100" 2021-07-28 09:40:21 +02:00
CMakeLists.txt [compiler-rt] separate lsan, ubsan, stats configuration from SANITIZER_COMMON_SUPPORTED_OS 2021-11-10 19:16:20 -08:00
lsan.cpp [lsan] On Fuchsia, don't use atexit hook for leak checks 2022-03-29 17:13:55 -07:00
lsan.h [lsan] On Fuchsia, don't use atexit hook for leak checks 2022-03-29 17:13:55 -07:00
lsan_allocator.cpp [lsan] malloc_usable_size returns 0 for nullptr 2022-07-02 20:16:30 -07:00
lsan_allocator.h [compiler-rt][lsan] Choose lsan allocator via SANITIZER_CAN_USE_ALLOCATOR64 2022-06-07 17:23:38 -07:00
lsan_common.cpp [lsan][darwin] Unmask camouflaged class_rw_t pointers 2022-09-02 11:25:22 -04:00
lsan_common.h [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files 2022-05-24 12:59:27 -07:00
lsan_common_fuchsia.cpp [lsan] On Fuchsia, don't use atexit hook for leak checks 2022-03-29 17:13:55 -07:00
lsan_common_linux.cpp [NFC][lsan] Refactor LockThreadRegistry/LockAllocator calls 2021-12-06 22:27:11 -08:00
lsan_common_mac.cpp [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files 2022-05-24 12:59:27 -07:00
lsan_flags.inc
lsan_fuchsia.cpp [lsan] On Fuchsia, don't use atexit hook for leak checks 2022-03-29 17:13:55 -07:00
lsan_fuchsia.h [lsan] Use final on Fuchsia ThreadContext declaration 2020-12-02 11:58:03 -08:00
lsan_interceptors.cpp [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files 2022-05-24 12:59:27 -07:00
lsan_linux.cpp
lsan_mac.cpp [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files 2022-05-24 12:59:27 -07:00
lsan_malloc_mac.cpp [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files 2022-05-24 12:59:27 -07:00
lsan_posix.cpp [lsan] On Fuchsia, don't use atexit hook for leak checks 2022-03-29 17:13:55 -07:00
lsan_posix.h [sanitizer] Make destructors protected 2020-11-02 18:00:43 -08:00
lsan_preinit.cpp
lsan_thread.cpp lsan: remove pthread_detach/join interceptors 2021-11-17 14:49:15 +01:00
lsan_thread.h lsan: remove pthread_detach/join interceptors 2021-11-17 14:49:15 +01:00
weak_symbols.txt