#include "handler/linux/exception_handler_server.h"
#include <errno.h>
#include <linux/capability.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <utility>
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_number_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#include "util/file/file_io.h"
#include "util/file/filesystem.h"
#include "util/linux/proc_task_reader.h"
#include "util/linux/socket.h"
namespace crashpad {
namespace {
void LogSocketError(int sock) { … }
enum class PtraceScope { … };
PtraceScope GetPtraceScope() { … }
bool HaveCapSysPtrace() { … }
bool SendMessageToClient(
int client_sock,
ExceptionHandlerProtocol::ServerToClientMessage::Type type) { … }
int tgkill(pid_t pid, pid_t tid, int signo) { … }
void SendSIGCONT(pid_t pid, pid_t tid) { … }
bool SendCredentials(int client_sock) { … }
class PtraceStrategyDeciderImpl : public PtraceStrategyDecider { … };
}
ExceptionHandlerServer::ExceptionHandlerServer()
: … { … }
ExceptionHandlerServer::~ExceptionHandlerServer() = default;
void ExceptionHandlerServer::SetPtraceStrategyDecider(
std::unique_ptr<PtraceStrategyDecider> decider) { … }
bool ExceptionHandlerServer::InitializeWithClient(ScopedFileHandle sock,
bool multiple_clients) { … }
void ExceptionHandlerServer::Run(Delegate* delegate) { … }
void ExceptionHandlerServer::Stop() { … }
void ExceptionHandlerServer::HandleEvent(Event* event, uint32_t event_type) { … }
bool ExceptionHandlerServer::InstallClientSocket(ScopedFileHandle socket,
Event::Type type) { … }
bool ExceptionHandlerServer::UninstallClientSocket(Event* event) { … }
bool ExceptionHandlerServer::ReceiveClientMessage(Event* event) { … }
bool ExceptionHandlerServer::HandleCrashDumpRequest(
const ucred& creds,
const ExceptionHandlerProtocol::ClientInformation& client_info,
VMAddress requesting_thread_stack_address,
int client_sock,
bool multiple_clients) { … }
}