summaryrefslogtreecommitdiffstats
path: root/debuggerd/utility.h
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-07-14 16:43:12 -0700
committergitbuildkicker <android-build@google.com>2016-07-21 17:35:58 -0700
commitc764dcd6977a04e272e44b0381c13ac4aed8a280 (patch)
tree08ebba7ece5aa22e9d8d6f6aea23325e67aedb45 /debuggerd/utility.h
parentf483354e592c9edd836acbc0fffcedfb6958c889 (diff)
downloadsystem_core-c764dcd6977a04e272e44b0381c13ac4aed8a280.zip
system_core-c764dcd6977a04e272e44b0381c13ac4aed8a280.tar.gz
system_core-c764dcd6977a04e272e44b0381c13ac4aed8a280.tar.bz2
DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
Fix two races in debuggerd's PTRACE_ATTACH logic: 1. The target thread in a crash dump request could exit between the /proc/<pid>/task/<tid> check and the PTRACE_ATTACH. 2. Sibling threads could exit between listing /proc/<pid>/task and the PTRACE_ATTACH. Backport of NYC change I4dfe1ea30e2c211d2389321bd66e3684dd757591 Bug: http://b/29555636 Change-Id: I6c6efcf82a49bca140d761b2d1de04215ba4d252
Diffstat (limited to 'debuggerd/utility.h')
-rw-r--r--debuggerd/utility.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/debuggerd/utility.h b/debuggerd/utility.h
index 263374d..e8ec7ef 100644
--- a/debuggerd/utility.h
+++ b/debuggerd/utility.h
@@ -79,4 +79,9 @@ int wait_for_sigstop(pid_t, int*, bool*);
void dump_memory(log_t* log, Backtrace* backtrace, uintptr_t addr, const char* fmt, ...);
+bool pid_contains_tid(pid_t pid, pid_t tid);
+
+// Attach to a thread, and verify that it's still a member of the given process
+bool ptrace_attach_thread(pid_t pid, pid_t tid);
+
#endif // _DEBUGGERD_UTILITY_H