Merge "[GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps."

This commit is contained in:
Treehugger Robot 2020-02-12 02:58:43 +00:00 committed by Gerrit Code Review
commit 549a60aa7d
2 changed files with 6 additions and 3 deletions

View file

@ -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;

View file

@ -74,7 +74,8 @@ TEST(malloc_stress, multiple_threads_forever) {
uint64_t rss_bytes = 0;
uint64_t vss_bytes = 0;
for (auto& vma : maps) {
if (vma.name == "[anon:libc_malloc]" || android::base::StartsWith(vma.name, "[anon:scudo:")) {
if (vma.name == "[anon:libc_malloc]" || android::base::StartsWith(vma.name, "[anon:scudo:") ||
android::base::StartsWith(vma.name, "[anon:GWP-ASan")) {
android::meminfo::Vma update_vma(vma);
ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma));
rss_bytes += update_vma.usage.rss;