HWASan fixes for ART tests
Bug: 156593692
Test: SANITIZE_TARGET=hwaddress art/tools/run-gtests.sh
Test: SANITIZE_TARGET=hwaddress art/test.py -r --target --64
Change-Id: I24c5afdb4fed5ac94ce3a7b54a10c592f529191f
diff --git a/runtime/oat_quick_method_header.h b/runtime/oat_quick_method_header.h
index c8ee9b4..9a1133e 100644
--- a/runtime/oat_quick_method_header.h
+++ b/runtime/oat_quick_method_header.h
@@ -114,7 +114,8 @@
}
bool Contains(uintptr_t pc) const {
- uintptr_t code_start = reinterpret_cast<uintptr_t>(code_);
+ // Remove hwasan tag to make comparison below valid. The PC from the stack does not have it.
+ uintptr_t code_start = reinterpret_cast<uintptr_t>(HWASanUntag(code_));
static_assert(kRuntimeISA != InstructionSet::kThumb2, "kThumb2 cannot be a runtime ISA");
if (kRuntimeISA == InstructionSet::kArm) {
// On Thumb-2, the pc is offset by one.