[PATCH] D48445: [sanitizer] Use "fast mmap" kernel flag for shadow memory on macOS 10.13.4+

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 08:38:29 PDT 2018


delcypher added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:127
+    int fd = VM_MAKE_TAG(VM_MEMORY_SANITIZER);
+    if (use_xnu_fast_mmap) fd |= kXnuFastMmapFd;
+  }
----------------
Thanks for fixing the VM tag issue!


================
Comment at: lib/sanitizer_common/sanitizer_posix_libcdep.cc:337
   uptr PageSize = GetPageSizeCached();
-  uptr p = internal_mmap((void *)(fixed_addr & ~(PageSize - 1)),
-                         RoundUpTo(size, PageSize), PROT_READ | PROT_WRITE,
-                         flags, fd, 0);
+  uptr p = internal_mmap_shadow((void *)(fixed_addr & ~(PageSize - 1)),
+                                RoundUpTo(size, PageSize),
----------------
The name `internal_mmap_shadow(...)` implies that this function is only for use in allocating shadow regions. However the name `MmapFixedNoReserve()` doesn't imply that. However, looking at the uses 
 of `MmapFixedNoReserve()` it looks like they are only used for allocating "shadow" memory currently, so this is probably okay but maybe it should be named `internal_mmap_large()` instead because semantically that's what differentiates it from `internal_mmap()`?


https://reviews.llvm.org/D48445





More information about the llvm-commits mailing list