[compiler-rt] [scudo] Use the releaseAndZeroPagesToOS function. (PR #71256)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 17:03:36 PDT 2023


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

All of the code assumes that when the pages are released, the entry is zero'd, so use the correct function. On most systems, this does not change anything.

>From 2caf85d61ff2f38a2a00f9eae04c72de2a92bd45 Mon Sep 17 00:00:00 2001
From: Christopher Ferris <cferris at google.com>
Date: Fri, 3 Nov 2023 17:02:07 -0700
Subject: [PATCH] [scudo] Use the releaseAndZeroPagesToOS function.

All of the code assumes that when the pages are released, the entry
is zero'd, so use the correct function. On most systems, this does
not change anything.
---
 compiler-rt/lib/scudo/standalone/secondary.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index c89e6a95f5a68a4..8dc4c87fa7c6e99 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -223,7 +223,7 @@ template <typename Config> class MapAllocatorCache {
                                          MAP_NOACCESS);
       }
     } else if (Interval == 0) {
-      Entry.MemMap.releasePagesToOS(Entry.CommitBase, Entry.CommitSize);
+      Entry.MemMap.releaseAndZeroPagesToOS(Entry.CommitBase, Entry.CommitSize);
       Entry.Time = 0;
     }
     do {
@@ -441,7 +441,7 @@ template <typename Config> class MapAllocatorCache {
         OldestTime = Entry.Time;
       return;
     }
-    Entry.MemMap.releasePagesToOS(Entry.CommitBase, Entry.CommitSize);
+    Entry.MemMap.releaseAndZeroPagesToOS(Entry.CommitBase, Entry.CommitSize);
     Entry.Time = 0;
   }
 



More information about the llvm-commits mailing list