summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evgenii Stepanov <eugenis@google.com> 2015-07-13 10:41:57 -0700
committer Evgenii Stepanov <eugenis@google.com> 2015-07-13 18:02:40 -0700
commit4abf45148c643f2f2ac0e177bd3d394abd9d1945 (patch)
treefe9257aa3dcadca7ddf0ea96e4f0251a43a36cb2
parent0541502e6d9d0efa50aa333db32898a0664512c3 (diff)
Disable ASan on Thread::InstallImplicitProtection.
This function reads random stack locations and confuses ASan. Bug: 21785137 Change-Id: Iaaee6032a651618e5275ab46e6e8f886df60a5d0
-rw-r--r--runtime/base/memory_tool.h2
-rw-r--r--runtime/thread.cc4
2 files changed, 6 insertions, 0 deletions
diff --git a/runtime/base/memory_tool.h b/runtime/base/memory_tool.h
index 36469b8a42..31162a3baa 100644
--- a/runtime/base/memory_tool.h
+++ b/runtime/base/memory_tool.h
@@ -30,6 +30,7 @@
#define MEMORY_TOOL_MAKE_NOACCESS(p, s) __asan_poison_memory_region(p, s)
#define MEMORY_TOOL_MAKE_UNDEFINED(p, s) __asan_unpoison_memory_region(p, s)
#define MEMORY_TOOL_MAKE_DEFINED(p, s) __asan_unpoison_memory_region(p, s)
+#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#define RUNNING_ON_MEMORY_TOOL 1U
constexpr bool kMemoryToolIsValgrind = false;
constexpr bool kMemoryToolDetectsLeaks = true;
@@ -43,6 +44,7 @@ constexpr size_t kMemoryToolStackGuardSizeScale = 2;
#define MEMORY_TOOL_MAKE_NOACCESS(p, s) VALGRIND_MAKE_MEM_NOACCESS(p, s)
#define MEMORY_TOOL_MAKE_UNDEFINED(p, s) VALGRIND_MAKE_MEM_UNDEFINED(p, s)
#define MEMORY_TOOL_MAKE_DEFINED(p, s) VALGRIND_MAKE_MEM_DEFINED(p, s)
+#define ATTRIBUTE_NO_SANITIZE_ADDRESS
#define RUNNING_ON_MEMORY_TOOL RUNNING_ON_VALGRIND
constexpr bool kMemoryToolIsValgrind = true;
constexpr bool kMemoryToolDetectsLeaks = true;
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 7b70be81fa..8de16afe4d 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -358,6 +358,10 @@ uint8_t dont_optimize_this;
// to make sure the pages for the stack are mapped in before we call mprotect. We do
// this by reading every page from the stack bottom (highest address) to the stack top.
// We then madvise this away.
+
+// AddressSanitizer does not like the part of this functions that reads every stack page.
+// Looks a lot like an out-of-bounds access.
+ATTRIBUTE_NO_SANITIZE_ADDRESS
void Thread::InstallImplicitProtection() {
uint8_t* pregion = tlsPtr_.stack_begin - kStackOverflowProtectedSize;
uint8_t* stack_himem = tlsPtr_.stack_end;