Re-enable ART code paths and tests for ASan that were disabled for Valgrind.

Test: SANITIZE_HOST=address ASAN_OPTIONS='detect_leaks=0' make test-art-host
Bug: 29282211
Change-Id: I127a8c11c7d3b778c8d538aec0782a10f042225c
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc
index 9ba1d6c..d53480d 100644
--- a/libartbase/base/mem_map.cc
+++ b/libartbase/base/mem_map.cc
@@ -647,21 +647,11 @@
 }
 
 bool MemMap::Sync() {
-  bool result;
-  if (redzone_size_ != 0) {
-    // To avoid errors when running on a memory tool, temporarily lift the lower-end noaccess
-    // protection before passing it to msync() as it only accepts page-aligned base address,
-    // and exclude the higher-end noaccess protection from the msync range. b/27552451.
-    // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-    // check whether this special case is needed for ASan.
-    uint8_t* base_begin = reinterpret_cast<uint8_t*>(base_begin_);
-    MEMORY_TOOL_MAKE_DEFINED(base_begin, begin_ - base_begin);
-    result = msync(BaseBegin(), End() - base_begin, MS_SYNC) == 0;
-    MEMORY_TOOL_MAKE_NOACCESS(base_begin, begin_ - base_begin);
-  } else {
-    result = msync(BaseBegin(), BaseSize(), MS_SYNC) == 0;
-  }
-  return result;
+  // Historical note: To avoid Valgrind errors, we temporarily lifted the lower-end noaccess
+  // protection before passing it to msync() when `redzone_size_` was non-null, as Valgrind
+  // only accepts page-aligned base address, and excludes the higher-end noaccess protection
+  // from the msync range. b/27552451.
+  return msync(BaseBegin(), BaseSize(), MS_SYNC) == 0;
 }
 
 bool MemMap::Protect(int prot) {
diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc
index 4a78bdc..c575c7a 100644
--- a/libartbase/base/mem_map_test.cc
+++ b/libartbase/base/mem_map_test.cc
@@ -471,9 +471,8 @@
   // cannot allocate in the 2GB-4GB region.
   TEST_DISABLED_FOR_MIPS();
 
-  // This test may not work under Valgrind.
-  // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-  // check whether this test works with ASan.
+  // This test does not work under AddressSanitizer.
+  // Historical note: This test did not work under Valgrind either.
   TEST_DISABLED_FOR_MEMORY_TOOL();
 
   CommonInit();
diff --git a/runtime/exec_utils_test.cc b/runtime/exec_utils_test.cc
index a9c1ea2..c138ce3 100644
--- a/runtime/exec_utils_test.cc
+++ b/runtime/exec_utils_test.cc
@@ -36,12 +36,9 @@
     command.push_back("/usr/bin/id");
   }
   std::string error_msg;
-  if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
-    // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
-    // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-    // check whether the following code works with ASan.
-    EXPECT_TRUE(Exec(command, &error_msg));
-  }
+  // Historical note: Running on Valgrind failed due to some memory
+  // that leaks in thread alternate signal stacks.
+  EXPECT_TRUE(Exec(command, &error_msg));
   EXPECT_EQ(0U, error_msg.size()) << error_msg;
 }
 
@@ -52,13 +49,10 @@
   std::vector<std::string> command;
   command.push_back("bogus");
   std::string error_msg;
-  if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
-    // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
-    // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-    // check whether the following code works with ASan.
-    EXPECT_FALSE(Exec(command, &error_msg));
-    EXPECT_FALSE(error_msg.empty());
-  }
+  // Historical note: Running on Valgrind failed due to some memory
+  // that leaks in thread alternate signal stacks.
+  EXPECT_FALSE(Exec(command, &error_msg));
+  EXPECT_FALSE(error_msg.empty());
 }
 
 TEST_F(ExecUtilsTest, EnvSnapshotAdditionsAreNotVisible) {
@@ -76,13 +70,10 @@
   }
   command.push_back(kModifiedVariable);
   std::string error_msg;
-  if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
-    // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
-    // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-    // check whether the following code works with ASan.
-    EXPECT_FALSE(Exec(command, &error_msg));
-    EXPECT_NE(0U, error_msg.size()) << error_msg;
-  }
+  // Historical note: Running on Valgrind failed due to some memory
+  // that leaks in thread alternate signal stacks.
+  EXPECT_FALSE(Exec(command, &error_msg));
+  EXPECT_NE(0U, error_msg.size()) << error_msg;
 }
 
 TEST_F(ExecUtilsTest, EnvSnapshotDeletionsAreNotVisible) {
@@ -103,13 +94,10 @@
   }
   command.push_back(kDeletedVariable);
   std::string error_msg;
-  if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
-    // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
-    // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-    // check whether the following code works with ASan.
-    EXPECT_TRUE(Exec(command, &error_msg));
-    EXPECT_EQ(0U, error_msg.size()) << error_msg;
-  }
+  // Historical note: Running on Valgrind failed due to some memory
+  // that leaks in thread alternate signal stacks.
+  EXPECT_TRUE(Exec(command, &error_msg));
+  EXPECT_EQ(0U, error_msg.size()) << error_msg;
   // Restore the variable's value.
   EXPECT_EQ(setenv(kDeletedVariable, save_value, kOverwrite), 0);
 }
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index b3a47c3..ce295aa 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -290,11 +290,6 @@
                      void* ucontext_ptr,
                      bool skip_frames) {
   // Historical note: This was disabled when running under Valgrind (b/18119146).
-  // TODO: Valgrind is no longer supported, but Address Sanitizer is:
-  // check whether this test works with ASan.
-  if (kRunningOnMemoryTool) {
-    return;
-  }
 
   BacktraceMap* map = existing_map;
   std::unique_ptr<BacktraceMap> tmp_map;