[all-commits] [llvm/llvm-project] 7850df: [Sanitizers][Darwin] Fix invalid gap found by Find...
Mariusz Borsa via All-commits
all-commits at lists.llvm.org
Thu Oct 6 12:06:47 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7850df3de01fd3933148b04b5818ff780bb776e1
https://github.com/llvm/llvm-project/commit/7850df3de01fd3933148b04b5818ff780bb776e1
Author: Mariusz Borsa <m_borsa at apple.com>
Date: 2022-10-06 (Thu, 06 Oct 2022)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
Log Message:
-----------
[Sanitizers][Darwin] Fix invalid gap found by FindAvailableMemoryRange
An application running with ASAN can fail during shadow memory allocation, with an error
indicating a failure to map shadow memory region due to negative size parameter passed to mmap.
It turns out that the mach_vm_region_recurse() call can return an address of a module
which is beyond the range of the VM address space available to the iOS process,
i.e. greater than the value returned by GetMaxVirtualAddress(). It leads the FindAvailableMemoryRange function
to the an incorrect conclusion that it has found a suitable gap where the shadow memory can fit in,
while the shadow memory cannot be really allocated in this case.
The fix just takes the maximum VM address into account, causing the function to return 0,
meaning that the VM gap to fit the requested size could not be found.
rdar://66530705
Differential Revision: https://reviews.llvm.org/D134836
More information about the All-commits
mailing list