summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
Commit message (Collapse)AuthorAgeFilesLines
* libmemunreachable: fix docs formatting.Elliott Hughes2018-05-301-1/+1
| | | | | | Bug: N/A Test: gittiles Change-Id: I59e7d22562cffa4e4a3c2a186523ae0f15623950
* Document using libmemunreachable on an appColin Cross2018-05-171-0/+21
| | | | | | | | Document dumpsys meminfo --unreachable, and how to enable malloc_debug backtraces on a single app. Test: none Change-Id: I649afdfff1c7438f74950395639b06c39cae3ca0
* Merge "libprocinfo: add functions reading process map file."Yabin Cui2018-05-155-140/+28
|\
| * libprocinfo: add functions reading process map file.Yabin Cui2018-05-145-140/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add test and benchmark. Also switch libbacktrace, libunwindstack, libmemunreachable to use libprocinfo for map file reading. The benchmark shows using libprocinfo speeds up map file reading in libbacktrace and libunwindstack 18% - 36% on walleye. Bug: http://b/79118393 Test: run procinfo_test. Test: run libunwindstack_test. Test: run libbacktrace_test. Test: run memunreachable_test. Change-Id: Icf281c352f4103fc8d4ba6732c5c07b943330ca1
* | Make memunreachable_test more robust against false negative leaksColin Cross2018-05-143-15/+73
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason, the memunreachable tests are rock solid on the devices covered by APCT, but catch a ton of false-negatives on hikey960, which show up as failures that look like: system/core/libmemunreachable/tests/MemUnreachable_test.cpp:200: Failure Expected equality of these values: 1U Which is: 1 info.leaks.size() Which is: 0 These happen when a stray copy of a pointer is lying around that points to the memory it is expected to leak. The stray pointers can be on the stack or in the jemalloc thread cache of freed allocations, which is always considered active memory. Add some extra cleanups to get rid of old pointers. 1. Clear the tcache when destructing UnreachableMemoryInfo 2. Clear the stack and tcache before and after each test 3. Make MemunreachbleTest.twice match MemunreachableTest.stack Also fix MemunreachableTest.notdumpable, which was only passing when run as root, which was bypassing what the test was trying to cover. Make the test pass when run as non-root, and skip when the test is running as root. Bug: 79701104 Test: memunreachable_test Test: memunreachable_test as root Change-Id: Ia6c6df11e76405d08118afcc19c1fe80a6684c56
* Add test_suites lines.Elliott Hughes2018-04-271-0/+3
| | | | | | Bug: N/A Test: builds Change-Id: Ic5e2b9206bcfcb53c774989013b5db6aab462e42
* Use ld when lld failsChih-Hung Hsieh2018-04-161-0/+6
| | | | | | | | | * Android's clang lld link rules do not work with the special link order of libunwind_llvm yet. Bug: 78118944 Test: make checkbuild and boot Change-Id: Ife9707f111dfd24cb84b56754a4fc3f826f722c4
* Remove test_suites: ["vts"] from memunreachable_binder_testColin Cross2018-03-151-1/+0
| | | | | | | | | | | | | memunreachable_binder_test is pulled in by test/vts/tools/build/tasks/list/vts_test_bin_package_list.mk, it doesn't need to be listed in test_suites. Fixes warnings: build/make/core/base_rules.mk:620: warning: overriding commands for target `out/host/linux-x86/vts/android-vts/testcases/memunreachable_binder_test' build/make/core/base_rules.mk:620: warning: ignoring old commands for target `out/host/linux-x86/vts/android-vts/testcases/memunreachable_binder_test' Test: vts-tradefed run commandAndExit vts -m VtsKernelBinderTest Change-Id: Ifd282b2f5bb652295fa34ad247919eb85ea7abc8
* Make memunreachable_binder_test suitable for VTSColin Cross2018-02-272-5/+17
| | | | | | | | | | | | Link statically against libmemunreachable to avoid runtime dependency on libmemunreachable.so. Provide a better error when run as non-root. Rename the test to MemunreachableBinderTest. Add comments explaining the test sequence. Bug: 28275695 Test: memunreachable_binder_test Change-Id: Iddfba636205b7ca3ad31a6ba2c4e85abadd32d0d
* bpfmt.Elliott Hughes2018-02-161-1/+1
| | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* Add explanation for clone useDaniel Colascione2018-02-082-1/+2
| | | | | Test: no code changes Change-Id: I70c8af8261cda3163677557fd78ae0119b1f1be0
* Add OWNERS.Elliott Hughes2017-12-071-0/+2
| | | | | | Bug: N/A Test: N/A Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
* Silence static analyzer warnings about memory leaksGeorge Burgess IV2017-09-241-0/+3
| | | | | | | | | | | | | The static analyzer complains that this memory is leaked regardless of how I try to work around it (unless we escape the memory by using a global or something, but...). Basically, as long as there's some sort of operation on the reinterpret_cast'ed pointer, it complains. If we remove the bitwise negations, it doesn't. Doing so would presumably defeat the purpose of this test, though, so add a NOLINT. Bug: 27101951 Test: mma. No more static analyzer warning for this file. Change-Id: If9008946a2145d17b8651535141bfd7ec9224739
* Fix static analyzer warningsGeorge Burgess IV2017-09-121-8/+9
| | | | | | | | | | | | | | | | The static analyzer was complaining that we were potentially leaking memory here (in `ASSERT_NE(ptr, nullptr)` after `new (char)`). This wasn't correct, but it's also not possible for `new` to return nullptr without std::nothrow. In any case, swap to direct calls to `::operator new`, since it looks like this test explicitly wants calls to `::operator new` to be emitted (which the C++ standard doesn't guarantee for all `new` expressions). Bug: 27101951 Test: mma; static analyzer warnings are gone. Also ran memunreachable_test on marlin; no failures. Change-Id: Ia740e41079f263040da978ba1ccc71c9c39f53fd
* Define current ABI string in android-base/macros.hdimitry2017-08-231-17/+0
| | | | | Test: make Change-Id: I8200d7b3232edba43a583c5ff1e1b0f78c768f69
* Remove LOCAL_CLANG and clang: trueLennart Wieboldt2017-07-251-1/+0
| | | | | | | | clang is the default compiler since Android nougat Test: mma & verified it´s still build with clang Change-Id: I34adaeef2f6558a09f26027271222bad94780507 Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
* Merge "libmemunreachable: track kernel binder references"Colin Cross2017-07-135-3/+294
|\
| * libmemunreachable: track kernel binder referencesColin Cross2017-07-125-3/+294
| | | | | | | | | | | | | | | | | | | | | | | | The kernel can hold references to binder objects that have no userspace references. Allow libmemunreachable to call into libbinder and libhwbinder to get lists of kernel references. Use undefined weak symbols so that libmemunreachable will continue to work in processes that do not have libbinder. Test: memunreachable_binder_test Bug: 28275695 Change-Id: I9eae73f2a51a49a7025ffe6309ccdc2693a2391b
* | Add test config for memunreachable_testColin Cross2017-07-071-0/+26
|/ | | | | Test: none Change-Id: Ieb297a2fcece6365a074cd470b3ca56e2baea926
* Fix ScopedSignalHandlerColin Cross2017-06-291-1/+1
| | | | | | | | I4ae2d82fdfdd58cf8ef1dfb6c401cef4ba9d3e88 broke memunreachable_test by replacing signal_ with signal. Test: memunreachable_test Change-Id: I8148321e3a94530867106708a33b5b63ed867380
* Fix stack test on arm32Colin Cross2017-06-221-3/+4
| | | | | | | | | | | The stack test puts a pointer to an allocation on the stack, checks that there are no leaks, then lets it go out of scope and checks that libmemunreachable can find a leak. This works on arm64, but on arm32 the pointer on the stack doesn't get overwitten and the leak is not detected. Rewrite the pointer to be NULL instead. Test: memunreachable_test Change-Id: I5959a34cbb572a5d8670270077a85d247a3a4880
* libmemunreachable: turn off MEM_ALOGV messagesColin Cross2017-06-221-1/+12
| | | | | | | | The move to async safe logging in I3d3b2111f6f6bf8a0d7039295d34d5168c191651 caused MEM_ALOGV messages to print even when NDEBUG was set. Test: builds Change-Id: Ibebe69d8c96f8f2556991c1eb5446a77782d43c7
* Move libmemunreachable into namespace androidColin Cross2017-06-2232-8/+140
| | | | | | | | Putting libmemunreachable in the global C++ namespace was an oversight, move it into namespace android. Test: m -j checkbuild Change-Id: I0799906f6463178cb04a719bb4054cad33a50dbe
* libmemunreachable: clang-format everythingColin Cross2017-06-2236-631/+563
| | | | | | | clang-format -i --sort-includes $(find . -name "*.cpp" -o -name "*.h") Test: builds Change-Id: Ia8e0677fe7f3f26dddba3a851cd2dfab9f14e421
* Merge "Shave a stack frame off asserts."Elliott Hughes2017-06-212-5/+1
|\
| * Shave a stack frame off asserts.Elliott Hughes2017-06-202-5/+1
| | | | | | | | | | | | | | | | | | We can't implement MEM_LOG_ALWAYS_FATAL_IF any more, but it wasn't really useful anyway. Bug: N/A Test: ran `crasher assert` and `crasher64 assert` Change-Id: I4ae2d82fdfdd58cf8ef1dfb6c401cef4ba9d3e88
* | Remove libmemunreachable from the VNDK.Martijn Coenen2017-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | It depends on functionality in the bionic allocator, which may get updated independently of the vendor partition (as libc is in the LL-NDK). Bug: 33241851 Test: builds Change-Id: I435679843229d0d4d2e2be7bfe8c27f558a016dd
* | Add a helpful error message if GetUnreachableMemory failsColin Cross2017-06-151-1/+4
|/ | | | | | | | | | The primary reason for GetUnreachableMemory failing is selinux blocking system apps from ptracing themselves. Add a helpful error message suggesting setenforce 0. Bug: 27945735 Test: dumpsys meminfo --unreachable com.android.systemui Change-Id: Ibfa9507860be36dffd514f82027f7a2f8a72ac48
* Add vendor_available:true to libmemunreachableVijay Venkatraman2017-05-241-0/+1
| | | | | | Bug: 38244611 Test: build sailfish Change-Id: Ieb7fdcae4b96a1e1622ba98a7cfb56a95b798452
* Merge "Small test fixes."Christopher Ferris2017-05-062-6/+8
|\
| * Small test fixes.Christopher Ferris2017-05-052-6/+8
| | | | | | | | | | | | | | Bug: 31919199 Test: Ran the unit tests. Change-Id: I62bdb007f9cfa57e3faaa05993fd6e23ce32b82f
* | Remove unused lambda capturesYi Kong2017-05-051-1/+1
|/ | | | | | Test: build Bug: 37752547 Change-Id: Id318f412ad81b6e7de3ad644cba4405bb04f2729
* Move all logging to use the async safe logging.Christopher Ferris2017-05-0311-76/+97
| | | | | | | | | | | | 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
* Move libc_logging to libasync_safe.Christopher Ferris2017-05-021-1/+0
| | | | | | | | | | | | | | | | Move the name of the "private/libc_logging.h" header to <async_safe/log.h>. For use of libc_malloc_debug_backtrace, remove the libc_logging library. The library now includes the async safe log functions. Remove the references to libc_logging.cpp in liblog, it isn't needed because the code is already protected by a check of the __ANDROID__ define. Test: Compiled and boot bullhead device. Test: Run debuggerd unit tests. Test: Run liblog unit tests on target and host. Test: Run libmemunreachable unit tests (these tests are flaky though). Change-Id: Ie79d7274febc31f210b610a2c4da958b5304e402
* liblog: use log/log.h when utilizing ALOG macrosMark Salyzyn2017-01-111-1/+1
| | | | | | Test: compile Bug: 30465923 Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
* Rely on the platform -std default.Elliott Hughes2016-10-101-1/+0
| | | | | | Bug: http://b/32019064 Test: builds Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
* system/core Replace log/log.h with android/log.hMark Salyzyn2016-09-301-1/+1
| | | | | | | | | | | Should use android/log.h instead of log/log.h as a good example to all others. Adjust header order to comply with Android Coding standards. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
* Add missing include.Dan Albert2016-09-211-0/+1
| | | | | | Test: mm Bug: None Change-Id: I8be335ed677e8646d3912ac3db49451bff66eb65
* Convert to Android.bpDan Willemsen2016-08-262-65/+80
| | | | | | | | | | | | | | | | | | | | | See build/soong/README.md for more information. I tested the following tests on a Nexus9 and linux host, and they continued to pass: /data/nativetest{,64}/bootstat_tests/bootstat_tests out/host/linux-x86/bin/nativetest{,64}/bootstat_tests/bootstat_tests /data/nativetest64/memunreachable_test/memunreachable_test out/host/linux-x86/bin/nativetest{,64}/memunreachable_test/memunreachable_test These continue to fail just like before this change: /data/nativetest{,64}/sync_test/sync_test (was /system/bin/sync_test) /data/nativetest{,64}/sync-unit-test/sync-unit-test /data/nativetest/memunreachable_test/memunreachable_test Test: See above Change-Id: I691e564e0cf008dd363e3746223b153d712e024d
* Merge "Fix google-explicit-constructor warnings in system/core."Chih-hung Hsieh2016-07-2910-13/+13
|\
| * Fix google-explicit-constructor warnings in system/core.Chih-Hung Hsieh2016-07-2610-13/+13
| | | | | | | | | | | | | | | | | | | | * Declare explicit conversion constructors. * Add NOLINT for implicit conversion constructors. * Fix also some misaligned indendations. Bug: 28341362 Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e Test: build with clang-tidy
* | Suppress clang-tidy performance warnings in libmemunreachable.Chih-Hung Hsieh2016-07-271-1/+1
|/ | | | | | Bug: 30413862 Change-Id: If3ed64d2e1ca1f46599de9fe97c769f468ee1a68 Test: build with WITH_TIDY=1
* Remove unnecessary ARRAY_SIZE macros.Elliott Hughes2016-06-281-5/+3
| | | | | | Use the canonical one instead. Change-Id: Id80f19455f37fd2a29d9ec4191c1a0af80c5c0e7
* Fix misc-macro-parentheses warnings in libion, libsparse, libmem*Chih-Hung Hsieh2016-05-181-3/+3
| | | | | Bug: 28705665 Change-Id: I3dd5c086787f5e48ab100a71a42109ea0e417bf9
* Merge "Fix google-explicit-constructor warnings."Chih-hung Hsieh2016-04-301-1/+1
|\
| * Fix google-explicit-constructor warnings.Chih-Hung Hsieh2016-04-291-1/+1
| | | | | | | | | | Bug: 28341362 Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
* | Silently ignore duplicate heap entriesColin Cross2016-04-292-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit cecd64012db013331ff1071254ab543dcdf327bd)
* | Handle segfaults while walking native heapColin Cross2016-04-294-6/+168
|/ | | | | | | | | | | 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 (cherry picked from commit ba5d9ff6d9674a0f1e985b49f53863045aff558d)
* Add operator int() to unique_fd.Elliott Hughes2016-03-283-9/+5
| | | | Change-Id: I7512559be7befbb8772d5529e06550267a2f1543
* Fix mac buildColin Cross2016-03-081-0/+1
| | | | | | | Disable memunreachable_test for mac. Change-Id: Ie9594b6e5dfc661c4d709b419dbcb7b610434a84 (cherry picked from commit e33686b7cad8169ba799f2348d86a670b4224220)