summaryrefslogtreecommitdiff
path: root/tests/malloc_iterate_test.cpp
diff options
context:
space:
mode:
authorEvgenii Stepanov <eugenis@google.com>2018-11-06 16:48:27 -0800
committerEvgenii Stepanov <eugenis@google.com>2018-11-06 16:59:25 -0800
commitacd6f4f9f5d248345231542df91947b44a309c26 (patch)
tree56ebc05a9af0de40af4c624e722ca2e489d0c7f1 /tests/malloc_iterate_test.cpp
parent96bd339c51194bf56781ccc738fde8babd618fc6 (diff)
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
Diffstat (limited to 'tests/malloc_iterate_test.cpp')
-rw-r--r--tests/malloc_iterate_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 2b7b88795..5e60a6d11 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 @@ static void AllocateSizes(TestDataType* test_data, const std::vector<size_t>& si
// 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 @@ TEST(malloc_iterate, small_allocs) {
// 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 @@ TEST(malloc_iterate, large_allocs) {
// 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, invalid_pointers) {
TEST(malloc_iterate, malloc_disable_prevents_allocs) {
#if defined(__BIONIC__)
+ SKIP_WITH_HWASAN;
pid_t pid;
if ((pid = fork()) == 0) {
malloc_disable();