[compiler-rt] 3fb470f - [scudo] Fix RingBuffer initialization.

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 13:10:33 PST 2023


Author: Luke Nicholson
Date: 2023-01-12T13:10:27-08:00
New Revision: 3fb470fe67cda25fd2ca74162727fd3c38eb0b11

URL: https://github.com/llvm/llvm-project/commit/3fb470fe67cda25fd2ca74162727fd3c38eb0b11
DIFF: https://github.com/llvm/llvm-project/commit/3fb470fe67cda25fd2ca74162727fd3c38eb0b11.diff

LOG: [scudo] Fix RingBuffer initialization.

Several map implementations require that map calls provide a page
aligned size.

Reviewed By: fmayer

Differential Revision: https://reviews.llvm.org/D141630

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/combined.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 85433155e2e2f..ae2aafe6632f4 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -1500,7 +1500,8 @@ class Allocator {
       AllocationRingBufferSize = 1;
     MapPlatformData Data = {};
     RawRingBuffer = static_cast<char *>(
-        map(/*Addr=*/nullptr, ringBufferSizeInBytes(AllocationRingBufferSize),
+        map(/*Addr=*/nullptr,
+            roundUpTo(ringBufferSizeInBytes(AllocationRingBufferSize), getPageSizeCached()),
             "AllocatorRingBuffer", /*Flags=*/0, &Data));
     auto *RingBuffer = reinterpret_cast<AllocationRingBuffer *>(RawRingBuffer);
     RingBuffer->Size = AllocationRingBufferSize;


        


More information about the llvm-commits mailing list