summaryrefslogtreecommitdiff
path: root/lib/scudo
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2016-12-09 03:28:12 +0000
committerKostya Kortchinsky <kostyak@google.com>2016-12-09 03:28:12 +0000
commit2f6cff1b72b413c01b3937d1f3f6b5f674ed929a (patch)
tree9dac082fb62c730111d6e49205755d7b32058113 /lib/scudo
parentd9dff122a9def308f7125d8f94559b52425b34a0 (diff)
Reverting rL289088 while investigating some test issue on the build servers
Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D27605 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo')
-rw-r--r--lib/scudo/scudo_allocator_secondary.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/scudo/scudo_allocator_secondary.h b/lib/scudo/scudo_allocator_secondary.h
index 3b247bfb3..d3468f840 100644
--- a/lib/scudo/scudo_allocator_secondary.h
+++ b/lib/scudo/scudo_allocator_secondary.h
@@ -54,9 +54,8 @@ class ScudoLargeMmapAllocator {
uptr NewMapBeg = UserBeg - HeadersSize;
NewMapBeg = RoundDownTo(NewMapBeg, PageSize) - PageSize;
CHECK_GE(NewMapBeg, MapBeg);
- uptr NewMapEnd =
- RoundUpTo(UserBeg + Size - Alignment - AlignedChunkHeaderSize,
- PageSize) + PageSize;
+ uptr NewMapSize = RoundUpTo(MapSize - Alignment, PageSize);
+ uptr NewMapEnd = NewMapBeg + NewMapSize;
CHECK_LE(NewMapEnd, MapEnd);
// Unmap the extra memory if it's large enough.
uptr Diff = NewMapBeg - MapBeg;
@@ -66,8 +65,8 @@ class ScudoLargeMmapAllocator {
if (Diff > PageSize)
UnmapOrDie(reinterpret_cast<void *>(NewMapEnd), Diff);
MapBeg = NewMapBeg;
+ MapSize = NewMapSize;
MapEnd = NewMapEnd;
- MapSize = NewMapEnd - NewMapBeg;
}
uptr UserEnd = UserBeg - AlignedChunkHeaderSize + Size;
// For larger alignments, Alignment was added by the frontend to Size.