llvm/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

//===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines macro telling whether sanitizer tools can/should intercept
// given library functions on a given platform.
//
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
#define SANITIZER_PLATFORM_INTERCEPTORS_H

#include "sanitizer_glibc_version.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform.h"

#if SANITIZER_POSIX
#define SI_POSIX
#else
#define SI_POSIX
#endif

#if !SANITIZER_WINDOWS
#define SI_WINDOWS
#else
#define SI_WINDOWS
#endif

#if SI_WINDOWS && SI_POSIX
#error "Windows is not POSIX!"
#endif

#if SI_POSIX
#include "sanitizer_platform_limits_freebsd.h"
#include "sanitizer_platform_limits_netbsd.h"
#include "sanitizer_platform_limits_posix.h"
#include "sanitizer_platform_limits_solaris.h"
#endif

#if SANITIZER_LINUX && !SANITIZER_ANDROID
#define SI_LINUX_NOT_ANDROID
#else
#define SI_LINUX_NOT_ANDROID
#endif

#if SANITIZER_GLIBC
#define SI_GLIBC
#else
#define SI_GLIBC
#endif

#if SANITIZER_ANDROID
#define SI_ANDROID
#else
#define SI_ANDROID
#endif

#if SANITIZER_FREEBSD
#define SI_FREEBSD
#else
#define SI_FREEBSD
#endif

#if SANITIZER_NETBSD
#define SI_NETBSD
#else
#define SI_NETBSD
#endif

#if SANITIZER_LINUX
#define SI_LINUX
#else
#define SI_LINUX
#endif

#if SANITIZER_APPLE
#define SI_MAC
#define SI_NOT_MAC
#else
#define SI_MAC
#define SI_NOT_MAC
#endif

#if SANITIZER_IOS
#define SI_IOS
#else
#define SI_IOS
#endif

#if SANITIZER_IOSSIM
#define SI_IOSSIM
#else
#define SI_IOSSIM
#endif

#if SANITIZER_WATCHOS
#define SI_WATCHOS
#else
#define SI_WATCHOS
#endif

#if SANITIZER_TVOS
#define SI_TVOS
#else
#define SI_TVOS
#endif

#if SANITIZER_FUCHSIA
#define SI_NOT_FUCHSIA
#else
#define SI_NOT_FUCHSIA
#endif

#if SANITIZER_SOLARIS
#define SI_SOLARIS
#else
#define SI_SOLARIS
#endif

#if SANITIZER_SOLARIS32
#define SI_SOLARIS32
#else
#define SI_SOLARIS32
#endif

#if SANITIZER_POSIX && !SANITIZER_APPLE
#define SI_POSIX_NOT_MAC
#else
#define SI_POSIX_NOT_MAC
#endif

#if SANITIZER_LINUX && !SANITIZER_FREEBSD
#define SI_LINUX_NOT_FREEBSD
#else
#define SI_LINUX_NOT_FREEBSD
#endif

#define SANITIZER_INTERCEPT_STRLEN
#define SANITIZER_INTERCEPT_STRNLEN
#define SANITIZER_INTERCEPT_STRCMP
#define SANITIZER_INTERCEPT_STRSTR
#define SANITIZER_INTERCEPT_STRCASESTR
#define SANITIZER_INTERCEPT_STRTOK
#define SANITIZER_INTERCEPT_STRCHR
#define SANITIZER_INTERCEPT_STRCHRNUL
#define SANITIZER_INTERCEPT_STRRCHR
#define SANITIZER_INTERCEPT_STRSPN
#define SANITIZER_INTERCEPT_STRPBRK
#define SANITIZER_INTERCEPT_TEXTDOMAIN
#define SANITIZER_INTERCEPT_STRCASECMP
#define SANITIZER_INTERCEPT_MEMSET
#define SANITIZER_INTERCEPT_MEMMOVE
#define SANITIZER_INTERCEPT_MEMCPY
#define SANITIZER_INTERCEPT_MEMCMP
#define SANITIZER_INTERCEPT_BCMP
#define SANITIZER_INTERCEPT_STRNDUP
#define SANITIZER_INTERCEPT___STRNDUP
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
#define SI_MAC_DEPLOYMENT_BELOW_10_7
#else
#define SI_MAC_DEPLOYMENT_BELOW_10_7
#endif
// memmem on Darwin doesn't exist on 10.6
// FIXME: enable memmem on Windows.
#define SANITIZER_INTERCEPT_MEMMEM
#define SANITIZER_INTERCEPT_MEMCHR
#define SANITIZER_INTERCEPT_MEMRCHR

