[compiler-rt] 4787e5c - [scudo] Don't unmap other low memory pages if mapping doesn't exist
Dominic Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 10:17:53 PDT 2022
Author: Dominic Chen
Date: 2022-03-17T10:17:36-07:00
New Revision: 4787e5c34ec8f710f545e33285b7a121eaf05e54
URL: https://github.com/llvm/llvm-project/commit/4787e5c34ec8f710f545e33285b7a121eaf05e54
DIFF: https://github.com/llvm/llvm-project/commit/4787e5c34ec8f710f545e33285b7a121eaf05e54.diff
LOG: [scudo] Don't unmap other low memory pages if mapping doesn't exist
Tests can register multiple allocators, but only the first will initialize since it initializes the TSDRegistrySharedT. Then, destruction of subsequent allocator may end up unmapping a nullptr PrimaryBase with non-zero PrimarySize.
Differential Revision: https://reviews.llvm.org/D121858
Added:
Modified:
compiler-rt/lib/scudo/standalone/primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 6c1785512c658..14784ee8f3772 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -89,7 +89,9 @@ template <typename Config> class SizeClassAllocator64 {
RegionInfo *Region = getRegionInfo(I);
*Region = {};
}
- unmap(reinterpret_cast<void *>(PrimaryBase), PrimarySize, UNMAP_ALL, &Data);
+ if (PrimaryBase)
+ unmap(reinterpret_cast<void *>(PrimaryBase), PrimarySize, UNMAP_ALL,
+ &Data);
PrimaryBase = 0U;
}
More information about the llvm-commits
mailing list