From 0f2fd32a4f86e305b1410c8da0c784c3756bc92d Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Wed, 15 Jul 2015 17:40:14 -0700 Subject: [PATCH] Enable ASan annotations in ART based on macro setting. This is a quick hack to remove ASan annotations from SANITIZE_TARGET build, because they are breaking everything - it looks like we forget to clean redzones from a page before releasing it to the system, and some unrelated code runs into them later. We will add some way to control this from the build system later, or just fix the underlying issue and re-enable by default. Bug: 21785137 Change-Id: If79e2455e246dc39355f2758323b249ac20b6144 --- runtime/base/memory_tool.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/base/memory_tool.h b/runtime/base/memory_tool.h index 31162a3ba..e0bdcfece 100644 --- a/runtime/base/memory_tool.h +++ b/runtime/base/memory_tool.h @@ -27,9 +27,17 @@ #include #define ADDRESS_SANITIZER + +#ifdef ART_ENABLE_ADDRESS_SANITIZER #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) +#else +#define MEMORY_TOOL_MAKE_NOACCESS(p, s) do { (void)(p); (void)(s); } while (0) +#define MEMORY_TOOL_MAKE_UNDEFINED(p, s) do { (void)(p); (void)(s); } while (0) +#define MEMORY_TOOL_MAKE_DEFINED(p, s) do { (void)(p); (void)(s); } while (0) +#endif + #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) #define RUNNING_ON_MEMORY_TOOL 1U constexpr bool kMemoryToolIsValgrind = false; -- 2.11.0