[compiler-rt] [scudo] Die when store is called on MapAllocatorNoCache objects. (PR #102403)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 16:32:13 PDT 2024


https://github.com/cferris1000 created https://github.com/llvm/llvm-project/pull/102403

None

>From b1fa3c16c66534c95d097188dff9742814b6c08e Mon Sep 17 00:00:00 2001
From: Christopher Ferris <cferris at google.com>
Date: Wed, 7 Aug 2024 16:30:44 -0700
Subject: [PATCH] [scudo] Die when store is called on MapAllocatorNoCache
 objects.

---
 compiler-rt/lib/scudo/standalone/secondary.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index 51721fab52ced..34b16df75841b 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -95,8 +95,11 @@ template <typename Config> class MapAllocatorNoCache {
     return {};
   }
   void store(UNUSED Options Options, UNUSED uptr CommitBase,
-             UNUSED uptr CommitSize, UNUSED uptr BlockBegin, MemMapT MemMap) {
-    unmap(MemMap);
+             UNUSED uptr CommitSize, UNUSED uptr BlockBegin,
+             UNUSED MemMapT MemMap) {
+    // This should never be called since canCache always returns false.
+    UNREACHABLE(
+        "It is not valid to call store on MapAllocatorNoCache objects.");
   }
 
   bool canCache(UNUSED uptr Size) { return false; }



More information about the llvm-commits mailing list