diff options
| -rw-r--r-- | compiler-rt/lib/asan/asan_malloc_mac.cc | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/lsan/lsan_malloc_mac.cc | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc | 23 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc | 1 |
4 files changed, 22 insertions, 4 deletions
diff --git a/compiler-rt/lib/asan/asan_malloc_mac.cc b/compiler-rt/lib/asan/asan_malloc_mac.cc index d25b3d5a155..00529624184 100644 --- a/compiler-rt/lib/asan/asan_malloc_mac.cc +++ b/compiler-rt/lib/asan/asan_malloc_mac.cc @@ -57,6 +57,7 @@ using namespace __asan; GET_STACK_TRACE_FREE; \ ReportMacMzReallocUnknown((uptr)ptr, (uptr)zone_ptr, zone_name, &stack); #define COMMON_MALLOC_NAMESPACE __asan +#define COMMON_MALLOC_HAS_ZONE_ENUMERATOR 0 #include "sanitizer_common/sanitizer_malloc_mac.inc" diff --git a/compiler-rt/lib/lsan/lsan_malloc_mac.cc b/compiler-rt/lib/lsan/lsan_malloc_mac.cc index 33d101aa2ae..1d997bac735 100644 --- a/compiler-rt/lib/lsan/lsan_malloc_mac.cc +++ b/compiler-rt/lib/lsan/lsan_malloc_mac.cc @@ -51,6 +51,7 @@ using namespace __lsan; (void)zone_name; \ Report("mz_realloc(%p) -- attempting to realloc unallocated memory.\n", ptr); #define COMMON_MALLOC_NAMESPACE __lsan +#define COMMON_MALLOC_HAS_ZONE_ENUMERATOR 0 #include "sanitizer_common/sanitizer_malloc_mac.inc" diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc b/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc index d3b34caf56b..344daac07ae 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc @@ -280,13 +280,28 @@ void __sanitizer_mz_free_definite_size( } #endif -kern_return_t mi_enumerator(task_t task, void *, - unsigned type_mask, vm_address_t zone_address, - memory_reader_t reader, +#ifndef COMMON_MALLOC_HAS_ZONE_ENUMERATOR +#error "COMMON_MALLOC_HAS_ZONE_ENUMERATOR must be defined" +#endif +static_assert((COMMON_MALLOC_HAS_ZONE_ENUMERATOR) == 0 || + (COMMON_MALLOC_HAS_ZONE_ENUMERATOR) == 1, + "COMMON_MALLOC_HAS_ZONE_ENUMERATOR must be 0 or 1"); + +#if COMMON_MALLOC_HAS_ZONE_ENUMERATOR +// Forward declare and expect the implementation to provided by +// includer. +kern_return_t mi_enumerator(task_t task, void *, unsigned type_mask, + vm_address_t zone_address, memory_reader_t reader, + vm_range_recorder_t recorder); +#else +// Provide stub implementation that fails. +kern_return_t mi_enumerator(task_t task, void *, unsigned type_mask, + vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder) { - // Should enumerate all the pointers we have. Seems like a lot of work. + // Not supported. return KERN_FAILURE; } +#endif size_t mi_good_size(malloc_zone_t *zone, size_t size) { // I think it's always safe to return size, but we maybe could do better. diff --git a/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc b/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc index 869a9615d1c..26bb856ca5c 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc @@ -63,6 +63,7 @@ using namespace __tsan; (void)zone_name; \ Report("mz_realloc(%p) -- attempting to realloc unallocated memory.\n", ptr); #define COMMON_MALLOC_NAMESPACE __tsan +#define COMMON_MALLOC_HAS_ZONE_ENUMERATOR 0 #include "sanitizer_common/sanitizer_malloc_mac.inc" |

