From 2acd1ec12ab6b81a7e870ab11085c24ae51faf6d Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Sat, 16 May 2020 01:38:49 +0100 Subject: 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 --- compiler/common_compiler_test.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/common_compiler_test.cc') diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index 6b4dbed03b..4b6a557455 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -107,7 +107,9 @@ void CommonCompilerTest::MakeExecutable(const void* code_start, size_t code_leng uintptr_t base = RoundDown(data, kPageSize); uintptr_t limit = RoundUp(data + code_length, kPageSize); uintptr_t len = limit - base; - int result = mprotect(reinterpret_cast(base), len, PROT_READ | PROT_WRITE | PROT_EXEC); + // Remove hwasan tag. This is done in kernel in newer versions. This supports older kernels. + void* base_ptr = HWASanUntag(reinterpret_cast(base)); + int result = mprotect(base_ptr, len, PROT_READ | PROT_WRITE | PROT_EXEC); CHECK_EQ(result, 0); CHECK(FlushCpuCaches(reinterpret_cast(base), reinterpret_cast(base + len))); -- cgit v1.2.3-59-g8ed1b