From a6e21989e4e16b9ee36960da627e607aecbc847e Mon Sep 17 00:00:00 2001 From: s1341 Date: Fri, 30 Apr 2021 09:46:32 +0300 Subject: [PATCH] frida-asan: only unpoison readable/writeable memory This significantly reduces the working set. --- libafl_frida/src/asan_rt.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libafl_frida/src/asan_rt.rs b/libafl_frida/src/asan_rt.rs index 5a0b62bd27..80d243f50f 100644 --- a/libafl_frida/src/asan_rt.rs +++ b/libafl_frida/src/asan_rt.rs @@ -770,13 +770,13 @@ impl AsanRuntime { /// Unpoison all the memory that is currently mapped with read/write permissions. fn unpoison_all_existing_memory(&self) { let mut allocator = Allocator::get(); - walk_self_maps(&mut |start, end, _permissions, _path| { - //if permissions.as_bytes()[0] == b'r' || permissions.as_bytes()[1] == b'w' { - if allocator.pre_allocated_shadow && start == 1 << allocator.shadow_bit { - return false; + walk_self_maps(&mut |start, end, permissions, _path| { + if permissions.as_bytes()[0] == b'r' || permissions.as_bytes()[1] == b'w' { + if allocator.pre_allocated_shadow && start == 1 << allocator.shadow_bit { + return false; + } + allocator.map_shadow_for_region(start, end, true); } - allocator.map_shadow_for_region(start, end, true); - //} false }); }