diff options
author | Josh Gao <jmgao@google.com> | 2017-03-01 11:53:14 -0800 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2017-03-01 11:55:16 -0800 |
commit | 981761bbb25738b7ced9ed44e7ed88250a985fd1 (patch) | |
tree | 7cdc4945e2f843143790fd3fcc7c2957897e4362 /debuggerd/client | |
parent | 4bd3facbb1e79055f92e2ea8d42cb81552ffc6bb (diff) | |
download | core-981761bbb25738b7ced9ed44e7ed88250a985fd1.tar.gz core-981761bbb25738b7ced9ed44e7ed88250a985fd1.tar.bz2 core-981761bbb25738b7ced9ed44e7ed88250a985fd1.zip |
debuggerd: remove obsolete dumpable check.
PR_SET_DUMPABLE is ignored now.
Bug: http://b/35872161
Test: debuggerd -b `pidof surfaceflinger`
Change-Id: Iefd090f2b762d454d1e6ce8061ff5f992974267c
Diffstat (limited to 'debuggerd/client')
-rw-r--r-- | debuggerd/client/debuggerd_client.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp index 81d70df1c..f2975d14a 100644 --- a/debuggerd/client/debuggerd_client.cpp +++ b/debuggerd/client/debuggerd_client.cpp @@ -45,42 +45,6 @@ static bool send_signal(pid_t pid, bool backtrace) { return true; } -static bool check_dumpable(pid_t pid) { - // /proc/<pid> is owned by the effective UID of the process. - // Ownership of most of the other files in /proc/<pid> varies based on PR_SET_DUMPABLE. - // If PR_GET_DUMPABLE would return 0, they're owned by root, instead. - std::string proc_pid_path = android::base::StringPrintf("/proc/%d/", pid); - std::string proc_pid_status_path = proc_pid_path + "/status"; - - unique_fd proc_pid_fd(open(proc_pid_path.c_str(), O_DIRECTORY | O_RDONLY | O_CLOEXEC)); - if (proc_pid_fd == -1) { - return false; - } - unique_fd proc_pid_status_fd(openat(proc_pid_fd, "status", O_RDONLY | O_CLOEXEC)); - if (proc_pid_status_fd == -1) { - return false; - } - - struct stat proc_pid_st; - struct stat proc_pid_status_st; - if (fstat(proc_pid_fd.get(), &proc_pid_st) != 0 || - fstat(proc_pid_status_fd.get(), &proc_pid_status_st) != 0) { - return false; - } - - // We can't figure out if a process is dumpable if its effective UID is root, but that's fine - // because being root bypasses the PR_SET_DUMPABLE check for ptrace. - if (proc_pid_st.st_uid == 0) { - return true; - } - - if (proc_pid_status_st.st_uid == 0) { - return false; - } - - return true; -} - bool debuggerd_trigger_dump(pid_t pid, unique_fd output_fd, DebuggerdDumpType dump_type, int timeout_ms) { LOG(INFO) << "libdebuggerd_client: started dumping process " << pid; @@ -114,11 +78,6 @@ bool debuggerd_trigger_dump(pid_t pid, unique_fd output_fd, DebuggerdDumpType du return true; }; - if (!check_dumpable(pid)) { - dprintf(output_fd.get(), "target pid %d is not dumpable\n", pid); - return true; - } - sockfd.reset(socket(AF_LOCAL, SOCK_SEQPACKET, 0)); if (sockfd == -1) { PLOG(ERROR) << "libdebugger_client: failed to create socket"; |