platform_system_core/debuggerd
Josh Gao c531ed6648 debuggerd_fallback: fix race.
A race condition occurs when one thread takes more than a second to get
scheduled to handle the signal we send to ask it to dump its stack.
When this happens, the main thread will continue on, close the fd, and
then ask the next thread to dump, but the slow thread will then wake up
and try to write to the new thread's fd, or trigger an assertion in
__linker_enable_fallback_allocator.

Do a few things to make this less bad:
  - encode both target tid and fd in the shared atomic, so that we know
    who each fd is for
  - switch __linker_enable_fallback_allocator to return success instead
    of aborting, and bail out if it's already in use
  - write to the output fd right when we get to it, instead of doing it
    whenever the dumping code decides to, to reduce the likelihood that
    the timeout expires

Test: debuggerd_test
Change-Id: Ife0f6dae388b601e7f991605f14d7a0274013f6b
2018-02-09 15:35:40 -08:00
..
client crash_dump: lower THREAD_COUNT in debuggerd_client.race for low-speed devices 2017-06-23 08:59:22 +09:00
common/include tombstoned: allow intercepts for java traces. 2017-05-31 10:35:32 +01:00
crasher Change seccomp to the system filter 2017-12-22 14:35:28 -08:00
handler debuggerd_fallback: fix race. 2018-02-09 15:35:40 -08:00
include/debuggerd tombstoned: allow intercepts for java traces. 2017-05-31 10:35:32 +01:00
libdebuggerd Fix regression caused by libbacktrace API change. 2018-01-20 00:59:11 -08:00
seccomp_policy debuggerd: update policy for recent sigaction changes. 2018-02-08 16:48:03 -08:00
tombstoned tombstoned: fix another call to evconnlistener_new. 2017-09-22 18:00:35 -07:00
.clang-format Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
Android.bp Add extra frame when dex_pc is non-zero. 2018-01-23 13:17:48 -08:00
Android.mk debuggerd: add seccomp policies and tests. 2018-01-18 13:49:56 -08:00
crash_dump.cpp crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00
debuggerd.cpp Remove unnecessary SELinux dependencies 2017-07-01 07:41:48 -07:00
debuggerd_benchmark.cpp debuggerd: add pause time benchmark. 2017-12-19 16:36:04 -08:00
debuggerd_test.cpp debuggerd: add seccomp policies and tests. 2018-01-18 13:49:56 -08:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
OWNERS Add OWNERS. 2017-12-07 13:30:03 -08:00
protocol.h crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00
util.cpp crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00
util.h crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00