#define SANITIZER_INTERCEPT_READ
#define SANITIZER_INTERCEPT_PREAD
#define SANITIZER_INTERCEPT_WRITE
#define SANITIZER_INTERCEPT_PWRITE

#define SANITIZER_INTERCEPT_FREAD
#define SANITIZER_INTERCEPT_FWRITE
#define SANITIZER_INTERCEPT_FGETS
#define SANITIZER_INTERCEPT_FPUTS
#define SANITIZER_INTERCEPT_PUTS

#define SANITIZER_INTERCEPT_CREAT64
#define SANITIZER_INTERCEPT_FCNTL64
#define SANITIZER_INTERCEPT_OPEN64
#define SANITIZER_INTERCEPT_OPENAT64

#define SANITIZER_INTERCEPT_PREAD64
#define SANITIZER_INTERCEPT_PWRITE64

#define SANITIZER_INTERCEPT_READV
#define SANITIZER_INTERCEPT_WRITEV

#define SANITIZER_INTERCEPT_PREADV
#define SANITIZER_INTERCEPT_PWRITEV
#define SANITIZER_INTERCEPT_PREADV64
#define SANITIZER_INTERCEPT_PWRITEV64

#define SANITIZER_INTERCEPT_PRCTL

#define SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS
#define SANITIZER_INTERCEPT_STRPTIME

#define SANITIZER_INTERCEPT_SCANF
#define SANITIZER_INTERCEPT_ISOC99_SCANF

#ifndef SANITIZER_INTERCEPT_PRINTF
#define SANITIZER_INTERCEPT_PRINTF
#define SANITIZER_INTERCEPT_PRINTF_L
#define SANITIZER_INTERCEPT_ISOC99_PRINTF
#endif

#define SANITIZER_INTERCEPT___PRINTF_CHK

#define SANITIZER_INTERCEPT_FREXP
#define SANITIZER_INTERCEPT_FREXPF_FREXPL

#define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS
#define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS
#define SANITIZER_INTERCEPT_GETPWENT
#define SANITIZER_INTERCEPT_FGETGRENT_R
#define SANITIZER_INTERCEPT_FGETPWENT
#define SANITIZER_INTERCEPT_GETPWENT_R
#define SANITIZER_INTERCEPT_FGETPWENT_R
#define SANITIZER_INTERCEPT_SETPWENT
#define SANITIZER_INTERCEPT_CLOCK_GETTIME
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID
#define SANITIZER_INTERCEPT_GETITIMER
#define SANITIZER_INTERCEPT_TIME
#define SANITIZER_INTERCEPT_GLOB
#define SANITIZER_INTERCEPT_GLOB64
#define SANITIZER_INTERCEPT___B64_TO
#define SANITIZER_INTERCEPT_DN_COMP_EXPAND
#define SANITIZER_INTERCEPT_POSIX_SPAWN
#define SANITIZER_INTERCEPT_WAIT
#define SANITIZER_INTERCEPT_INET
#define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM
#define SANITIZER_INTERCEPT_GETADDRINFO
#define SANITIZER_INTERCEPT_GETNAMEINFO
#define SANITIZER_INTERCEPT_GETSOCKNAME
#define SANITIZER_INTERCEPT_GETHOSTBYNAME
#define SANITIZER_INTERCEPT_GETHOSTBYNAME2
#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R
#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R
#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R
#define SANITIZER_INTERCEPT_GETHOSTENT_R
#define SANITIZER_INTERCEPT_GETSOCKOPT
#define SANITIZER_INTERCEPT_ACCEPT
#define SANITIZER_INTERCEPT_ACCEPT4
#define SANITIZER_INTERCEPT_PACCEPT
#define SANITIZER_INTERCEPT_MODF
#define SANITIZER_INTERCEPT_RECVMSG
#define SANITIZER_INTERCEPT_SENDMSG
#define SANITIZER_INTERCEPT_RECVMMSG
#define SANITIZER_INTERCEPT_SENDMMSG
#define SANITIZER_INTERCEPT_SYSMSG
#define SANITIZER_INTERCEPT_GETPEERNAME
#define SANITIZER_INTERCEPT_IOCTL
#define SANITIZER_INTERCEPT_INET_ATON
#define SANITIZER_INTERCEPT_SYSINFO
#define SANITIZER_INTERCEPT_READDIR
#define SANITIZER_INTERCEPT_READDIR64
#if SI_LINUX_NOT_ANDROID &&                                                \
    (defined(__i386) || defined(__x86_64) || defined(__mips64) ||          \
     defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
     defined(__s390__) || defined(__loongarch__) || SANITIZER_RISCV64 ||   \
     defined(__sparc__))
