#if defined(__linux__) || defined(__APPLE__)
#undef _FILE_OFFSET_BITS
#undef _TIME_BITS
#endif
#include "sanitizer_platform.h"
#if SANITIZER_LINUX || SANITIZER_APPLE
#include "sanitizer_glibc_version.h"
#include <arpa/inet.h>
#include <dirent.h>
#include <grp.h>
#include <limits.h>
#include <net/if.h>
#include <netdb.h>
#include <poll.h>
#include <pthread.h>
#include <pwd.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <termios.h>
#include <time.h>
#include <wchar.h>
#include <regex.h>
#if !SANITIZER_APPLE
#include <utmp.h>
#endif
#if !SANITIZER_IOS
#include <net/route.h>
#endif
#if !SANITIZER_ANDROID
#include <sys/mount.h>
#include <sys/timeb.h>
#include <utmpx.h>
#endif
#if SANITIZER_LINUX
#include <malloc.h>
#include <mntent.h>
#include <netinet/ether.h>
#include <sys/sysinfo.h>
#include <sys/vt.h>
#include <linux/cdrom.h>
#include <linux/fd.h>
#if SANITIZER_ANDROID
#include <linux/fs.h>
#endif
#include <linux/hdreg.h>
#include <linux/input.h>
#include <linux/ioctl.h>
#include <linux/soundcard.h>
#include <linux/sysctl.h>
#include <linux/utsname.h>
#include <linux/posix_types.h>
#include <net/if_arp.h>
#endif
#if SANITIZER_IOS
#undef IOC_DIRMASK
#endif
#if SANITIZER_LINUX
# include <utime.h>
# include <sys/ptrace.h>
# if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
defined(__hexagon__) || defined(__loongarch__) || SANITIZER_RISCV64 || \
defined(__sparc__)
# include <asm/ptrace.h>
# ifdef __arm__
typedef struct user_fpregs elf_fpregset_t;
#define ARM_VFPREGS_SIZE_ASAN …
# if !defined(ARM_VFPREGS_SIZE)
#define ARM_VFPREGS_SIZE …
# endif
# endif
# endif
# include <semaphore.h>
#endif
#if !SANITIZER_ANDROID
#include <ifaddrs.h>
#include <sys/ucontext.h>
#include <wordexp.h>
#endif
#if SANITIZER_LINUX
#if SANITIZER_GLIBC
#include <fstab.h>
# include <linux/filter.h>
# include <net/if_ppp.h>
# include <netax25/ax25.h>
# include <netipx/ipx.h>
# include <netrom/netrom.h>
# include <obstack.h>
# if HAVE_RPC_XDR_H
# include <rpc/xdr.h>
# endif
# include <scsi/scsi.h>
#else
#include <linux/if_ppp.h>
#include <linux/kd.h>
#include <linux/ppp_defs.h>
#endif
#if SANITIZER_ANDROID
#include <linux/mtio.h>
#else
#include <glob.h>
#include <mqueue.h>
#include <sys/kd.h>
#include <sys/mtio.h>
#include <sys/shm.h>
#include <sys/statvfs.h>
#include <sys/timex.h>
#if defined(__mips64)
# include <sys/procfs.h>
#endif
#include <sys/user.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
#include <linux/scc.h>
#include <linux/serial.h>
#include <sys/msg.h>
#include <sys/ipc.h>
#endif
#include <link.h>
#include <sys/vfs.h>
#include <sys/epoll.h>
#include <linux/capability.h>
#else
#include <fstab.h>
#endif
#if SANITIZER_APPLE
#include <net/ethernet.h>
#include <sys/filio.h>
#include <sys/sockio.h>
#endif
# include "sanitizer_common.h"
# include "sanitizer_internal_defs.h"
# include "sanitizer_platform_interceptors.h"
# include "sanitizer_platform_limits_posix.h"
__sanitizer
usingnamespace__sanitizer;
COMPILER_CHECK(…);
COMPILER_CHECK(…);
CHECK_TYPE_SIZE(…) …;
#if SANITIZER_LINUX
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
COMPILER_CHECK(…);
#endif
#if SANITIZER_LINUX || SANITIZER_FREEBSD
COMPILER_CHECK(…);
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_GLIBC || SANITIZER_FREEBSD
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_GLIBC || SANITIZER_ANDROID
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_GLIBC || SANITIZER_ANDROID
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
#if SANITIZER_GLIBC || SANITIZER_ANDROID
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
COMPILER_CHECK(…);
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_APPLE
CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
#elif SANITIZER_FREEBSD
#else
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_GLIBC
COMPILER_CHECK(…);
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_TYPE_SIZE(…) …;
COMPILER_CHECK(…);
CHECK_STRUCT_SIZE_AND_OFFSET(…) …;
#if !defined(__s390x__) || __GLIBC_PREREQ (2, 20)
CHECK_STRUCT_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32)
CHECK_STRUCT_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_HAS_SIGINFO
COMPILER_CHECK(…);
__sanitizer_siginfo_t;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_LINUX
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_TYPE_SIZE(…) …;
#if SANITIZER_USES_UID16_SYSCALLS
CHECK_TYPE_SIZE(__kernel_old_uid_t);
CHECK_TYPE_SIZE(__kernel_old_gid_t);
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_TYPE_SIZE(…) …;
#endif
#if !SANITIZER_ANDROID
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_LINUX
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
#if SANITIZER_GLIBC || SANITIZER_FREEBSD
CHECK_TYPE_SIZE(…) …;
# if SANITIZER_FREEBSD
CHECK_SIZE_AND_OFFSET(ipc_perm, key);
CHECK_SIZE_AND_OFFSET(ipc_perm, seq);
# else
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
# endif
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
#if SANITIZER_LINUX
CHECK_TYPE_SIZE(…) …;
#endif
#if !SANITIZER_ANDROID
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if SANITIZER_LINUX || SANITIZER_FREEBSD
#ifdef ifa_dstaddr
#undef ifa_dstaddr
#endif
# if SANITIZER_FREEBSD
CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
# else
COMPILER_CHECK(…);
COMPILER_CHECK(…);
# endif
#else
CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
#endif
CHECK_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_GLIBC || SANITIZER_ANDROID
COMPILER_CHECK(…);
#endif
#if !SANITIZER_ANDROID
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if !SANITIZER_ANDROID
CHECK_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_APPLE
CHECK_SIZE_AND_OFFSET(passwd, pw_change);
CHECK_SIZE_AND_OFFSET(passwd, pw_expire);
CHECK_SIZE_AND_OFFSET(passwd, pw_class);
#endif
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#if HAVE_RPC_XDR_H && !SANITIZER_APPLE
CHECK_TYPE_SIZE(XDR);
CHECK_SIZE_AND_OFFSET(XDR, x_op);
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
CHECK_SIZE_AND_OFFSET(XDR, x_public);
CHECK_SIZE_AND_OFFSET(XDR, x_private);
CHECK_SIZE_AND_OFFSET(XDR, x_base);
CHECK_SIZE_AND_OFFSET(XDR, x_handy);
COMPILER_CHECK(__sanitizer_XDR_ENCODE == XDR_ENCODE);
COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
#endif
#if SANITIZER_GLIBC
COMPILER_CHECK(…);
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
COMPILER_CHECK(…);
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_TYPE_SIZE(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
CHECK_SIZE_AND_OFFSET(…) …;
#endif
#if SANITIZER_LINUX || SANITIZER_FREEBSD
CHECK_TYPE_SIZE(…) …;
#endif
#if SANITIZER_LINUX && defined(__arm__)
COMPILER_CHECK(ARM_VFPREGS_SIZE == ARM_VFPREGS_SIZE_ASAN);
#endif
#endif