diff options
| author | Etienne Bergeron <etienneb@google.com> | 2016-07-07 17:44:08 +0000 |
|---|---|---|
| committer | Etienne Bergeron <etienneb@google.com> | 2016-07-07 17:44:08 +0000 |
| commit | 9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b (patch) | |
| tree | 53d08222c2f1813948f6e16ef204d694ee74ab54 /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | |
| parent | edb38a94f83bf9bf6e6b1c871e81082db43ddef0 (diff) | |
| download | bcm5719-llvm-9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b.tar.gz bcm5719-llvm-9654f2afe3e166bbdd2225eb9d5eb2c9c1b3570b.zip | |
[compiler-rt] Fix sanitizer memory allocator on win64.
Summary:
This patch is fixing unittests for sanitizer memory allocator.
There was two issues:
1) The VirtualAlloc can't reserve twice a memory range.
The memory space used by the SizeClass allocator is reserved
with NoAccess and pages are commited on demand (using MmapFixedOrDie).
2) The address space is allocated using two VirtualAlloc calls. The first one
for the memory space, the second one for the AdditionnalSpace (after).
On windows, they need to be freed separately.
Reviewers: rnk
Subscribers: llvm-commits, wang0109, kubabrecka, chrisha
Differential Revision: http://reviews.llvm.org/D21900
llvm-svn: 274772
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h index 5783c203da8..f0f00200470 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h @@ -323,12 +323,13 @@ class SizeClassAllocator64 { typedef SizeClassAllocatorLocalCache<ThisT> AllocatorCache; void Init() { + uptr TotalSpaceSize = kSpaceSize + AdditionalSize(); if (kUsingConstantSpaceBeg) { CHECK_EQ(kSpaceBeg, reinterpret_cast<uptr>( - MmapFixedNoAccess(kSpaceBeg, kSpaceSize))); + MmapFixedNoAccess(kSpaceBeg, TotalSpaceSize))); } else { NonConstSpaceBeg = - reinterpret_cast<uptr>(MmapNoAccess(kSpaceSize + AdditionalSize())); + reinterpret_cast<uptr>(MmapNoAccess(TotalSpaceSize)); CHECK_NE(NonConstSpaceBeg, ~(uptr)0); } MapWithCallback(SpaceEnd(), AdditionalSize()); |

