Skip to content

Commit

Permalink
[compiler-rt] check max address from kernel is <= mmap range size
Browse files Browse the repository at this point in the history
If these sizes do not match, asan will not work as expected. Previously, we added compile-time checks for non-iOS platforms. We check at run time for iOS because we get the max VM size from the kernel at run time.

rdar://76477969

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D100784
  • Loading branch information
aralisza committed Apr 21, 2021
1 parent 656ebd5 commit 6ae7fc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
Expand Up @@ -1185,7 +1185,9 @@ static uptr GetTaskInfoMaxAddress() {
uptr GetMaxUserVirtualAddress() {
static uptr max_vm = GetTaskInfoMaxAddress();
if (max_vm != 0) {
return max_vm - 1;
const uptr ret_value = max_vm - 1;
CHECK_LE(ret_value, SANITIZER_MMAP_RANGE_SIZE);
return ret_value;
}

// xnu cannot provide vm address limit
Expand Down

0 comments on commit 6ae7fc0

Please sign in to comment.