[PATCH] D129237: [scudo] Pass MapPlatformData in more calls
Dominic Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 6 15:53:53 PDT 2022
ddcc created this revision.
ddcc added reviewers: eugenis, vitalybuka.
Herald added subscribers: Enna1, cryptoad.
Herald added a project: All.
ddcc requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
Allow platforms to avoid looking up private data by providing private context
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129237
Files:
compiler-rt/lib/scudo/standalone/release.h
compiler-rt/lib/scudo/standalone/vector.h
Index: compiler-rt/lib/scudo/standalone/vector.h
===================================================================
--- compiler-rt/lib/scudo/standalone/vector.h
+++ compiler-rt/lib/scudo/standalone/vector.h
@@ -27,7 +27,7 @@
}
void destroy() {
if (Data != &LocalData[0])
- unmap(Data, CapacityBytes);
+ unmap(Data, CapacityBytes, 0, &Data);
}
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<T *>(map(nullptr, NewCapacity, "scudo:vector"));
+ T *NewData = reinterpret_cast<T *>(
+ map(nullptr, NewCapacity, "scudo:vector", 0, &Data));
memcpy(NewData, Data, Size * sizeof(T));
destroy();
Data = NewData;
@@ -92,6 +92,7 @@
}
T *Data = nullptr;
+ MapPlatformData Data = {};
T LocalData[256 / sizeof(T)] = {};
uptr CapacityBytes = 0;
uptr Size = 0;
Index: compiler-rt/lib/scudo/standalone/release.h
===================================================================
--- compiler-rt/lib/scudo/standalone/release.h
+++ compiler-rt/lib/scudo/standalone/release.h
@@ -82,7 +82,7 @@
} else {
Buffer = reinterpret_cast<uptr *>(
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<void *>(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];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129237.442708.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220706/6c5de178/attachment.bin>
More information about the llvm-commits
mailing list