[compiler-rt] [Sanitizers][Apple] Fix logic bugs that break RestrictMemoryToMaxAddress (PR #124712)
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 11:35:05 PST 2025
================
@@ -1272,10 +1272,11 @@ uptr FindAvailableMemoryRange(uptr size, uptr alignment, uptr left_padding,
mach_msg_type_number_t count = kRegionInfoSize;
kr = mach_vm_region_recurse(mach_task_self(), &address, &vmsize, &depth,
(vm_region_info_t)&vminfo, &count);
- if (kr == KERN_INVALID_ADDRESS) {
+ if (kr == KERN_INVALID_ADDRESS || address > max_vm_address) {
----------------
yln wrote:
Currently, if `mach_vm_region_recurse()` ever returns an error different from `KERN_INVALID_ADDRESS` (I don't think it currently does except if the arguments are wrong, then `KERN_INVALID_ARGUMENT`), then we would still treat the result "successful enough" to update `max_occupied_addr`. Is that the intention?
https://github.com/llvm/llvm-project/pull/124712
More information about the llvm-commits
mailing list