diff options
author | Christopher Ferris <cferris@google.com> | 2017-11-16 19:55:48 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-11-16 20:07:13 -0800 |
commit | 664d2a909325400313dedff9d4306dbda768efb1 (patch) | |
tree | 2bd079365e2589129f77c53f8f762ce0fa128c0f /debuggerd/handler/debuggerd_handler.cpp | |
parent | 37eb97d911087992fb7dc986331e10a3c5a18d30 (diff) | |
download | system_core-664d2a909325400313dedff9d4306dbda768efb1.tar.gz system_core-664d2a909325400313dedff9d4306dbda768efb1.tar.bz2 system_core-664d2a909325400313dedff9d4306dbda768efb1.zip |
Force call the fallback handler.
Always check to see if the fallback handler has been called and is
not trying to dump a specific thread.
Bug: 69110957
Test: Verified on a system where the prctl value changes, that before the
Test: change it dumps multiple tombstones, and after the change it
Test: works as expected.
Test: Ran debuggerd unit tests.
Test: Dumped process using debuggerd -b <PID> and debuggerd <PID>.
Change-Id: Id98bbe96cced9335f7c3e17088bb4ab2ad2e7a64
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r-- | debuggerd/handler/debuggerd_handler.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp index d6b6d58d8..bd202ff14 100644 --- a/debuggerd/handler/debuggerd_handler.cpp +++ b/debuggerd/handler/debuggerd_handler.cpp @@ -429,7 +429,12 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c abort_message = g_callbacks.get_abort_message(); } - if (prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { + // If sival_int is ~0, it means that the fallback handler has been called + // once before and this function is being called again to dump the stack + // of a specific thread. It is possible that the prctl call might return 1, + // then return 0 in subsequent calls, so check the sival_int to determine if + // the fallback handler should be called first. + if (info->si_value.sival_int == ~0 || prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) { // This check might be racy if another thread sets NO_NEW_PRIVS, but this should be unlikely, // you can only set NO_NEW_PRIVS to 1, and the effect should be at worst a single missing // ANR trace. |