diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2018-06-14 14:33:28 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2018-06-14 14:33:28 +0000 |
commit | da4ea31d077aecedb827a404537540b088250bfb (patch) | |
tree | d57eec381aa10b24fa34726aeed2de0cdfbbed72 /lib/scudo | |
parent | aed80b5b51616f3148025a803fb1153281e3bb4b (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.h | 8 |
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; |