diff --git a/compiler-rt/lib/scudo/standalone/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/CMakeLists.txt --- a/compiler-rt/lib/scudo/standalone/CMakeLists.txt +++ b/compiler-rt/lib/scudo/standalone/CMakeLists.txt @@ -25,7 +25,7 @@ append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SCUDO_CFLAGS) if(COMPILER_RT_DEBUG) - list(APPEND SCUDO_CFLAGS -O0 -DSCUDO_DEBUG=1) + list(APPEND SCUDO_CFLAGS -O0 -DSCUDO_DEBUG=1 -DSCUDO_ENABLE_HOOKS) else() list(APPEND SCUDO_CFLAGS -O3) endif() diff --git a/compiler-rt/lib/scudo/standalone/platform.h b/compiler-rt/lib/scudo/standalone/platform.h --- a/compiler-rt/lib/scudo/standalone/platform.h +++ b/compiler-rt/lib/scudo/standalone/platform.h @@ -73,6 +73,12 @@ #endif #endif +#if SCUDO_FUCHSIA +#ifndef SCUDO_ENABLE_HOOKS +#define SCUDO_ENABLE_HOOKS +#endif +#endif + #ifndef SCUDO_MIN_ALIGNMENT_LOG // We force malloc-type functions to be aligned to std::max_align_t, but there // is no reason why the minimum alignment for all other functions can't be 8 diff --git a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt --- a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt +++ b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt @@ -19,7 +19,7 @@ -Wno-mismatched-new-delete) if(COMPILER_RT_DEBUG) - list(APPEND SCUDO_UNITTEST_CFLAGS -DSCUDO_DEBUG=1) + list(APPEND SCUDO_UNITTEST_CFLAGS -DSCUDO_DEBUG=1 -DSCUDO_ENABLE_HOOKS) endif() if(ANDROID) diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp @@ -37,6 +37,16 @@ #define HAVE_VALLOC 1 #endif +extern "C" { +void malloc_enable(void); +void malloc_disable(void); +int malloc_iterate(uintptr_t base, size_t size, + void (*callback)(uintptr_t base, size_t size, void *arg), + void *arg); +void *valloc(size_t size); +void *pvalloc(size_t size); + +#if defined(SCUDO_ENABLE_HOOKS) struct AllocContext { void *Ptr; size_t Size; @@ -47,15 +57,6 @@ static AllocContext AC; static DeallocContext DC; -extern "C" { -void malloc_enable(void); -void malloc_disable(void); -int malloc_iterate(uintptr_t base, size_t size, - void (*callback)(uintptr_t base, size_t size, void *arg), - void *arg); -void *valloc(size_t size); -void *pvalloc(size_t size); - __attribute__((visibility("default"))) void __scudo_allocate_hook(void *Ptr, size_t Size) { AC.Ptr = Ptr; @@ -64,6 +65,20 @@ __attribute__((visibility("default"))) void __scudo_deallocate_hook(void *Ptr) { DC.Ptr = Ptr; } + +#define INVALIDATE_ALLOC_HOOK_PTR_AS(P) \ + do { \ + AC.Ptr = P; \ + } while (false) +#define VERIFY_ALLOC_HOOK_PTR(P) EXPECT_EQ(P, AC.Ptr) +#define VERIFY_ALLOC_HOOK_SIZE(S) EXPECT_EQ(S, AC.Size) +#define VERIFY_DEALLOC_HOOK_PTR(P) EXPECT_EQ(P, DC.Ptr) +#else +#define INVALIDATE_ALLOC_HOOK_PTR_AS(P) +#define VERIFY_ALLOC_HOOK_PTR(P) +#define VERIFY_ALLOC_HOOK_SIZE(Size) +#define VERIFY_DEALLOC_HOOK_PTR(P) +#endif // defined(SCUDO_ENABLE_HOOKS) } // Note that every C allocation function in the test binary will be fulfilled @@ -83,8 +98,8 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); EXPECT_EQ(reinterpret_cast(P) % FIRST_32_SECOND_64(8U, 16U), 0U); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); // An update to this warning in Clang now triggers in this line, but it's ok // because the check is expecting a bad pointer and should fail. @@ -99,7 +114,7 @@ #endif free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); EXPECT_DEATH(free(P), ""); P = malloc(0U); @@ -115,12 +130,12 @@ void *P = calloc(1U, Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); for (size_t I = 0; I < Size; I++) EXPECT_EQ((reinterpret_cast(P))[I], 0U); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); P = calloc(1U, 0U); EXPECT_NE(P, nullptr); @@ -171,20 +186,20 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); P = nullptr; EXPECT_EQ(posix_memalign(&P, Alignment, Size), 0); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); } EXPECT_EQ(memalign(4096U, SIZE_MAX), nullptr); @@ -196,10 +211,10 @@ for (size_t Alignment = 0U; Alignment <= 128U; Alignment++) { P = memalign(Alignment, 1024U); EXPECT_NE(P, nullptr); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); } } } @@ -210,10 +225,10 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Alignment * 4U, malloc_usable_size(P)); EXPECT_EQ(reinterpret_cast(P) % Alignment, 0U); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Alignment * 4U, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Alignment * 4U); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); errno = 0; P = aligned_alloc(Alignment, Size); @@ -225,23 +240,23 @@ // realloc(nullptr, N) is malloc(N) void *P = realloc(nullptr, Size); EXPECT_NE(P, nullptr); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); P = malloc(Size); EXPECT_NE(P, nullptr); // realloc(P, 0U) is free(P) and returns nullptr EXPECT_EQ(realloc(P, 0U), nullptr); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); P = malloc(Size); EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); memset(P, 0x42, Size); - AC.Ptr = reinterpret_cast(0xdeadbeef); + INVALIDATE_ALLOC_HOOK_PTR_AS(reinterpret_cast(0xdeadbeef)); void *OldP = P; P = realloc(P, Size * 2U); EXPECT_NE(P, nullptr); @@ -249,14 +264,14 @@ for (size_t I = 0; I < Size; I++) EXPECT_EQ(0x42, (reinterpret_cast(P))[I]); if (OldP == P) { - EXPECT_EQ(AC.Ptr, reinterpret_cast(0xdeadbeef)); + VERIFY_ALLOC_HOOK_PTR(reinterpret_cast(0xdeadbeef)); } else { - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size * 2U, AC.Size); - EXPECT_EQ(OldP, DC.Ptr); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size * 2U); + VERIFY_DEALLOC_HOOK_PTR(OldP); } - AC.Ptr = reinterpret_cast(0xdeadbeef); + INVALIDATE_ALLOC_HOOK_PTR_AS(reinterpret_cast(0xdeadbeef)); OldP = P; P = realloc(P, Size / 2U); EXPECT_NE(P, nullptr); @@ -264,10 +279,10 @@ for (size_t I = 0; I < Size / 2U; I++) EXPECT_EQ(0x42, (reinterpret_cast(P))[I]); if (OldP == P) { - EXPECT_EQ(AC.Ptr, reinterpret_cast(0xdeadbeef)); + VERIFY_ALLOC_HOOK_PTR(reinterpret_cast(0xdeadbeef)); } else { - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(Size / 2U, AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(Size / 2U); } free(P); @@ -331,11 +346,11 @@ EXPECT_NE(P, nullptr); EXPECT_EQ(reinterpret_cast(P) & (PageSize - 1), 0U); EXPECT_LE(PageSize, malloc_usable_size(P)); - EXPECT_EQ(P, AC.Ptr); + VERIFY_ALLOC_HOOK_PTR(P); // Size will be rounded up to PageSize. - EXPECT_EQ(PageSize, AC.Size); + VERIFY_ALLOC_HOOK_SIZE(PageSize); free(P); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); EXPECT_EQ(pvalloc(SIZE_MAX), nullptr); diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp @@ -24,6 +24,11 @@ #define SKIP_MISMATCH_TESTS 0 #endif +void operator delete(void *, size_t) noexcept; +void operator delete[](void *, size_t) noexcept; + +extern "C" { +#if defined(SCUDO_ENABLE_HOOKS) struct AllocContext { void *Ptr; size_t Size; @@ -34,10 +39,6 @@ static AllocContext AC; static DeallocContext DC; -void operator delete(void *, size_t) noexcept; -void operator delete[](void *, size_t) noexcept; - -extern "C" { __attribute__((visibility("default"))) void __scudo_allocate_hook(void *Ptr, size_t Size) { AC.Ptr = Ptr; @@ -46,6 +47,19 @@ __attribute__((visibility("default"))) void __scudo_deallocate_hook(void *Ptr) { DC.Ptr = Ptr; } +#define INVALIDATE_ALLOC_HOOK_PTR_AS(P) \ + do { \ + AC.Ptr = P; \ + } while (false) +#define VERIFY_ALLOC_HOOK_PTR(P) EXPECT_EQ(P, AC.Ptr) +#define VERIFY_ALLOC_HOOK_SIZE(S) EXPECT_EQ(S, AC.Size); +#define VERIFY_DEALLOC_HOOK_PTR(P) EXPECT_EQ(P, DC.Ptr) +#else +#define INVALIDATE_ALLOC_HOOK_PTR_AS(Ptr) +#define VERIFY_ALLOC_HOOK_PTR(Ptr) +#define VERIFY_ALLOC_HOOK_SIZE(Size) +#define VERIFY_DEALLOC_HOOK_PTR(Ptr) +#endif // defined(SCUDO_ENABLE_HOOKS) } // Note that every Cxx allocation function in the test binary will be fulfilled // by Scudo. See the comment in the C counterpart of this file. @@ -53,52 +67,52 @@ template static void testCxxNew() { T *P = new T; EXPECT_NE(P, nullptr); - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(sizeof(T), AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(sizeof(T)); memset(P, 0x42, sizeof(T)); EXPECT_DEATH(delete[] P, ""); delete P; - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); EXPECT_DEATH(delete P, ""); P = new T; EXPECT_NE(P, nullptr); memset(P, 0x42, sizeof(T)); operator delete(P, sizeof(T)); - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); P = new (std::nothrow) T; - EXPECT_EQ(P, AC.Ptr); - EXPECT_EQ(sizeof(T), AC.Size); + VERIFY_ALLOC_HOOK_PTR(P); + VERIFY_ALLOC_HOOK_SIZE(sizeof(T)); EXPECT_NE(P, nullptr); memset(P, 0x42, sizeof(T)); delete P; - EXPECT_EQ(P, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(P); const size_t N = 16U; T *A = new T[N]; EXPECT_NE(A, nullptr); - EXPECT_EQ(A, AC.Ptr); - EXPECT_EQ(sizeof(T) * N, AC.Size); + VERIFY_ALLOC_HOOK_PTR(A); + VERIFY_ALLOC_HOOK_SIZE(sizeof(T) * N); memset(A, 0x42, sizeof(T) * N); EXPECT_DEATH(delete A, ""); delete[] A; - EXPECT_EQ(A, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(A); EXPECT_DEATH(delete[] A, ""); A = new T[N]; EXPECT_NE(A, nullptr); memset(A, 0x42, sizeof(T) * N); operator delete[](A, sizeof(T) * N); - EXPECT_EQ(A, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(A); A = new (std::nothrow) T[N]; - EXPECT_EQ(A, AC.Ptr); - EXPECT_EQ(sizeof(T) * N, AC.Size); + VERIFY_ALLOC_HOOK_PTR(A); + VERIFY_ALLOC_HOOK_SIZE(sizeof(T) * N); EXPECT_NE(A, nullptr); memset(A, 0x42, sizeof(T) * N); delete[] A; - EXPECT_EQ(A, DC.Ptr); + VERIFY_DEALLOC_HOOK_PTR(A); } class Pixel { diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp --- a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp +++ b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp @@ -12,6 +12,8 @@ #if !SCUDO_ANDROID || !_BIONIC #include "allocator_config.h" +#include "internal_defs.h" +#include "platform.h" #include "scudo/interface.h" #include "wrappers_c.h" #include "wrappers_c_checks.h" diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c.inc b/compiler-rt/lib/scudo/standalone/wrappers_c.inc --- a/compiler-rt/lib/scudo/standalone/wrappers_c.inc +++ b/compiler-rt/lib/scudo/standalone/wrappers_c.inc @@ -17,16 +17,23 @@ #define SCUDO_MALLOC_ALIGNMENT FIRST_32_SECOND_64(8U, 16U) #endif +#if defined(SCUDO_ENABLE_HOOKS) static void reportAllocation(void *ptr, size_t size) { if (__scudo_allocate_hook && ptr) __scudo_allocate_hook(ptr, size); } - static void reportDeallocation(void *ptr) { if (__scudo_deallocate_hook) __scudo_deallocate_hook(ptr); } +#define REPORT_ALLOC(P, S) reportAllocation(P, S) +#define REPORT_DEALLOC(P) reportDeallocation(P) +#else +#define REPORT_ALLOC(P, S) +#define REPORT_DEALLOC(P) +#endif // defined(SCUDO_ENABLE_HOOKS) + extern "C" { INTERFACE WEAK void *SCUDO_PREFIX(calloc)(size_t nmemb, size_t size) { @@ -40,12 +47,12 @@ } void *Ptr = SCUDO_ALLOCATOR.allocate(Product, scudo::Chunk::Origin::Malloc, SCUDO_MALLOC_ALIGNMENT, true); - reportAllocation(Ptr, Product); + REPORT_ALLOC(Ptr, Product); return scudo::setErrnoOnNull(Ptr); } INTERFACE WEAK void SCUDO_PREFIX(free)(void *ptr) { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); SCUDO_ALLOCATOR.deallocate(ptr, scudo::Chunk::Origin::Malloc); } @@ -90,7 +97,7 @@ INTERFACE WEAK void *SCUDO_PREFIX(malloc)(size_t size) { void *Ptr = SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Malloc, SCUDO_MALLOC_ALIGNMENT); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return scudo::setErrnoOnNull(Ptr); } @@ -122,7 +129,7 @@ } void *Ptr = SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Memalign, alignment); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } @@ -137,7 +144,7 @@ SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Memalign, alignment); if (UNLIKELY(!Ptr)) return ENOMEM; - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); *memptr = Ptr; return 0; @@ -156,7 +163,7 @@ void *Ptr = SCUDO_ALLOCATOR.allocate(size ? scudo::roundUp(size, PageSize) : PageSize, scudo::Chunk::Origin::Memalign, PageSize); - reportAllocation(Ptr, scudo::roundUp(size, PageSize)); + REPORT_ALLOC(Ptr, scudo::roundUp(size, PageSize)); return scudo::setErrnoOnNull(Ptr); } @@ -165,19 +172,19 @@ if (!ptr) { void *Ptr = SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Malloc, SCUDO_MALLOC_ALIGNMENT); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return scudo::setErrnoOnNull(Ptr); } if (size == 0) { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); SCUDO_ALLOCATOR.deallocate(ptr, scudo::Chunk::Origin::Malloc); return nullptr; } void *NewPtr = SCUDO_ALLOCATOR.reallocate(ptr, size, SCUDO_MALLOC_ALIGNMENT); if (NewPtr != ptr) { - reportAllocation(NewPtr, size); - reportDeallocation(ptr); + REPORT_ALLOC(NewPtr, size); + REPORT_DEALLOC(ptr); } return scudo::setErrnoOnNull(NewPtr); @@ -186,7 +193,7 @@ INTERFACE WEAK void *SCUDO_PREFIX(valloc)(size_t size) { void *Ptr = SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Memalign, scudo::getPageSizeCached()); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return scudo::setErrnoOnNull(Ptr); } @@ -272,7 +279,7 @@ void *Ptr = SCUDO_ALLOCATOR.allocate(size, scudo::Chunk::Origin::Malloc, alignment); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return scudo::setErrnoOnNull(Ptr); } diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp --- a/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp +++ b/compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp @@ -12,6 +12,8 @@ #if SCUDO_ANDROID && _BIONIC #include "allocator_config.h" +#include "internal_defs.h" +#include "platform.h" #include "scudo/interface.h" #include "wrappers_c.h" #include "wrappers_c_checks.h" diff --git a/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp b/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp --- a/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp +++ b/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp @@ -12,6 +12,8 @@ #if !SCUDO_ANDROID || !_BIONIC #include "allocator_config.h" +#include "internal_defs.h" +#include "platform.h" #include "scudo/interface.h" #include "wrappers_c.h" @@ -22,124 +24,130 @@ enum class align_val_t : size_t {}; } // namespace std +#if defined(SCUDO_ENABLE_HOOKS) static void reportAllocation(void *ptr, size_t size) { if (__scudo_allocate_hook && ptr) __scudo_allocate_hook(ptr, size); } - static void reportDeallocation(void *ptr) { if (__scudo_deallocate_hook) __scudo_deallocate_hook(ptr); } +#define REPORT_ALLOC(P, S) reportAllocation(P, S) +#define REPORT_DEALLOC(P) reportDeallocation(P) +#else +#define REPORT_ALLOC(P, S) +#define REPORT_DEALLOC(P) +#endif // defined(SCUDO_ENABLE_HOOKS) INTERFACE WEAK void *operator new(size_t size) { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::New); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new[](size_t size) { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::NewArray); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new(size_t size, std::nothrow_t const &) NOEXCEPT { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::New); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new[](size_t size, std::nothrow_t const &) NOEXCEPT { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::NewArray); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new(size_t size, std::align_val_t align) { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::New, static_cast(align)); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new[](size_t size, std::align_val_t align) { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::NewArray, static_cast(align)); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new(size_t size, std::align_val_t align, std::nothrow_t const &) NOEXCEPT { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::New, static_cast(align)); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void *operator new[](size_t size, std::align_val_t align, std::nothrow_t const &) NOEXCEPT { void *Ptr = Allocator.allocate(size, scudo::Chunk::Origin::NewArray, static_cast(align)); - reportAllocation(Ptr, size); + REPORT_ALLOC(Ptr, size); return Ptr; } INTERFACE WEAK void operator delete(void *ptr) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New); } INTERFACE WEAK void operator delete[](void *ptr) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray); } INTERFACE WEAK void operator delete(void *ptr, std::nothrow_t const &) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New); } INTERFACE WEAK void operator delete[](void *ptr, std::nothrow_t const &) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray); } INTERFACE WEAK void operator delete(void *ptr, size_t size) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New, size); } INTERFACE WEAK void operator delete[](void *ptr, size_t size) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray, size); } INTERFACE WEAK void operator delete(void *ptr, std::align_val_t align) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New, 0, static_cast(align)); } INTERFACE WEAK void operator delete[](void *ptr, std::align_val_t align) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray, 0, static_cast(align)); } INTERFACE WEAK void operator delete(void *ptr, std::align_val_t align, std::nothrow_t const &) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New, 0, static_cast(align)); } INTERFACE WEAK void operator delete[](void *ptr, std::align_val_t align, std::nothrow_t const &) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray, 0, static_cast(align)); } INTERFACE WEAK void operator delete(void *ptr, size_t size, std::align_val_t align) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::New, size, static_cast(align)); } INTERFACE WEAK void operator delete[](void *ptr, size_t size, std::align_val_t align) NOEXCEPT { - reportDeallocation(ptr); + REPORT_DEALLOC(ptr); Allocator.deallocate(ptr, scudo::Chunk::Origin::NewArray, size, static_cast(align)); }