#define SANITIZER_INTERCEPT_PTRACE
#else
#define SANITIZER_INTERCEPT_PTRACE
#endif
#define SANITIZER_INTERCEPT_SETLOCALE
#define SANITIZER_INTERCEPT_GETCWD
#define SANITIZER_INTERCEPT_GET_CURRENT_DIR_NAME
#define SANITIZER_INTERCEPT_STRTOIMAX
#define SANITIZER_INTERCEPT_MBSTOWCS
#define SANITIZER_INTERCEPT_MBSNRTOWCS
#define SANITIZER_INTERCEPT_WCSTOMBS
#define SANITIZER_INTERCEPT_STRXFRM
#define SANITIZER_INTERCEPT___STRXFRM_L
#define SANITIZER_INTERCEPT_WCSXFRM
#define SANITIZER_INTERCEPT___WCSXFRM_L
#define SANITIZER_INTERCEPT_WCSNRTOMBS
#define SANITIZER_INTERCEPT_WCRTOMB
#define SANITIZER_INTERCEPT_WCTOMB
#define SANITIZER_INTERCEPT_TCGETATTR
#define SANITIZER_INTERCEPT_REALPATH
#define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME
#define SANITIZER_INTERCEPT_CONFSTR
#define SANITIZER_INTERCEPT_SCHED_GETAFFINITY
#define SANITIZER_INTERCEPT_SCHED_GETPARAM
#define SANITIZER_INTERCEPT_STRERROR
#define SANITIZER_INTERCEPT_STRERROR_R
#define SANITIZER_INTERCEPT_XPG_STRERROR_R
#define SANITIZER_INTERCEPT_SCANDIR
#define SANITIZER_INTERCEPT_SCANDIR64
#define SANITIZER_INTERCEPT_GETGROUPS
#define SANITIZER_INTERCEPT_POLL
#define SANITIZER_INTERCEPT_PPOLL
#define SANITIZER_INTERCEPT_WORDEXP
#define SANITIZER_INTERCEPT_SIGWAIT
#define SANITIZER_INTERCEPT_SIGWAITINFO
#define SANITIZER_INTERCEPT_SIGTIMEDWAIT
#define SANITIZER_INTERCEPT_SIGSETOPS
#define SANITIZER_INTERCEPT_SIGSET_LOGICOPS
#define SANITIZER_INTERCEPT_SIGPENDING
#define SANITIZER_INTERCEPT_SIGPROCMASK
#define SANITIZER_INTERCEPT_PTHREAD_SIGMASK
#define SANITIZER_INTERCEPT_BACKTRACE
#define SANITIZER_INTERCEPT_GETMNTENT
#define SANITIZER_INTERCEPT_GETMNTENT_R
#define SANITIZER_INTERCEPT_STATFS
#define SANITIZER_INTERCEPT_STATFS64
#define SANITIZER_INTERCEPT_STATVFS
#define SANITIZER_INTERCEPT_STATVFS64
#define SANITIZER_INTERCEPT_INITGROUPS
#define SANITIZER_INTERCEPT_ETHER_NTOA_ATON
#define SANITIZER_INTERCEPT_ETHER_HOST
#define SANITIZER_INTERCEPT_ETHER_R
#define SANITIZER_INTERCEPT_SHMCTL
#define SANITIZER_INTERCEPT_RANDOM_R
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP
#define SANITIZER_INTERCEPT_PTHREAD_GETAFFINITY_NP
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET_SCHED
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETTYPE
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPROTOCOL
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPRIOCEILING
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETKIND_NP
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETPSHARED
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETCLOCK
#define SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GETPSHARED
#define SANITIZER_INTERCEPT_TRYJOIN
#define SANITIZER_INTERCEPT_TIMEDJOIN
#define SANITIZER_INTERCEPT_THR_EXIT
#define SANITIZER_INTERCEPT_TMPNAM
#define SANITIZER_INTERCEPT_TMPNAM_R
#define SANITIZER_INTERCEPT_PTSNAME
#define SANITIZER_INTERCEPT_PTSNAME_R
#define SANITIZER_INTERCEPT_TTYNAME
#define SANITIZER_INTERCEPT_TTYNAME_R
#define SANITIZER_INTERCEPT_TEMPNAM
#define SANITIZER_INTERCEPT_SINCOS
#define SANITIZER_INTERCEPT_REMQUO
#define SANITIZER_INTERCEPT_REMQUOL
#define SANITIZER_INTERCEPT_LGAMMA
#define SANITIZER_INTERCEPT_LGAMMAL
#define SANITIZER_INTERCEPT_LGAMMA_R
#define SANITIZER_INTERCEPT_LGAMMAL_R
#define SANITIZER_INTERCEPT_DRAND48_R
#define SANITIZER_INTERCEPT_RAND_R
#define SANITIZER_INTERCEPT_ICONV
#define SANITIZER_INTERCEPT_TIMES

