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
Differential D100784
[compiler-rt] check max address from kernel is <= mmap range size Authored by aralisza on Apr 19 2021, 12:19 PM.
Details 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
Diff Detail
Event Timeline
Comment Actions LGTM apart from the description. The description probably should mention this is the runtime counterpart to the previous patch that added static checks. We have to do this check at runtime because we get the VM size from the kernel at runtime. | ||||||
Suggestion. Add a variable explicitly document our intent. There's a risk that someone might change the return value but forget to change the runtime check.
if (max_vm != 0) { const uptr ret_value = max_vm - 1; CHECK_LE(ret_value, SANITIZER_MMAP_RANGE_SIZE) return ret_value; }