summaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/scudo/standalone/combined.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 006605659bfd..52e2674400fb 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -178,7 +178,7 @@ public:
static_cast<uptr>(getFlags()->quarantine_size_kb << 10),
static_cast<uptr>(getFlags()->thread_local_quarantine_size_kb << 10));
- initRingBuffer();
+ mapAndInitializeRingBuffer();
}
// Initialize the embedded GWP-ASan instance. Requires the main allocator to
@@ -228,6 +228,7 @@ public:
}
void unmapTestOnly() {
+ unmapRingBuffer();
TSDRegistry.unmapTestOnly(this);
Primary.unmapTestOnly();
Secondary.unmapTestOnly();
@@ -1508,17 +1509,16 @@ private:
&RawRingBuffer[sizeof(AllocationRingBuffer)])[N];
}
- void initRingBuffer() {
+ void mapAndInitializeRingBuffer() {
u32 AllocationRingBufferSize =
static_cast<u32>(getFlags()->allocation_ring_buffer_size);
if (AllocationRingBufferSize < 1)
return;
- MapPlatformData Data = {};
RawRingBuffer = static_cast<char *>(
map(/*Addr=*/nullptr,
roundUp(ringBufferSizeInBytes(AllocationRingBufferSize),
getPageSizeCached()),
- "AllocatorRingBuffer", /*Flags=*/0, &Data));
+ "AllocatorRingBuffer"));
auto *RingBuffer = reinterpret_cast<AllocationRingBuffer *>(RawRingBuffer);
RingBuffer->Size = AllocationRingBufferSize;
static_assert(sizeof(AllocationRingBuffer) %
@@ -1527,6 +1527,11 @@ private:
"invalid alignment");
}
+ void unmapRingBuffer() {
+ unmap(RawRingBuffer, roundUp(getRingBufferSize(), getPageSizeCached()));
+ RawRingBuffer = nullptr;
+ }
+
static constexpr size_t ringBufferSizeInBytes(u32 AllocationRingBufferSize) {
return sizeof(AllocationRingBuffer) +
AllocationRingBufferSize *