summaryrefslogtreecommitdiff
path: root/lib/scudo
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2018-06-14 14:33:28 +0000
committerKostya Kortchinsky <kostyak@google.com>2018-06-14 14:33:28 +0000
commitda4ea31d077aecedb827a404537540b088250bfb (patch)
treed57eec381aa10b24fa34726aeed2de0cdfbbed72 /lib/scudo
parentaed80b5b51616f3148025a803fb1153281e3bb4b (diff)
[scudo] Make Secondary linker-initialized compliant
Summary: As a follow up to D48142 for Scudo, switch the `SpinMutex` to its static counterpart, and ensure zero-initialization by memset'ing the whole class. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48148 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334716 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo')
-rw-r--r--lib/scudo/scudo_allocator_secondary.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/scudo/scudo_allocator_secondary.h b/lib/scudo/scudo_allocator_secondary.h
index 34ee5cd03..27eb444c5 100644
--- a/lib/scudo/scudo_allocator_secondary.h
+++ b/lib/scudo/scudo_allocator_secondary.h
@@ -69,11 +69,7 @@ namespace LargeChunk {
class ScudoLargeMmapAllocator {
public:
void Init() {
- NumberOfAllocs = 0;
- NumberOfFrees = 0;
- AllocatedBytes = 0;
- FreedBytes = 0;
- LargestSize = 0;
+ internal_memset(this, 0, sizeof(*this));
}
void *Allocate(AllocatorStats *Stats, uptr Size, uptr Alignment) {
@@ -186,7 +182,7 @@ class ScudoLargeMmapAllocator {
static constexpr uptr HeadersSize =
LargeChunk::getHeaderSize() + Chunk::getHeaderSize();
- SpinMutex StatsMutex;
+ StaticSpinMutex StatsMutex;
u32 NumberOfAllocs;
u32 NumberOfFrees;
uptr AllocatedBytes;