[PATCH] D52242: [sanitizer] Destroy and close a range's vmar if all its memory was unmapped

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 13:03:15 PDT 2018


mcgrathr added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_fuchsia.cc:283
+    if (size == size_) {
+      // Unmap the whole mapping by destroying and closing the vmar.
+      _zx_vmar_destroy(vmar);
----------------
This comment is a little ambiguous or misleading.
Destroying the VMAR is what unmaps the whole range.
Closing the VMAR handle just releases a now-useless resource; it has no effect itself on the state of mappings.


================
Comment at: lib/sanitizer_common/sanitizer_fuchsia.cc:290
+    } else {
+      base_ = reinterpret_cast<void*>(addr + size);
+    }
----------------
This seems questionable and at least needs comments.
By moving base_ up you are telling the local bookkeeping that the reservation starts at the new base.
But the actual VMAR still exists and will always cover the full range set at its creation.
So the address space between the old base_ and the new base_ is still reserved, but you've lost track of it.



Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D52242





More information about the llvm-commits mailing list