summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/PointerData.cpp
AgeCommit message (Collapse)Author
2021-06-04Merge SP1A.210604.001Scott Lobdell
Change-Id: Id2e423c8ff6a838a96260a5b919810d4ef11e8db
2021-05-13Update API of MapInfo from libunwindstackDavid Srbecky
Use accessors to for all the fields. Test: build Change-Id: I6ae458002e059ef2f9d73931cc68f2f698f85d7e
2020-01-06Merge RP1A.200106.001Steven Laver
Change-Id: I18e758487fd86488b3a27e8b272f5e4c1aaaef59
2020-01-02Move bionic_macros.h from private to platform.Josh Gao
Test: treehugger Change-Id: Ie473914f4c8924c7240b3ac22093a9daf42fc948
2019-11-14Merge RP1A.191114.001Steven Laver
Change-Id: I19fb768a647d471d430af4b5c3f519d4125fdeee
2019-11-06Fix allocations escaping malloc debug.Christopher Ferris
When using a FILE object for some malloc debug functions, calling fprintf will trigger an allocation to be put in the object. The problem is that these allocations were not allocated by the malloc debug wrapper and they get freed during the fclose as if they are malloc debug allocation. In most cases, the code will detect the bad pointer and leak the memory, but it might also cause a crash. The fix is to avoid using fprintf so that no allocations are made in the object that survive and need to be freed in the fclose call. Change the MallocXmlElem.h to use a file decsriptor not a FILE object. Add new unit and system tests to detect this case. Bug: 143742907 Test: Ran unit and system tests. Test: Ran bionic unit tests. Change-Id: I524392de822a29483aa5be8f14c680e70033eba2
2019-08-25Merge RP1A.190822.001Scott Lobdell
Change-Id: Iaf90835a99d87f6246798efd2cea6fe9f750ea18
2019-07-18Move to the libc++ demangler.Christopher Ferris
Bug: 136138882 Test: Ran malloc debug tests. Test: Ran an app with backtrace_full and verified demangling working in Test: log file. Test: Enabled leak checking and verified that the logs include properly Test: demangled. Change-Id: Ic4fd9f1522451e867048ac1bea59d8c5ed0d3577
2019-06-14Avoid recording backtrace if alloc-size is outside range of interestShibin George
Steps: 1) setprop libc.debug.malloc.program <program name> 2) setprop libc.debug.malloc.options "backtrace leak_track" 3) setprop libc.debug.malloc.minalloctorecord <int> # defaults to 0 4) setprop libc.debug.malloc.maxalloctorecord <int> # defaults to SIZE_MAX With this, backtrace recording of only those allocations which fall within the desired range will be done. CRs-Fixed: 2471840 Change-Id: I586dfd590e429b53e7b1b237294f0298ff7b4017
2019-04-02Disable info messages by default for malloc debug.Christopher Ferris
Add a new option verbose for malloc debug that is not enabled by default. This disables all of the info log messages. It turns out these log messages can add a measurable amount of time and can change the boot up. Bug: 129239269 Test: Adjusted unit tests pass. Test: Verified no messages unless verbose option used. Change-Id: I805cb7c8ecb44de88119574e59d784877cacc383
2019-03-08Malloc debug: fix mutex deadlock issueIris Chang
When we enable free_track option, one thread is in AddFreed->RemoveBacktrace flow (hold free_pointer_mutex_ first and try to lock frame_mutex_), and other thread do fork and enter PrepareFork flow (hold frame_mutex_ first and try to lock free_pointer_mutex_), this situation may result in mutex deadlock issue. Bug: 127733115 Test: build pass and stress test pass Change-Id: Ie5fcc4ef6c169372ad73d81978cfb2a726b6c03e
2019-03-07Refactor the malloc_info code.Christopher Ferris
malloc_info needs to be per native allocator, but the code treated it like a global function that doesn't depend on the native memory allocator. Update malloc debug to dump the actual pointers that it has been tracking. Test: bionic-unit-tests pass. Test: malloc debug tests pass. Test: malloc hook tests pass. Change-Id: I3b0d4d748489dd84c16d16933479dc8b8d79013e Merged-In: I3b0d4d748489dd84c16d16933479dc8b8d79013e (cherry picked from commit a3656a98b10d2a4a6194a5d9705ad9c2cc5877b0)
2019-02-14malloc debug: fix LogFreeError error logIris Chang
When free_track option is enabled and malloc debug detects error in VerifyFreedPointer flow, if freed pointer's usable_size is more than g_debug->config().fill_on_free_bytes(), the error log is not correct. The max. bytes printed to error message should be the max bytes to cmp, not usable size. Bug: 124420174 Test: build pass and test pass Change-Id: I41f35ab3330e49e0a6ad276d405bf4f6c3f0ea92
2019-01-22Bionic malloc debug: add a new option "abort_on_error"Iris Chang
This new option causes an abort after malloc debug detects an error. This allows vendors to get process coredumps to analyze memory for corruption. Bug: 123009873 Test: New test cases added for unit tests and config tests. Change-Id: I6b480af7f747d6a82f61e8bf3df204a5f7ba017f
2018-05-24Add support for using the new unwinder.Christopher Ferris
This adds a new option backtrace_full, when it is set, then it will use libunwindstack. Modify the dump to file data to dump the extra information from libunwindstack. Along with the new dump file format, change the version to v1.1. Updated document for new format of file data. Add unit tests for the new functionality. Bug: 74361929 Test: Ran unit tests. Change-Id: I40fff795f5346bba7b9d7fde2e04f269ff4eb7f1
2018-05-01Fix nullptr dereference during sort.Christopher Ferris
Add new unit test that will crash without this fix. Bug: 78900050 Test: Ran unit tests. Change-Id: I73e1b89e965a7b399822c3a6f25cbc70d2d355e2
2018-04-02Refactor malloc debug.Christopher Ferris
Changes - Refactor the code so that only guards require creating a special header for every pointer allocated. - Store only a single copy of every backtrace. This saves memory so that turning on the backtrace option doesn't result in 10X memory usage. - Added new option track_allocs that only verifies pointers are valid for free/malloc_usable_size/realloc. - Remove suffix from test names. - Add the TRACK_ALLOCS options to all guard options. - Add new option verify_pointers that is a lightweight way to verify pointers that are passed to allocation routines. - Do auto-formatting of the code. - Updated documentation for all of these changes. Bug: 74361929 Test: Ran unit tests. Test: Ran libmemunreachable unit tests. Test: Ran an app with backtrace enabled. Change-Id: I3246c48ae4f9811f64622d90d0a9b4d9d818702c