#include "sanitizer_platform.h"
#if SANITIZER_POSIX
#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_platform_limits_netbsd.h"
#include "sanitizer_platform_limits_posix.h"
#include "sanitizer_platform_limits_solaris.h"
#include "sanitizer_posix.h"
#include "sanitizer_procmaps.h"
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#if SANITIZER_FREEBSD
#undef MAP_NORESERVE
#define MAP_NORESERVE …
#endif
sa_sigaction_t;
namespace __sanitizer {
u32 GetUid() { … }
uptr GetThreadSelf() { … }
void ReleaseMemoryPagesToOS(uptr beg, uptr end) { … }
void SetShadowRegionHugePageMode(uptr addr, uptr size) { … }
bool DontDumpShadowMemory(uptr addr, uptr length) { … }
static rlim_t getlim(int res) { … }
static void setlim(int res, rlim_t lim) { … }
void DisableCoreDumperIfNecessary() { … }
bool StackSizeIsUnlimited() { … }
void SetStackSizeLimitInBytes(uptr limit) { … }
bool AddressSpaceIsUnlimited() { … }
void SetAddressSpaceUnlimited() { … }
void Abort() { … }
int Atexit(void (*function)(void)) { … }
bool CreateDir(const char *pathname) { … }
bool SupportsColoredOutput(fd_t fd) { … }
#if !SANITIZER_GO
static uptr GetAltStackSize() { … }
void SetAlternateSignalStack() { … }
void UnsetAlternateSignalStack() { … }
static void MaybeInstallSigaction(int signum,
SignalHandlerType handler) { … }
void InstallDeadlySignalHandlers(SignalHandlerType handler) { … }
bool SignalContext::IsStackOverflow() const { … }
#endif
bool IsAccessibleMemoryRange(uptr beg, uptr size) { … }
void PlatformPrepareForSandboxing(void *args) { … }
static bool MmapFixed(uptr fixed_addr, uptr size, int additional_flags,
const char *name) { … }
bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name) { … }
bool MmapFixedSuperNoReserve(uptr fixed_addr, uptr size, const char *name) { … }
uptr ReservedAddressRange::Init(uptr size, const char *name, uptr fixed_addr) { … }
uptr ReservedAddressRange::Map(uptr fixed_addr, uptr size, const char *name) { … }
uptr ReservedAddressRange::MapOrDie(uptr fixed_addr, uptr size,
const char *name) { … }
void ReservedAddressRange::Unmap(uptr addr, uptr size) { … }
void *MmapFixedNoAccess(uptr fixed_addr, uptr size, const char *name) { … }
void *MmapNoAccess(uptr size) { … }
extern "C" {
SANITIZER_WEAK_ATTRIBUTE int
real_pthread_attr_getstack(void *attr, void **addr, size_t *size);
}
int internal_pthread_attr_getstack(void *attr, void **addr, uptr *size) { … }
#if !SANITIZER_GO
void AdjustStackSize(void *attr_) { … }
#endif
pid_t StartSubprocess(const char *program, const char *const argv[],
const char *const envp[], fd_t stdin_fd, fd_t stdout_fd,
fd_t stderr_fd) { … }
bool IsProcessRunning(pid_t pid) { … }
int WaitForProcess(pid_t pid) { … }
bool IsStateDetached(int state) { … }
}
#endif