[PATCH] D43318: [asan] Be more careful and verbose when allocating dynamic shadow memory

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 17:27:15 PST 2018


george.karpenkov added inline comments.


================
Comment at: lib/asan/asan_mac.cc:66
+  uptr max_occupied_vm = 0;
+  VReport(2, "FindDynamicShadowStart, space_size = %p\n", space_size);
+  uptr shadow_start = FindAvailableMemoryRange(
----------------
yay logging yay!


================
Comment at: lib/asan/asan_mac.cc:75
     uptr new_max_vm = RoundDownTo(largest_gap_found << SHADOW_SCALE, alignment);
+    if (new_max_vm < max_occupied_vm) {
+      Report("Unable to find a memory range for dynamic shadow.\n");
----------------
I don't quite understand semantics here.
`max_occupied_vm` to me means "maximal size of occupied virtual memory".
Then why it's a problem if a new maximal size is smaller? Shouldn't it be a problem if it's larger?


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:901
   if (largest_gap_found) *largest_gap_found = 0;
+  if (max_vm_address) *max_vm_address = 0;
   while (kr == KERN_SUCCESS) {
----------------
Is this assignment necessary? Maximum size is zero unless set otherwise?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D43318





More information about the llvm-commits mailing list