// FIXME: getline seems to be available on OSX 10.7
#define SANITIZER_INTERCEPT_GETLINE

#define SANITIZER_INTERCEPT__EXIT

#define SANITIZER_INTERCEPT___LIBC_MUTEX
#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP
#define SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP

#define SANITIZER_INTERCEPT_TLS_GET_ADDR

#define SANITIZER_INTERCEPT_LISTXATTR
#define SANITIZER_INTERCEPT_GETXATTR
#define SANITIZER_INTERCEPT_GETRESID
#define SANITIZER_INTERCEPT_GETIFADDRS
#define SANITIZER_INTERCEPT_IF_INDEXTONAME
#define SANITIZER_INTERCEPT_CAPGET
#if SI_LINUX && defined(__arm__)
#define SANITIZER_INTERCEPT_AEABI_MEM
#else
#define SANITIZER_INTERCEPT_AEABI_MEM
#endif
#define SANITIZER_INTERCEPT___BZERO
#define SANITIZER_INTERCEPT_BZERO
#define SANITIZER_INTERCEPT_FTIME
#define SANITIZER_INTERCEPT_XDR
#define SANITIZER_INTERCEPT_XDRREC
#define SANITIZER_INTERCEPT_TSEARCH
#define SANITIZER_INTERCEPT_LIBIO_INTERNALS
#define SANITIZER_INTERCEPT_FOPEN
#define SANITIZER_INTERCEPT_FOPEN64
#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM
#define SANITIZER_INTERCEPT_OBSTACK
#define SANITIZER_INTERCEPT_FFLUSH
#define SANITIZER_INTERCEPT_FCLOSE

#ifndef SANITIZER_INTERCEPT_DLOPEN_DLCLOSE
#define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE
#endif

#define SANITIZER_INTERCEPT_GETPASS
#define SANITIZER_INTERCEPT_TIMERFD

