diff options
| author | Kuba Mracek <mracek@apple.com> | 2018-08-17 17:53:14 +0000 |
|---|---|---|
| committer | Kuba Mracek <mracek@apple.com> | 2018-08-17 17:53:14 +0000 |
| commit | 2b93dfe0adeb83c7c025b0d6ac7b44156fa90088 (patch) | |
| tree | 05a4e48afefd5b317ceca94754f4bf26160a4dc0 | |
| parent | 94ff57f5b182e7978dce94d83310ecfac2445abb (diff) | |
| download | bcm5719-llvm-2b93dfe0adeb83c7c025b0d6ac7b44156fa90088.tar.gz bcm5719-llvm-2b93dfe0adeb83c7c025b0d6ac7b44156fa90088.zip | |
[sanitizer] When setting up shadow memory on iOS, fix handling the return value of task_info on older OS versions
task_vm_info is a "revisioned" structure, new OS versions add fields to the end, and compatibility is based on the reported size. On older OS versions, min_address/max_address is not filled back. Let's handle that case. Unfortunately, we can't really write a test (as the failure only happens when on a specific OS version).
Differential Revision: https://reviews.llvm.org/D50275
llvm-svn: 340058
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_mac.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc index 180d7c199ae..48747bc8359 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc @@ -890,10 +890,10 @@ struct __sanitizer_task_vm_info { (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 |

