summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-07-06 08:47:48 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-07-06 08:47:48 +0000
commitc2127b907a94e4128d3a812d75a6654ebfc098dc (patch)
tree3e74cd8eb0ba001cceae9943c761015040a4005d
parent9ffcfa5fad25a2d9b161a72dd3cdceab2185a143 (diff)
parent6f1c7517a9e411e4000aa7b13743ed49e0c38bc0 (diff)
Merge "ART: Make Touch's stack array smaller under ASAN"
-rw-r--r--runtime/thread.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 4669e167a2..36ecd3398c 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -573,7 +573,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);