summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_handler.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-01-25 11:05:11 -0800
committerJosh Gao <jmgao@google.com>2017-01-25 11:15:01 -0800
commit529b3066d5124f07a2566d315fda3e5129ab8a25 (patch)
tree6df3067f5051ef33852fa9e3e5a303e6489fc5dc /debuggerd/handler/debuggerd_handler.cpp
parentfc12c4b81ef026ff2835d8fc18d9cb271d52b0ac (diff)
debuggerd_handler: don't resend nonfatal signals when not dumping.
Bug: http://b/34516140 Test: debuggerd -b `pidof surfaceflinger` Change-Id: I0275ffca24bf4840e264eaa4b79611e2404edfb0
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 8ea06c0a3..1af0bd1af 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -236,7 +236,7 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
return 0;
}
-static void resend_signal(siginfo_t* info) {
+static void resend_signal(siginfo_t* info, bool crash_dump_started) {
// Signals can either be fatal or nonfatal.
// For fatal signals, crash_dump will send us the signal we crashed with
// before resuming us, so that processes using waitpid on us will see that we
@@ -254,9 +254,11 @@ static void resend_signal(siginfo_t* info) {
// all signals when registering the handler, so resending the signal (using
// rt_tgsigqueueinfo(2) to preserve SA_SIGINFO) will cause it to be delivered
// when our signal handler returns.
- int rc = syscall(SYS_rt_tgsigqueueinfo, getpid(), gettid(), info->si_signo, info);
- if (rc != 0) {
- fatal("failed to resend signal during crash: %s", strerror(errno));
+ if (crash_dump_started || info->si_signo != DEBUGGER_SIGNAL) {
+ int rc = syscall(SYS_rt_tgsigqueueinfo, getpid(), gettid(), info->si_signo, info);
+ if (rc != 0) {
+ fatal("failed to resend signal during crash: %s", strerror(errno));
+ }
}
if (info->si_signo == DEBUGGER_SIGNAL) {
@@ -300,7 +302,7 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void*)
__libc_format_log(ANDROID_LOG_INFO, "libc",
"Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0");
- resend_signal(info);
+ resend_signal(info, false);
return;
}
@@ -346,7 +348,7 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void*)
signal(signal_number, SIG_DFL);
}
- resend_signal(info);
+ resend_signal(info, thread_info.crash_dump_started);
}
void debuggerd_init(debuggerd_callbacks_t* callbacks) {