summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2017-07-27 23:53:54 +0000
committer android-build-merger <android-build-merger@google.com> 2017-07-27 23:53:54 +0000
commit2bd7e3a7f6aea9f3ca535594739c4f0fbfe6bf14 (patch)
tree10df7dace94c6ea2a77905aef76b33b995441fc4
parente599e8251ebbfb4f2f09641ccf0786ff40ef79a8 (diff)
parent7345cba901de2ea16d213c3fcebd56c5b8ded350 (diff)
ART: Make Touch's stack array smaller under ASAN am: 854b3503ab am: d81d7a9b53 am: 098a630a58
am: 7345cba901 Change-Id: I8aa194e184a167fc742dd9ba46767630613fa6ff
-rw-r--r--runtime/thread.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index f6b89bc532..d99452fcd1 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -570,7 +570,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);