diff --git a/compiler-rt/lib/scudo/standalone/release.h b/compiler-rt/lib/scudo/standalone/release.h --- a/compiler-rt/lib/scudo/standalone/release.h +++ b/compiler-rt/lib/scudo/standalone/release.h @@ -82,7 +82,7 @@ } else { Buffer = reinterpret_cast( map(nullptr, roundUpTo(BufferSize, getPageSizeCached()), - "scudo:counters", MAP_ALLOWNOMEM)); + "scudo:counters", MAP_ALLOWNOMEM, &Data)); } } ~PackedCounterArray() { @@ -92,7 +92,7 @@ Mutex.unlock(); else unmap(reinterpret_cast(Buffer), - roundUpTo(BufferSize, getPageSizeCached())); + roundUpTo(BufferSize, getPageSizeCached()), 0, &Data); } bool isAllocated() const { return !!Buffer; } @@ -138,6 +138,7 @@ uptr SizePerRegion; uptr BufferSize; uptr *Buffer; + MapPlatformData Data = {}; static HybridMutex Mutex; static uptr StaticBuffer[StaticBufferCount]; diff --git a/compiler-rt/lib/scudo/standalone/vector.h b/compiler-rt/lib/scudo/standalone/vector.h --- a/compiler-rt/lib/scudo/standalone/vector.h +++ b/compiler-rt/lib/scudo/standalone/vector.h @@ -27,7 +27,7 @@ } void destroy() { if (Data != &LocalData[0]) - unmap(Data, CapacityBytes); + unmap(Data, CapacityBytes, 0, &PlatformData); } T &operator[](uptr I) { DCHECK_LT(I, Size); @@ -83,8 +83,8 @@ DCHECK_GT(NewCapacity, 0); DCHECK_LE(Size, NewCapacity); NewCapacity = roundUpTo(NewCapacity * sizeof(T), getPageSizeCached()); - T *NewData = - reinterpret_cast(map(nullptr, NewCapacity, "scudo:vector")); + T *NewData = reinterpret_cast( + map(nullptr, NewCapacity, "scudo:vector", 0, &PlatformData)); memcpy(NewData, Data, Size * sizeof(T)); destroy(); Data = NewData; @@ -92,6 +92,7 @@ } T *Data = nullptr; + MapPlatformData PlatformData = {}; T LocalData[256 / sizeof(T)] = {}; uptr CapacityBytes = 0; uptr Size = 0;