Annotate UnsafeMemcpy for HWASan.
Same as ASan, HWASan does not agree with copying random parts of the
stack.
Bug: 112438058
Test: perfetto_integrationtests on hwasan build of android
Change-Id: Ia321f77eedf75a2c7442beb5771fef9ee0146c34
diff --git a/src/profiling/memory/unwinding_unittest.cc b/src/profiling/memory/unwinding_unittest.cc
index cd4119f..4f18431 100644
--- a/src/profiling/memory/unwinding_unittest.cc
+++ b/src/profiling/memory/unwinding_unittest.cc
@@ -74,7 +74,7 @@
// underrun.
void __attribute__((noinline))
UnsafeMemcpy(void* dst, const void* src, size_t n)
- __attribute__((no_sanitize("address"))) {
+ __attribute__((no_sanitize("address", "hwaddress"))) {
const uint8_t* from = reinterpret_cast<const uint8_t*>(src);
uint8_t* to = reinterpret_cast<uint8_t*>(dst);
for (size_t i = 0; i < n; ++i)
diff --git a/src/profiling/memory/wire_protocol.cc b/src/profiling/memory/wire_protocol.cc
index 8c71fcb..76b72d9 100644
--- a/src/profiling/memory/wire_protocol.cc
+++ b/src/profiling/memory/wire_protocol.cc
@@ -38,7 +38,7 @@
// We need this to prevent crashes due to FORTIFY_SOURCE.
void UnsafeMemcpy(char* dest, const char* src, size_t n)
- __attribute__((no_sanitize("address"))) {
+ __attribute__((no_sanitize("address", "hwaddress"))) {
for (size_t i = 0; i < n; ++i) {
dest[i] = src[i];
}