diff options
| -rw-r--r-- | runtime/base/memory_tool.h | 2 | ||||
| -rw-r--r-- | runtime/thread.cc | 4 |
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; |