[PATCH] D35098: [asan] For iOS/AArch64, if the dynamic shadow doesn't fit, restrict the VM space

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 16:08:31 PDT 2017


kubamracek created this revision.
kubamracek added a project: Sanitizers.
Herald added subscribers: kristof.beyls, rengolin, aemerson.

On iOS/AArch64, the address space is very limited and has a dynamic maximum address based on the configuration of the device.  We're already using a dynamic shadow, and we find a large-enough "gap" in the VM where we place the shadow memory.  In some cases and some device configuration, we might not be able to find a large-enough gap:  E.g. if the main executable is linked against a large number of libraries that are not part of the system, these libraries can fragment the address space, and this happens before ASan starts initializing.

This patch has a solution, where we have a "backup plan" when we cannot find a large-enough gap:  We will restrict the address space (via `MmapFixedNoAccess`) to a limit, for which the shadow limit will fit.


Repository:
  rL LLVM

https://reviews.llvm.org/D35098

Files:
  lib/asan/asan_internal.h
  lib/asan/asan_linux.cc
  lib/asan/asan_mac.cc
  lib/asan/asan_rtl.cc
  lib/asan/asan_win.cc
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_linux.cc
  lib/sanitizer_common/sanitizer_mac.cc
  lib/sanitizer_common/sanitizer_win.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35098.105558.patch
Type: text/x-patch
Size: 7113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/88a1ce58/attachment.bin>


More information about the llvm-commits mailing list