Index: lib/sanitizer_common/sanitizer_allocator.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator.h +++ lib/sanitizer_common/sanitizer_allocator.h @@ -24,6 +24,10 @@ namespace __sanitizer { +// Allows the tools to name their allocations appropriately. +extern const char *PrimaryAllocatorName; +extern const char *SecondaryAllocatorName; + // Since flags are immutable and allocator behavior can be changed at runtime // (unit tests or ASan on Android are some examples), allocator_may_return_null // flag value is cached here and can be altered later. Index: lib/sanitizer_common/sanitizer_allocator.cc =================================================================== --- lib/sanitizer_common/sanitizer_allocator.cc +++ lib/sanitizer_common/sanitizer_allocator.cc @@ -21,6 +21,10 @@ namespace __sanitizer { +// Default allocator names. +const char *PrimaryAllocatorName = "SizeClassAllocator"; +const char *SecondaryAllocatorName = "LargeMmapAllocator"; + // ThreadSanitizer for Go uses libc malloc/free. #if SANITIZER_GO || defined(SANITIZER_USE_MALLOC) # if SANITIZER_LINUX && !SANITIZER_ANDROID Index: lib/sanitizer_common/sanitizer_allocator_primary32.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator_primary32.h +++ lib/sanitizer_common/sanitizer_allocator_primary32.h @@ -125,7 +125,7 @@ } void *MapWithCallback(uptr size) { - void *res = MmapOrDie(size, "SizeClassAllocator32"); + void *res = MmapOrDie(size, PrimaryAllocatorName); MapUnmapCallback().OnMap((uptr)res, size); return res; } @@ -286,7 +286,7 @@ uptr AllocateRegion(AllocatorStats *stat, uptr class_id) { CHECK_LT(class_id, kNumClasses); uptr res = reinterpret_cast(MmapAlignedOrDieOnFatalError( - kRegionSize, kRegionSize, "SizeClassAllocator32")); + kRegionSize, kRegionSize, PrimaryAllocatorName)); if (UNLIKELY(!res)) return 0; MapUnmapCallback().OnMap(res, kRegionSize); Index: lib/sanitizer_common/sanitizer_allocator_primary64.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator_primary64.h +++ lib/sanitizer_common/sanitizer_allocator_primary64.h @@ -72,10 +72,11 @@ void Init(s32 release_to_os_interval_ms) { uptr TotalSpaceSize = kSpaceSize + AdditionalSize(); if (kUsingConstantSpaceBeg) { - CHECK_EQ(kSpaceBeg, address_range.Init(TotalSpaceSize, AllocatorName(), - kSpaceBeg)); + CHECK_EQ(kSpaceBeg, address_range.Init(TotalSpaceSize, + PrimaryAllocatorName, kSpaceBeg)); } else { - NonConstSpaceBeg = address_range.Init(TotalSpaceSize, AllocatorName()); + NonConstSpaceBeg = address_range.Init(TotalSpaceSize, + PrimaryAllocatorName); CHECK_NE(NonConstSpaceBeg, ~(uptr)0); } SetReleaseToOSIntervalMs(release_to_os_interval_ms); @@ -546,7 +547,6 @@ friend class MemoryMapper; ReservedAddressRange address_range; - static const char *AllocatorName() { return "sanitizer_allocator"; } static const uptr kRegionSize = kSpaceSize / kNumClassesRounded; // FreeArray is the array of free-d chunks (stored as 4-byte offsets). Index: lib/sanitizer_common/sanitizer_allocator_secondary.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator_secondary.h +++ lib/sanitizer_common/sanitizer_allocator_secondary.h @@ -34,7 +34,7 @@ public: INLINE void *Init() { uptr p = address_range_.Init(kMaxNumChunks * sizeof(uptr), - "sanitizer_large_allocator"); + SecondaryAllocatorName); CHECK(p); return reinterpret_cast(p); } @@ -94,7 +94,7 @@ return nullptr; } uptr map_beg = reinterpret_cast( - MmapOrDieOnFatalError(map_size, "LargeMmapAllocator")); + MmapOrDieOnFatalError(map_size, SecondaryAllocatorName)); if (!map_beg) return nullptr; CHECK(IsAligned(map_beg, page_size_)); Index: lib/scudo/scudo_allocator.cpp =================================================================== --- lib/scudo/scudo_allocator.cpp +++ lib/scudo/scudo_allocator.cpp @@ -278,6 +278,9 @@ void init() { SanitizerToolName = "Scudo"; + PrimaryAllocatorName = "ScudoPrimary"; + SecondaryAllocatorName = "ScudoSecondary"; + initFlags(); performSanityChecks(); Index: lib/scudo/scudo_allocator_secondary.h =================================================================== --- lib/scudo/scudo_allocator_secondary.h +++ lib/scudo/scudo_allocator_secondary.h @@ -89,7 +89,7 @@ ReservedSize += 2 * PageSize; ReservedAddressRange AddressRange; - uptr ReservedBeg = AddressRange.Init(ReservedSize); + uptr ReservedBeg = AddressRange.Init(ReservedSize, SecondaryAllocatorName); if (UNLIKELY(ReservedBeg == ~static_cast(0))) return ReturnNullOrDieOnFailure::OnOOM(); // A page-aligned pointer is assumed after that, so check it now.