SIGBUS shouldn't happen, since all of the regions being walked
were previously read out of /prod/pid/maps, but it seems to happen
rarely. Catch it so it can produce a better log message.
Bug: 128983715
Test: atest memunreachable_test
Change-Id: I82d3941a382a0451c0dda12f5eb849ad8d697bc9
* Scan memory in a non-sanitized function.
* Don't scan hwasan shadow mappings.
Shadow is ~33G and never contains any heap pointers. The scan takes
about a minute on my device.
Bug: 112438058
Test: memunreachable_test with SANITIZE_TARGET=hwaddress
the test still fails, but now there are no hwasan reports or new
tombstones, and it completes in less than a minute
Change-Id: Ibe4811c67609ca9fe317edc250993b915570a638
Bug 120032857 is seeing what appears to be allocations with incorrect
end addresses, leading to a much later crash when it tries to map
a zero page outside the valid virtual address space. Detect allocations
that extend outside the highest or lowest memory mapping and crash
immediately instead.
Test: memunreachable_test
Bug: 120032857
Change-Id: I9be670a025143e7078360a6bf7a83219279614d9
The excessive logging of pages with segfaults is making it hard to
see what caused the problem, only log the first page that segfaults,
the range that was being walked when the first segfault happened,
and the total number of pages that segfaulted.
Bug: 120032857
Test: memunreachable_test --gtest_filter=HeapWalkerTest.segv
Change-Id: I71821a3f5be65f2fbcb36afc4b7b1ffa4a48e660
Putting libmemunreachable in the global C++ namespace was an oversight,
move it into namespace android.
Test: m -j checkbuild
Change-Id: I0799906f6463178cb04a719bb4054cad33a50dbe
Also, add a link to the .clang-format-2 for this directory and clang
format the files that changed.
Bug: 31919199
Test: Boot bullhead.
Test: Run unit tests on bullhead. There are a few that fail, but they
Test: failed before and are not a result of this change.
Change-Id: I3d3b2111f6f6bf8a0d7039295d34d5168c191651
Vendor blobs on ryu mprotect heap pages, causing a single chunk mapping
to appear as multiple mappings. The heap iterator has to expand the
requested range to cover the beginning of the chunk to find the chunk
metadata, which will lead to duplicate identical allocations being
reported from iterating over each of the split mappings. Silently
ignore identical allocations, and only warn on non-identical allocations
that overlap.
Bug: 28269332
Change-Id: Ied2ab9270f65d00a887c7ce1a93fbf0617d69be0
Vendor blobs on ryu mprotect heap pages, causing segfaults when dumping
unreachable memory. Handle segfaults within HeapWalker by mapping a
zero page over any unreadable pages. HeapWalker runs in the forked
process, so the mapping will not affect the original process.
Bug: 28269332
Change-Id: I16245af722123f2ad467cbc6f245a70666c55544
Find leaks that have no references at all, or are only referenced by
other leaks in the same strongly connected component, and hide all
referenced leaks.
Bug: 27208635
Change-Id: Ifbfd14e24e2ba0f8af7c1b887e57f34362720f2d
libmemunreachable uses an imprecise mark and sweep pass over all memory
allocated by jemalloc in order to find unreachable allocations.
Bug: 27208635
Change-Id: Ia70bbf31f5b40ff71dab28cfd6cd06c5ef01a2d4
(cherry picked from commit bcb4ed3eaa)