summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-01-11 21:28:03 +0000
committerPete Cooper <peter_cooper@apple.com>2016-01-11 21:28:03 +0000
commitaed368963b20ad9a50b07a84d04b9e6d84148a04 (patch)
treeca1ff8f19cdcba607d103b0183d968c3957c7209
parent9dc82567c98e51017a5374c459dae2943656c442 (diff)
downloadbcm5719-llvm-aed368963b20ad9a50b07a84d04b9e6d84148a04.tar.gz
bcm5719-llvm-aed368963b20ad9a50b07a84d04b9e6d84148a04.zip
BumpPtrAllocator::Reset should also poison the first slab which doesn't get deallocated.
When asan is enabled, we poison slabs as we allocate them, and only unpoison the pieces we need from the slab. However, in Reset, we were failing to reset the state of the slab back to being poisoned. Patch by b17 c0de. llvm-svn: 257388
-rw-r--r--llvm/include/llvm/Support/Allocator.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index c608736fa95..043d8231460 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -187,6 +187,7 @@ public:
/// \brief Deallocate all but the current slab and reset the current pointer
/// to the beginning of it, freeing all memory allocated so far.
void Reset() {
+ // Deallocate all but the first slab, and deallocate all custom-sized slabs.
DeallocateCustomSizedSlabs();
CustomSizedSlabs.clear();
@@ -198,7 +199,7 @@ public:
CurPtr = (char *)Slabs.front();
End = CurPtr + SlabSize;
- // Deallocate all but the first slab, and deallocate all custom-sized slabs.
+ __asan_poison_memory_region(*Slabs.begin(), computeSlabSize(0));
DeallocateSlabs(std::next(Slabs.begin()), Slabs.end());
Slabs.erase(std::next(Slabs.begin()), Slabs.end());
}
OpenPOWER on IntegriCloud