[PATCH] D50275: [sanitizer] When setting up shadow memory on iOS, fix handling the return value of task_info on older OS versions

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 6 06:27:01 PDT 2018


delcypher requested changes to this revision.
delcypher added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:893
 uptr GetTaskInfoMaxAddress() {
   __sanitizer_task_vm_info vm_info = {};
   mach_msg_type_number_t count = __SANITIZER_TASK_VM_INFO_COUNT;
----------------
It looks like you're relying on `task_vm_info` being initialised to zero because presumably on older platforms `task_info(...)` will use a  different `task_vm_info` layout  that probably has less fields.
Given that `task_info` doesn't take the size of `task_vm_info` there's no way it could to set the other fields.

It looks like that's what ` = {};` does but it wasn't immediately obvious to me that this was calling a synthesised constructor that initialized everything to zero.  Could you add a comment about zero initialization?

Other than that LGTM.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D50275





More information about the llvm-commits mailing list