[PATCH] D54037: [NFC] Refactor initialisation of Darwin malloc zone fields into separate function called `InitMallocZoneFields()` which is now called from `ReplaceSystemMalloc()`.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 08:23:49 PDT 2018


delcypher created this revision.
delcypher added reviewers: kubamracek, george.karpenkov.
Herald added a subscriber: Sanitizers.

The motivation here is to be able support initialisation of the
malloc zone on other code paths.

rdar://problem/45284065


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54037

Files:
  lib/sanitizer_common/sanitizer_malloc_mac.inc


Index: lib/sanitizer_common/sanitizer_malloc_mac.inc
===================================================================
--- lib/sanitizer_common/sanitizer_malloc_mac.inc
+++ lib/sanitizer_common/sanitizer_malloc_mac.inc
@@ -302,7 +302,7 @@
 
 namespace COMMON_MALLOC_NAMESPACE {
 
-void ReplaceSystemMalloc() {
+void InitMallocZoneFields() {
   static malloc_introspection_t sanitizer_zone_introspection;
   // Ok to use internal_memset, these places are not performance-critical.
   internal_memset(&sanitizer_zone_introspection, 0,
@@ -335,6 +335,10 @@
   sanitizer_zone.free_definite_size = 0;
   sanitizer_zone.memalign = &__sanitizer_mz_memalign;
   sanitizer_zone.introspect = &sanitizer_zone_introspection;
+}
+
+void ReplaceSystemMalloc() {
+  InitMallocZoneFields();
 
   // Register the zone.
   malloc_zone_register(&sanitizer_zone);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54037.172366.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181102/fc6cfc42/attachment.bin>


More information about the llvm-commits mailing list