From: Dominic Chen Date: Wed, 16 Mar 2022 20:51:08 +0000 (-0700) Subject: [scudo] Don't unmap other low memory pages if mapping doesn't exist X-Git-Tag: upstream/15.0.7~13246 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4787e5c34ec8f710f545e33285b7a121eaf05e54;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h index 6c17855..14784ee 100644 --- a/compiler-rt/lib/scudo/standalone/primary64.h +++ b/compiler-rt/lib/scudo/standalone/primary64.h @@ -89,7 +89,9 @@ public: RegionInfo *Region = getRegionInfo(I); *Region = {}; } - unmap(reinterpret_cast(PrimaryBase), PrimarySize, UNMAP_ALL, &Data); + if (PrimaryBase) + unmap(reinterpret_cast(PrimaryBase), PrimarySize, UNMAP_ALL, + &Data); PrimaryBase = 0U; }