summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_fallback.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2018-09-12 13:55:47 -0700
committerJosh Gao <jmgao@google.com>2018-09-12 18:12:13 -0700
commit6f9eeecd2b7d0e194bd710a8bdc0222ebe35d28d (patch)
tree3a8fcf55fb0726bbb311aaf00ab3068518df86cc /debuggerd/handler/debuggerd_fallback.cpp
parentd812d0dada5ef908419a5633a640420d0a1b1955 (diff)
Fix multithreaded backtraces for seccomp processes.
Add threads to the existing seccomp backtrace test to prevent regressing this. Bug: http://b/114139908 Bug: http://b/115349586 Test: debuggerd_test32 Test: debuggerd_test64 Change-Id: I07fbe1619b60f0008deb045a249f9045404478c2
Diffstat (limited to 'debuggerd/handler/debuggerd_fallback.cpp')
-rw-r--r--debuggerd/handler/debuggerd_fallback.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp
index 079a574d3..ed7423b37 100644
--- a/debuggerd/handler/debuggerd_fallback.cpp
+++ b/debuggerd/handler/debuggerd_fallback.cpp
@@ -47,6 +47,7 @@
#include <unwindstack/Regs.h>
#include "debuggerd/handler.h"
+#include "handler/fallback.h"
#include "tombstoned/tombstoned.h"
#include "util.h"
@@ -187,7 +188,7 @@ static std::pair<pid_t, int> unpack_thread_fd(uint64_t value) {
static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
static std::atomic<uint64_t> trace_output(pack_thread_fd(-1, -1));
- if (info->si_value.sival_int == ~0) {
+ if (info->si_value.sival_ptr == kDebuggerdFallbackSivalPtrRequestDump) {
// Asked to dump by the original signal recipient.
uint64_t val = trace_output.load();
auto [tid, fd] = unpack_thread_fd(val);
@@ -259,7 +260,7 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
siginfo_t siginfo = {};
siginfo.si_code = SI_QUEUE;
- siginfo.si_value.sival_int = ~0;
+ siginfo.si_value.sival_ptr = kDebuggerdFallbackSivalPtrRequestDump;
siginfo.si_pid = getpid();
siginfo.si_uid = getuid();
@@ -331,7 +332,7 @@ static void crash_handler(siginfo_t* info, ucontext_t* ucontext, void* abort_mes
extern "C" void debuggerd_fallback_handler(siginfo_t* info, ucontext_t* ucontext,
void* abort_message) {
- if (info->si_signo == DEBUGGER_SIGNAL && info->si_value.sival_int != 0) {
+ if (info->si_signo == DEBUGGER_SIGNAL && info->si_value.sival_ptr != nullptr) {
return trace_handler(info, ucontext);
} else {
return crash_handler(info, ucontext, abort_message);