summaryrefslogtreecommitdiff
path: root/tests/malloc_iterate_test.cpp
diff options
context:
space:
mode:
authorMitch Phillips <mitchp@google.com>2020-02-11 16:08:17 -0800
committerMitch Phillips <mitchp@google.com>2020-02-11 16:08:17 -0800
commit242387d0cf6ba5e25d23b81f80915fc712ef8700 (patch)
tree13ab3a156d2fa0fe12669be598cdfa729e6f9502 /tests/malloc_iterate_test.cpp
parentd129786e122f4a7136fe4b8b1b3fdc5525897532 (diff)
[GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps.
GWP-ASan is part of the native allocator, and may allocate some memory. When GWP-ASan is enabled, the malloc tests need to look inside of GWP-ASan regions as well for native allocations. Bug: 135634846 Test: atest bionic-unit-tests Change-Id: Ibb78f9c9e7e96a437cffce013facd18708799b0e
Diffstat (limited to 'tests/malloc_iterate_test.cpp')
-rw-r--r--tests/malloc_iterate_test.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 6a82eb699..738a57b2b 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -96,7 +96,8 @@ static void VerifyPtrs(TestDataType* test_data) {
// Find all of the maps that are from the native allocator.
auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
- if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0) {
+ if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0 ||
+ strncmp(name, "[anon:GWP-ASan", 14) == 0) {
malloc_iterate(start, end - start, SavePointers, test_data);
}
};
@@ -192,7 +193,8 @@ TEST(malloc_iterate, invalid_pointers) {
// Only attempt to get memory data for maps that are not from the native allocator.
auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
- if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0) {
+ if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0 &&
+ strncmp(name, "[anon:GWP-ASan", 14) != 0) {
size_t total = test_data.total_allocated_bytes;
malloc_iterate(start, end - start, SavePointers, &test_data);
total = test_data.total_allocated_bytes - total;