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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 10:54:13 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Revision".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL340058: [sanitizer] When setting up shadow memory on iOS, fix handling the return value… (authored by kuba.brecka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50275?vs=159102&id=161290#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50275

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -890,10 +890,10 @@
     (sizeof(__sanitizer_task_vm_info) / sizeof(natural_t)))
 
 uptr GetTaskInfoMaxAddress() {
-  __sanitizer_task_vm_info vm_info = {};
+  __sanitizer_task_vm_info vm_info = {} /* zero initialize */;
   mach_msg_type_number_t count = __SANITIZER_TASK_VM_INFO_COUNT;
   int err = task_info(mach_task_self(), TASK_VM_INFO, (int *)&vm_info, &count);
-  if (err == 0) {
+  if (err == 0 && vm_info.max_address != 0) {
     return vm_info.max_address - 1;
   } else {
     // xnu cannot provide vm address limit


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50275.161290.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180817/5661e425/attachment.bin>


More information about the llvm-commits mailing list