[PATCH] D39989: [asan] Fix macOS FindDynamicShadowStart to consider the last gap in the VM map

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 11:45:24 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT319348: [asan] Fix macOS FindDynamicShadowStart to consider the last gap in the VM map (authored by kuba.brecka).

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D39989

Files:
  lib/sanitizer_common/sanitizer_mac.cc


Index: lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_mac.cc
+++ lib/sanitizer_common/sanitizer_mac.cc
@@ -890,6 +890,11 @@
     mach_msg_type_number_t count = kRegionInfoSize;
     kr = mach_vm_region_recurse(mach_task_self(), &address, &vmsize, &depth,
                                 (vm_region_info_t)&vminfo, &count);
+    if (kr == KERN_INVALID_ADDRESS) {
+      // No more regions beyond "address", consider the gap at the end of VM.
+      address = GetMaxVirtualAddress() + 1;
+      vmsize = 0;
+    }
     if (free_begin != address) {
       // We found a free region [free_begin..address-1].
       uptr gap_start = RoundUpTo((uptr)free_begin + left_padding, alignment);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39989.124795.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171129/dff4cbd4/attachment.bin>


More information about the llvm-commits mailing list