[PATCH] D35098: [asan] For iOS/AArch64, if the dynamic shadow doesn't fit, restrict the VM space

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 14:17:46 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/asan/asan_mac.cc:70
+    // Round down to multiplies of 1 MB.
+    uptr new_max_vm = RoundDownTo(largest_gap_found << SHADOW_SCALE, 0x100000);
+    RestrictMemoryToMaxAddress(new_max_vm);
----------------
Why to 1 MB? Is it a Mac requirement?


================
Comment at: lib/sanitizer_common/sanitizer_common.h:112
+                              uptr *largest_gap_found);
+void RestrictMemoryToMaxAddress(uptr max_address);
 
----------------
Why does it have to be in sanitizer_common.h? There's sanitizer_mac.h


================
Comment at: lib/sanitizer_common/sanitizer_common_nolibc.cc:41
+}
+#endif
+
----------------
I wonder what target fails without this definition?


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:843
+  uptr size_to_mmap = GetMaxVirtualAddress() + 1 - max_address;
+  MmapFixedNoAccess(max_address, size_to_mmap, "high gap");
+}
----------------
Can mmap fail here?


https://reviews.llvm.org/D35098





More information about the llvm-commits mailing list