Implements a PtraceConnection over a socket. More...
#include "util/linux/ptrace_broker.h"
Classes | |
| class | AttachmentsArray |
| struct | GetThreadInfoResponse |
| The response sent for a Request with type kTypeGetThreadInfo. More... | |
| struct | Request |
| A request sent to a PtraceBroker from a PtraceClient. More... | |
Public Types | |
| enum | OpenResult : int32_t |
| A result used in operations that accept paths. More... | |
| enum | ReadError : int32_t |
| A result used in operations that read from memory or files. More... | |
Public Member Functions | |
| PtraceBroker (int sock, pid_t pid, bool is_64_bit) | |
| Constructs this object. | |
| PtraceBroker (const PtraceBroker &)=delete | |
| PtraceBroker & | operator= (const PtraceBroker &)=delete |
| void | SetFileRoot (const char *root) |
| Restricts the broker to serving the contents of files under root. | |
| int | Run () |
| Begin serving requests on the configured socket. | |
Implements a PtraceConnection over a socket.
This class is the server half of the connection. The broker should be run in a process with ptrace capabilities for the target process and may run in a compromised context.
| enum crashpad::PtraceBroker::OpenResult : int32_t |
| enum crashpad::PtraceBroker::ReadError : int32_t |
| crashpad::PtraceBroker::PtraceBroker | ( | int | sock, |
| pid_t | pid, | ||
| bool | is_64_bit ) |
Constructs this object.
| [in] | sock | A socket on which to read requests from a connected PtraceClient. Does not take ownership of the socket. |
| [in] | pid | The process ID of the process the broker is expected to trace. Setting this value exends the default file root to "/proc/[pid]/" and enables memory reading via /proc/[pid]/mem. The broker will deny any requests to read memory from processes whose processID is not pid. If pid is -1, the broker will serve requests to read memory from any process it is able to via ptrace PEEKDATA. |
| [in] | is_64_bit | Whether this broker should be configured to trace a 64-bit process. |
| int crashpad::PtraceBroker::Run | ( | ) |
Begin serving requests on the configured socket.
This method returns when a PtraceBrokerRequest with type kTypeExit is received or an error is encountered on the socket.
| void crashpad::PtraceBroker::SetFileRoot | ( | const char * | root | ) |
Restricts the broker to serving the contents of files under root.
If this method is not called, the broker defaults to only serving files under "/proc/" or "/proc/[pid]/" if a pid was set.
Calling this function disables reading from a memory file if one has not already been opened.
| [in] | root | A NUL-terminated c-string containing the path to the new root. root must not be nullptr, must end in a '/', and the caller should ensure that root remains valid for the lifetime of the broker. |