base: Teach build system about hwasan and make base_unittests pass under hwasan.

I chose not to make is_hwasan imply ADDRESS_SANITIZER for now because it was unclear
how many of the uses of ADDRESS_SANITIZER are about memory error detection in general
versus being specific to the ASan implementation. Once we have more of the browser
working with hwasan we should revisit this decision.

Bug: 916828
Change-Id: I9e26f7e92ffb1f52623cf36980bc5f38cc18f738
Reviewed-on: https://chromium-review.googlesource.com/c/1455104
Commit-Queue: Peter Collingbourne <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Evgeniy Stepanov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#629435}
diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc
index 8192548..4a4a1e0 100644
--- a/base/debug/proc_maps_linux_unittest.cc
+++ b/base/debug/proc_maps_linux_unittest.cc
@@ -185,13 +185,14 @@
   }
 }
 
-#if defined(ADDRESS_SANITIZER)
 // AddressSanitizer may move local variables to a dedicated "fake stack" which
 // is outside the stack region listed in /proc/self/maps. We disable ASan
 // instrumentation for this function to force the variable to be local.
-__attribute__((no_sanitize_address))
-#endif
-void CheckProcMapsRegions(const std::vector<MappedMemoryRegion> &regions) {
+//
+// Similarly, HWAddressSanitizer may add a tag to all stack pointers which may
+// move it outside of the stack regions in /proc/self/maps.
+__attribute__((no_sanitize("address", "hwaddress"))) void CheckProcMapsRegions(
+    const std::vector<MappedMemoryRegion>& regions) {
   // We should be able to find both the current executable as well as the stack
   // mapped into memory. Use the address of |exe_path| as a way of finding the
   // stack.