#define SANITIZER_INTERCEPT_MLOCKX
#define SANITIZER_INTERCEPT_FOPENCOOKIE
#define SANITIZER_INTERCEPT_SEM
#define SANITIZER_INTERCEPT_PTHREAD_SETCANCEL
#define SANITIZER_INTERCEPT_MINCORE
#define SANITIZER_INTERCEPT_PROCESS_VM_READV
#define SANITIZER_INTERCEPT_CTERMID
#define SANITIZER_INTERCEPT_CTERMID_R

#define SANITIZER_INTERCEPTOR_HOOKS
#define SANITIZER_INTERCEPT_RECV_RECVFROM
#define SANITIZER_INTERCEPT_SEND_SENDTO
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE

#define SI_STAT_LINUX
#define SANITIZER_INTERCEPT_STAT
#define SANITIZER_INTERCEPT_STAT64
#define SANITIZER_INTERCEPT_LSTAT
#define SANITIZER_INTERCEPT___XSTAT
#define SANITIZER_INTERCEPT___XSTAT64
#define SANITIZER_INTERCEPT___LXSTAT
#define SANITIZER_INTERCEPT___LXSTAT64

#define SANITIZER_INTERCEPT_UTMP
#define SANITIZER_INTERCEPT_UTMPX

#define SANITIZER_INTERCEPT_GETLOADAVG

#define SANITIZER_INTERCEPT_MMAP
#define SANITIZER_INTERCEPT_MMAP64
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
#define SANITIZER_INTERCEPT_MEMALIGN
#define SANITIZER_INTERCEPT___LIBC_MEMALIGN
#define SANITIZER_INTERCEPT_PVALLOC
#define SANITIZER_INTERCEPT_CFREE
#define SANITIZER_INTERCEPT_REALLOCARRAY
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE
#define SANITIZER_INTERCEPT_MCHECK_MPROBE
#define SANITIZER_INTERCEPT_WCSLEN
#define SANITIZER_INTERCEPT_WCSCAT
#define SANITIZER_INTERCEPT_WCSDUP
#define SANITIZER_INTERCEPT_SIGNAL_AND_SIGACTION
#define SANITIZER_INTERCEPT_BSD_SIGNAL

#define SANITIZER_INTERCEPT_ACCT
#define SANITIZER_INTERCEPT_USER_FROM_UID
#define SANITIZER_INTERCEPT_UID_FROM_USER
#define SANITIZER_INTERCEPT_GROUP_FROM_GID
#define SANITIZER_INTERCEPT_GID_FROM_GROUP
#define SANITIZER_INTERCEPT_ACCESS
#define SANITIZER_INTERCEPT_FACCESSAT
#define SANITIZER_INTERCEPT_GETGROUPLIST
#define SANITIZER_INTERCEPT_STRLCPY

#define SANITIZER_INTERCEPT_NAME_TO_HANDLE_AT
#define SANITIZER_INTERCEPT_OPEN_BY_HANDLE_AT

#define SANITIZER_INTERCEPT_READLINK
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101000
#define SI_MAC_DEPLOYMENT_BELOW_10_10
#else
#define SI_MAC_DEPLOYMENT_BELOW_10_10
#endif
#define SANITIZER_INTERCEPT_READLINKAT

