#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "sandbox/linux/services/credentials.h"
#include <errno.h>
#include <limits.h>
#include <sched.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/launch.h"
#include "build/build_config.h"
#include "sandbox/linux/services/namespace_utils.h"
#include "sandbox/linux/services/proc_util.h"
#include "sandbox/linux/services/syscall_wrappers.h"
#include "sandbox/linux/services/thread_helpers.h"
#include "sandbox/linux/system_headers/capability.h"
#include "sandbox/linux/system_headers/linux_signal.h"
namespace sandbox {
namespace {
const int kExitSuccess = …;
#if !defined(THREAD_SANITIZER)
const int kExitFailure = …;
#endif
#if defined(__clang__)
__attribute__((no_sanitize_address))
__attribute__((no_sanitize_thread))
__attribute__((no_sanitize_memory))
#endif
int ChrootToSelfFdinfo(void*) { … }
bool ChrootToSafeEmptyDir() { … }
void CheckCloneNewUserErrno(int error) { … }
int CapabilityToKernelValue(Credentials::Capability cap) { … }
}
bool Credentials::GetRESIds(uid_t* resuid, gid_t* resgid) { … }
bool Credentials::SetGidAndUidMaps(gid_t gid, uid_t uid) { … }
bool Credentials::DropAllCapabilities(int proc_fd) { … }
bool Credentials::DropAllCapabilities() { … }
bool Credentials::DropAllCapabilitiesOnCurrentThread() { … }
bool Credentials::SetCapabilitiesOnCurrentThread(
const std::vector<Capability>& caps) { … }
bool Credentials::SetCapabilities(int proc_fd,
const std::vector<Capability>& caps) { … }
bool Credentials::HasAnyCapability() { … }
bool Credentials::HasCapability(Capability cap) { … }
bool Credentials::CanCreateProcessInNewUserNS() { … }
bool Credentials::MoveToNewUserNS() { … }
bool Credentials::DropFileSystemAccess(int proc_fd) { … }
bool Credentials::HasFileSystemAccess() { … }
pid_t Credentials::ForkAndDropCapabilitiesInChild() { … }
}