[PATCH] D121858: [scudo] Don't unmap other low memory pages if mapping doesn't exist

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 14:15:31 PDT 2022


ddcc created this revision.
ddcc added reviewers: vitalybuka, eugenis, cryptoad, mcgrathr, hctim.
Herald added a project: All.
ddcc requested review of this revision.
Herald added a project: Sanitizers.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121858

Files:
  compiler-rt/lib/scudo/standalone/primary64.h


Index: compiler-rt/lib/scudo/standalone/primary64.h
===================================================================
--- compiler-rt/lib/scudo/standalone/primary64.h
+++ compiler-rt/lib/scudo/standalone/primary64.h
@@ -89,7 +89,8 @@
       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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121858.415983.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/3257138d/attachment.bin>


More information about the llvm-commits mailing list