Disable hwasan for BitMemoryRegion::LoadBits

It uses different attribute compared to the standard asan.

(cherry picked from commit 0081109c8739ac48a06e47a5e2d5bc18f2ef0ff9)

Bug: 156593692
Test: SANITIZE_TARGET=hwaddress art/tools/run-gtests.sh
Change-Id: I3be85273ee19778751d2bd638f2ee2c32442f0e5
Merged-In: I3be85273ee19778751d2bd638f2ee2c32442f0e5
diff --git a/libartbase/base/bit_memory_region.h b/libartbase/base/bit_memory_region.h
index e98da24..5d54445 100644
--- a/libartbase/base/bit_memory_region.h
+++ b/libartbase/base/bit_memory_region.h
@@ -105,6 +105,7 @@
   // The least significant bit is stored in the smallest memory offset.
   template<typename Result = size_t>
   ATTRIBUTE_NO_SANITIZE_ADDRESS  // We might touch extra bytes due to the alignment.
+  ATTRIBUTE_NO_SANITIZE_HWADDRESS  // The hwasan uses different attribute.
   ALWAYS_INLINE Result LoadBits(size_t bit_offset, size_t bit_length) const {
     static_assert(std::is_integral<Result>::value, "Result must be integral");
     static_assert(std::is_unsigned<Result>::value, "Result must be unsigned");
diff --git a/libartbase/base/memory_tool.h b/libartbase/base/memory_tool.h
index 1a6a9bb..aca1201 100644
--- a/libartbase/base/memory_tool.h
+++ b/libartbase/base/memory_tool.h
@@ -66,6 +66,12 @@
 
 #endif
 
+#if __has_feature(hwaddress_sanitizer)
+# define ATTRIBUTE_NO_SANITIZE_HWADDRESS __attribute__((no_sanitize("hwaddress")))
+#else
+# define ATTRIBUTE_NO_SANITIZE_HWADDRESS
+#endif
+
 }  // namespace art
 
 #endif  // ART_LIBARTBASE_BASE_MEMORY_TOOL_H_