summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_win.cc
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-11-13 20:38:22 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-11-13 20:38:22 +0000
commit82cd00ab016a2197f9fa26d38fbfdad75af76c31 (patch)
tree3b856bf497142c96229afd50514e9f999447acc7 /lib/sanitizer_common/sanitizer_win.cc
parent496a3c65879fad22aa7a878e657f74cf6422d22c (diff)
[sanitizer] Update scudo to use new API
Summary: The ScudoAllocator uses a SecondaryHeader to keep track of the size and base address of each mmap'd chunk. This aligns well with what the ReservedAddressRange is trying to do. This changeset converts the scudo allocator from using the MmapNoAccess/MmapFixed APIs to the ReservedAddressRange::Init and ::Map APIs. In doing so, it replaces the SecondayHeader struct with the ReservedAddressRange object. This is part 3 of a 4 part changeset; part 1 https://reviews.llvm.org/D39072 and part 2 https://reviews.llvm.org/D38592 Reviewers: alekseyshl, mcgrathr, cryptoad, phosek Reviewed By: cryptoad Subscribers: llvm-commits, cryptoad, kubamracek Differential Revision: https://reviews.llvm.org/D38593 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318080 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_win.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_win.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc
index dee1add82..0d72b494d 100644
--- a/lib/sanitizer_common/sanitizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_win.cc
@@ -255,6 +255,10 @@ void ReservedAddressRange::Unmap(uptr addr, uptr size) {
// Only unmap if it covers the entire range.
CHECK((addr == base_as_uptr) && (size == size_));
UnmapOrDie(addr_as_void, size);
+ if (addr_as_void == base_) {
+ base_ = reinterpret_cast<void*>(addr + size);
+ }
+ size_ = size_ - size;
}
void *MmapFixedOrDieOnFatalError(uptr fixed_addr, uptr size) {