[compiler-rt] [scudo] Apply filling option when realloc grows a block in-place too (PR #93212)

Fabio D'Urso via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 08:04:57 PDT 2024


================
@@ -565,6 +565,19 @@ class Allocator {
             storeSecondaryAllocationStackMaybe(Options, OldPtr, NewSize);
           }
         }
+
+        // If we've increased the size, fill the extra bytes.
+        if (NewSize > OldSize) {
----------------
fabio-d wrote:

Done. I like this idea too, thanks! I agree that with both allocators the entire block is filled at allocation time (in initChunk for the primary, or in the allocator itself for the secondary [except if it just got fresh known-to-be-zero memory from the OS]) and this change maintains this invariant for the unused portion of each block

https://github.com/llvm/llvm-project/pull/93212


More information about the llvm-commits mailing list