I was actually here to add some new documentation, but realized there wasn't really a good place to put it...
Change-Id: I8a2fc93e61a89e87aa53dd0beb9dfcc6561687ca
This is just POSIX nonsense. Android, iOS/macOS, the BSDs, and glibc all have getpagesize(). Window doesn't, but Windows doesn't have sysconf(3) either, so there's not a strong "portability" argument to be had there!
Change-Id: Ieacfbb61c3612045f27c20c3fa4fa12694db2243
The setjmp implementation is correct, but this comment was wrong, and we were missing the implementation of the test. This would be slightly simpler if we enabled Zfa in the build system and qemu, but this works for now.
Change-Id: Iad32771019584beacd8b35138ac2bf4c0a14c903
A lot of people who see these via pitot or whatever don't even think to look at the real tombstone. Make it explicit that this is what they should do next. Also, since we have the numbers, say exactly what we mean by "most common".
Bug: http://b/338882189
Change-Id: Ia21848a40e82cb2486538a7578501e2ec0948e1c
I only came to improve the signature mismatch error, but I was then annoyed by the copy & paste of the other checks.
get_chunk_size() seems to be deliberately avoiding any checks, though I think that might be a bug, and there should be a get_chunk_size() that _does_ check for most callers, and a get_chunk_size_unchecked() for the <sys/thread_properties.h> stuff that seems to want to only be "best effort" (but does still have _some_ possibility of aborting, in addition to the possibility of segfaulting).
Also a bit of "include what you use" after cider complained about all the unused includes in bionic_allocator.h.
Bug: https://issuetracker.google.com/341850283
Change-Id: I278b495601353733af516a2d60ed10feb9cef36b
We only use this in one other place anyway.
Also be explicit about how `__tls_get_addr` and `___tls_get_addr` differ, since I missed that at first!
Change-Id: Ica214886c5346f118f063bca26e6dd8d74ee21f4
Strictly, this is more of "swap one form of duplication for another", but
I found the existing code non-obvious in part because people have added new
code under existing comments (which don't apply), in two places. At this
point, duplicating the _condition_ (which is much less likely to change at
all, let alone grow more complex) clarifies the code and makes the comments
match the code they're adjacent to again.
Test: treehugger
Change-Id: Ic8f01dc5b4fd14e942bf8dd7c72cab7df06d99d5
The maximum page size Android supports
now is 16384, and Art only supports 16kB,
so we can save a bit of space.
Bug: 332556665
Test: N/A
Change-Id: I23df607bcc5cf9e96d7b6a66169413cd1a883f7e
Rather than only updating the maps when a pc can't be found, always update
the maps before using them. This avoids issues where the maps change
and it could cause a crash reading from a map that has been modified.
This assumes that executed code never gets unloaded, or that the
code is unloaded so infrequently that it doesn't matter. This happens
because the pcs for the backtraces are gathered as the program runs
and those pcs are symbolized and made into relative pcs at a later time.
Also, add safe reading of the elf data when necessary to avoid any
crashes if maps are changing while this is running.
Since the MapEntry objects can be deleted, copy the values for
the current map in the backtrace code to detect when in our own code
instead of keeping a pointer.
Bug: 340988785
Test: malloc_debug unit/system tests pass.
Test: libmemunreachable tests pass.
Change-Id: Ica2ba50a5bcf9e19c7e4033e29a5a67a1847d1a6
This reverts commit 12b2042a3f.
Reason for revert: Droidmonitor triggered revert due to build breakage in b/342029467. Will be verifying through ABTD before submission.
Change-Id: I801b4999047732b86985f0be2f4aae90b9998e4a
We do the same thing in pthread_create().
This has the nice side-effect of letting us move part of the child setup that we were doing in the parent into the child where it belongs.
Bug: https://issuetracker.google.com/340125671
Change-Id: Ibe646d5ca9066f487d08fd40f004550349e8a02e
This makes this TraceFunction() more like trace_function() in malloc_debug. I'll leave whether we can collapse these into one implementation as an open question for now...
Change-Id: I3981e4114244d49f8dbae1d3b776a7e9c32be688