Disable a few bionic tests under HWASan.
* HWASan report invalid use of the allocator api (like alignment not
being power of two, or allocation size too large) in a way tests do not
expect.
* Code in .preinit_array runs before HWASan shadow is initialized and
needs to be excluded from instrumentation.
* It looks that mm system calls (mmap/mprotect/etc) will not allow
tagged pointers. In fact, the use of mprotect on malloc()ed memory is
doubtful - one can imagine some kind of speculative load from such
memory, as compiler knows that it is addressable.
Bug: 114279110
Test: bionic-unit-tests with hwasan
Change-Id: I6ba4b46a0d554de77c923ad134cf156ce4ddba1b
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 2b7b887..5e60a6d 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -26,6 +26,8 @@
#include <procinfo/process_map.h>
+#include "utils.h"
+
extern "C" void malloc_disable();
extern "C" void malloc_enable();
extern "C" int malloc_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t base,
@@ -130,6 +132,7 @@
// Verify that small allocs can be found properly.
TEST(malloc_iterate, small_allocs) {
#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN;
TestDataType test_data;
// Try to cycle through all of the different small bins.
@@ -153,6 +156,7 @@
// Verify that large allocs can be found properly.
TEST(malloc_iterate, large_allocs) {
#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN;
TestDataType test_data;
// Try some larger sizes.
@@ -172,6 +176,7 @@
// non-allocated pointers.
TEST(malloc_iterate, invalid_pointers) {
#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN;
TestDataType test_data = {};
// Find all of the maps that are not [anon:libc_malloc].
@@ -192,6 +197,7 @@
TEST(malloc_iterate, malloc_disable_prevents_allocs) {
#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN;
pid_t pid;
if ((pid = fork()) == 0) {
malloc_disable();