#define SANITIZER_INTERCEPT_DEVNAME
#define SANITIZER_INTERCEPT_DEVNAME_R
#define SANITIZER_INTERCEPT_FGETLN
#define SANITIZER_INTERCEPT_STRMODE
#define SANITIZER_INTERCEPT_TTYENT
#define SANITIZER_INTERCEPT_TTYENTPATH
#define SANITIZER_INTERCEPT_PROTOENT
#define SANITIZER_INTERCEPT_PROTOENT_R
#define SANITIZER_INTERCEPT_NETENT
#define SANITIZER_INTERCEPT_SETVBUF
#define SANITIZER_INTERCEPT_GETMNTINFO
#define SANITIZER_INTERCEPT_MI_VECTOR_HASH
#define SANITIZER_INTERCEPT_GETVFSSTAT
#define SANITIZER_INTERCEPT_REGEX
#define SANITIZER_INTERCEPT_REGEXSUB
#define SANITIZER_INTERCEPT_FTS
#define SANITIZER_INTERCEPT_SYSCTL
#define SANITIZER_INTERCEPT_ASYSCTL
#define SANITIZER_INTERCEPT_SYSCTLGETMIBINFO
#define SANITIZER_INTERCEPT_NL_LANGINFO
#define SANITIZER_INTERCEPT_MODCTL
#define SANITIZER_INTERCEPT_CAPSICUM
#define SANITIZER_INTERCEPT_STRTONUM
#define SANITIZER_INTERCEPT_FPARSELN
#define SANITIZER_INTERCEPT_STATVFS1
#define SANITIZER_INTERCEPT_STRTOI
#define SANITIZER_INTERCEPT_CAPSICUM
#define SANITIZER_INTERCEPT_SHA1
#define SANITIZER_INTERCEPT_MD4
#define SANITIZER_INTERCEPT_RMD160
#define SANITIZER_INTERCEPT_MD5
#define SANITIZER_INTERCEPT_FSEEK
#define SANITIZER_INTERCEPT_MD2
#define SANITIZER_INTERCEPT_SHA2
#define SANITIZER_INTERCEPT_CDB
#define SANITIZER_INTERCEPT_VIS
#define SANITIZER_INTERCEPT_POPEN
#define SANITIZER_INTERCEPT_POPENVE
#define SANITIZER_INTERCEPT_PCLOSE
#define SANITIZER_INTERCEPT_FUNOPEN
#define SANITIZER_INTERCEPT_FUNOPEN2
#define SANITIZER_INTERCEPT_GETFSENT
#define SANITIZER_INTERCEPT_ARC4RANDOM
#define SANITIZER_INTERCEPT_FDEVNAME
#define SANITIZER_INTERCEPT_GETUSERSHELL
#define SANITIZER_INTERCEPT_SL_INIT

#define SANITIZER_INTERCEPT_GETRANDOM
#define SANITIZER_INTERCEPT___CXA_ATEXIT
#define SANITIZER_INTERCEPT_ATEXIT
#define SANITIZER_INTERCEPT_PTHREAD_ATFORK
#define SANITIZER_INTERCEPT_GETENTROPY
#define SANITIZER_INTERCEPT_QSORT
#define SANITIZER_INTERCEPT_QSORT_R
#define SANITIZER_INTERCEPT_BSEARCH
// sigaltstack on i386 macOS cannot be intercepted due to setjmp()
// calling it and assuming that it does not clobber registers.
#define SANITIZER_INTERCEPT_SIGALTSTACK
#define SANITIZER_INTERCEPT_UNAME
#define SANITIZER_INTERCEPT___XUNAME
#define SANITIZER_INTERCEPT_FLOPEN
#define SANITIZER_INTERCEPT_PROCCTL
#define SANITIZER_INTERCEPT_ARGP_PARSE
#define SANITIZER_INTERCEPT_CPUSET_GETAFFINITY
// FIXME: also available from musl 1.2.5
#define SANITIZER_INTERCEPT_PREADV2
#define SANITIZER_INTERCEPT_PWRITEV2

// This macro gives a way for downstream users to override the above
// interceptor macros irrespective of the platform they are on. They have
// to do two things:
// 1. Build compiler-rt with -DSANITIZER_OVERRIDE_INTERCEPTORS.
// 2. Provide a header file named sanitizer_intercept_overriders.h in the
//    include path for their compiler-rt build.
// An example of an overrider for strlen interceptor that one can list in
// sanitizer_intercept_overriders.h is as follows:
//
// #ifdef SANITIZER_INTERCEPT_STRLEN
// #undef SANITIZER_INTERCEPT_STRLEN
// #define SANITIZER_INTERCEPT_STRLEN <value of choice>
// #endif
//
// This "feature" is useful for downstream users who do not want some of
// their libc funtions to be intercepted. They can selectively disable
// interception of those functions.
#ifdef SANITIZER_OVERRIDE_INTERCEPTORS
#include <sanitizer_intercept_overriders.h>
#endif

#endif  // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H