diff options
| -rw-r--r-- | runtime/thread.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index 7d1c539897..4403f18283 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -285,7 +285,14 @@ void Thread::InstallImplicitProtection() { // Use a large local volatile array to ensure a large frame size. Do not use anything close // to a full page for ASAN. It would be nice to ensure the frame size is at most a page, but // there is no pragma support for this. - volatile char space[kPageSize - 256]; + // Note: for ASAN we need to shrink the array a bit, as there's other overhead. + constexpr size_t kAsanMultiplier = +#ifdef ADDRESS_SANITIZER + 2u; +#else + 1u; +#endif + volatile char space[kPageSize - (kAsanMultiplier * 256)]; char sink __attribute__((__unused__)) = space[zero]; if (reinterpret_cast<uintptr_t>(space) >= target + kPageSize) { Touch(target); |