android_system_core/debuggerd
Christopher Ferris 469b62a334 Use fallback linker allocator in trace_handler.
There is more than one function that can allocate in the fallback
path. Therefore, make sure that all functions that can allocate have
switched to the fallback linker allocator before allocating. This
is mostly a problem for the trace_handler function call, which iterates
over all known threads and gets backtraces for them.

Add a ScopedUseFallbackAllocator class to do the switching to make it
easier to have the same code everywhere.

Add two tests to verify that no allocations are occuring during
a tombstone or backtrace on the fallback path. These tests are not
comprehensive since they can't verify that the linker allocator is
using the fallback allocator, but they are better than nothing.

Remove the debuggerd_fallback_tombstone() function since it only
enables the linker callback and then calls engrave_tombstone_ucontext().
The enabling is now done with the ScopedUseLinkerAllocator.

Restructure the case where sending the signal to a thread fails so
that the fallback allocator can be enabled properly.

Bug: 359692763

Test: Ran debuggerd -b <PID> and debuggerd <PID> on a process that
Test: goes throught the fallback path.
Test: Unit tests pass along with two new tests.
Test: Forced a fallback process to crash and verified tombstone generated.
Test: Instrumented the linker allocator and verified that the trace_handler
Test: function never calls the normal linker allocator as it runs.
Change-Id: I2710921076634eac97f41bec8c3a29c1d75ae5ec
2024-09-04 01:13:04 +00:00
..
client Make timeout messages distinct 2024-07-03 17:33:08 -07:00
common/include Add ability to handle multiple intercepts per pid. 2023-10-19 15:13:59 +00:00
crasher crasher: hide xom from help when unavailable 2024-05-16 13:53:02 -07:00
handler Use fallback linker allocator in trace_handler. 2024-09-04 01:13:04 +00:00
include/debuggerd [MTE] Implement permissive (recoverable) MTE for apps 2024-03-19 11:26:02 +01:00
libdebuggerd host_signal_fixup.h: remove unused file. 2024-08-26 12:43:04 +00:00
proto [MTE] write stack history into tombstone 2024-08-20 18:04:01 -07:00
rust/tombstoned_client Format all of the blueprint files. 2024-02-26 13:34:38 -08:00
seccomp_policy Fix up the debuggerd policy files. 2024-02-22 16:23:46 -08:00
test_permissive_mte Allow to re-enable MTE a specified time after a permissive fault 2024-08-14 15:02:54 -07:00
tombstoned Remove unnecessary std::move 2024-08-12 18:15:19 +08:00
.clang-format Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
Android.bp [MTE] write stack history into tombstone 2024-08-20 18:04:01 -07:00
crash_dump.cpp [MTE] write stack history into tombstone 2024-08-20 18:04:01 -07:00
crash_test.cpp Add a test to verify the dex_pc is correct. 2021-09-15 22:14:28 +00:00
crash_test.h Add a test to verify the dex_pc is correct. 2021-09-15 22:14:28 +00:00
debuggerd.cpp debuggerd: dump frozen Java processes 2024-01-12 14:06:43 -08:00
debuggerd_benchmark.cpp debuggerd: add pause time benchmark. 2017-12-19 16:36:04 -08:00
debuggerd_test.cpp Use fallback linker allocator in trace_handler. 2024-09-04 01:13:04 +00:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
OWNERS Remove jmgao from OWNERS files. 2021-08-10 21:42:14 -07:00
pbtombstone.cpp Reland protobuf tombstones. 2021-01-26 17:55:17 -08:00
protocol.h [MTE] Implement permissive (recoverable) MTE for apps 2024-03-19 11:26:02 +01:00
TEST_MAPPING Make sure debuggerd_test is run on device. 2024-04-25 13:57:52 -07:00
tombstone_handler.cpp Add tombstone_handler for crashes in Microdroid 2023-03-20 11:46:09 +00:00
tombstone_handler.h Add tombstone_handler for crashes in Microdroid 2023-03-20 11:46:09 +00:00
util.cpp Fix fallback paths for dumping threads. 2022-05-27 13:05:56 -07:00
util.h Dump threads in tombstone fallback path. 2022-02-16 15:02:38 -08:00