#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "sandbox/linux/seccomp-bpf/trap.h"
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/syscall.h>
#include <algorithm>
#include <atomic>
#include <limits>
#include <tuple>
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "build/build_config.h"
#include "sandbox/linux/bpf_dsl/seccomp_macros.h"
#include "sandbox/linux/seccomp-bpf/die.h"
#include "sandbox/linux/seccomp-bpf/syscall.h"
#include "sandbox/linux/services/syscall_wrappers.h"
#include "sandbox/linux/system_headers/linux_seccomp.h"
#include "sandbox/linux/system_headers/linux_signal.h"
namespace {
struct arch_sigsys { … };
const int kCapacityIncrement = …;
const char kSandboxDebuggingEnv[] = …;
bool GetIsInSigHandler(const ucontext_t* ctx) { … }
void SetIsInSigHandler() { … }
bool IsDefaultSignalAction(const struct sigaction& sa) { … }
}
namespace sandbox {
Trap::Trap() { … }
bpf_dsl::TrapRegistry* Trap::Registry() { … }
void Trap::SigSysAction(int nr, LinuxSigInfo* info, void* void_context) { … }
void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) { … }
uint16_t Trap::Add(const Handler& handler) { … }
bool Trap::SandboxDebuggingAllowedByUser() { … }
bool Trap::EnableUnsafeTraps() { … }
Trap* Trap::global_trap_;
}