forked from OSchip/llvm-project
Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"
This reverts commit b7718b6175
, because it
is causing build failures on all 32-bit ARM bots which build
compiler-rt.
This commit is contained in:
parent
e49dc2981c
commit
4839378ca0
|
@ -583,7 +583,6 @@ macro(add_custom_libcxx name prefix)
|
||||||
CMAKE_OBJDUMP
|
CMAKE_OBJDUMP
|
||||||
CMAKE_STRIP
|
CMAKE_STRIP
|
||||||
CMAKE_SYSROOT
|
CMAKE_SYSROOT
|
||||||
LIBCXX_HAS_MUSL_LIBC
|
|
||||||
PYTHON_EXECUTABLE
|
PYTHON_EXECUTABLE
|
||||||
Python3_EXECUTABLE
|
Python3_EXECUTABLE
|
||||||
Python2_EXECUTABLE
|
Python2_EXECUTABLE
|
||||||
|
|
|
@ -60,7 +60,7 @@ void InitializePlatformInterceptors();
|
||||||
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0
|
# define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC || SANITIZER_SOLARIS
|
#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_SOLARIS
|
||||||
# define ASAN_INTERCEPT_SWAPCONTEXT 1
|
# define ASAN_INTERCEPT_SWAPCONTEXT 1
|
||||||
#else
|
#else
|
||||||
# define ASAN_INTERCEPT_SWAPCONTEXT 0
|
# define ASAN_INTERCEPT_SWAPCONTEXT 0
|
||||||
|
@ -72,7 +72,7 @@ void InitializePlatformInterceptors();
|
||||||
# define ASAN_INTERCEPT_SIGLONGJMP 0
|
# define ASAN_INTERCEPT_SIGLONGJMP 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
# define ASAN_INTERCEPT___LONGJMP_CHK 1
|
# define ASAN_INTERCEPT___LONGJMP_CHK 1
|
||||||
#else
|
#else
|
||||||
# define ASAN_INTERCEPT___LONGJMP_CHK 0
|
# define ASAN_INTERCEPT___LONGJMP_CHK 0
|
||||||
|
@ -106,7 +106,7 @@ void InitializePlatformInterceptors();
|
||||||
# define ASAN_INTERCEPT_ATEXIT 0
|
# define ASAN_INTERCEPT_ATEXIT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
# define ASAN_INTERCEPT___STRDUP 1
|
# define ASAN_INTERCEPT___STRDUP 1
|
||||||
#else
|
#else
|
||||||
# define ASAN_INTERCEPT___STRDUP 0
|
# define ASAN_INTERCEPT___STRDUP 0
|
||||||
|
|
|
@ -804,7 +804,7 @@ char* MallocAndMemsetString(size_t size) {
|
||||||
return MallocAndMemsetString(size, 'z');
|
return MallocAndMemsetString(size, 'z');
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if defined(__linux__) && !defined(__ANDROID__)
|
||||||
#define READ_TEST(READ_N_BYTES) \
|
#define READ_TEST(READ_N_BYTES) \
|
||||||
char *x = new char[10]; \
|
char *x = new char[10]; \
|
||||||
int fd = open("/proc/self/stat", O_RDONLY); \
|
int fd = open("/proc/self/stat", O_RDONLY); \
|
||||||
|
@ -827,7 +827,7 @@ TEST(AddressSanitizer, pread64) {
|
||||||
TEST(AddressSanitizer, read) {
|
TEST(AddressSanitizer, read) {
|
||||||
READ_TEST(read(fd, x, 15));
|
READ_TEST(read(fd, x, 15));
|
||||||
}
|
}
|
||||||
#endif // SANITIZER_GLIBC
|
#endif // defined(__linux__) && !defined(__ANDROID__)
|
||||||
|
|
||||||
// This test case fails
|
// This test case fails
|
||||||
// Clang optimizes memcpy/memset calls which lead to unaligned access
|
// Clang optimizes memcpy/memset calls which lead to unaligned access
|
||||||
|
|
|
@ -63,8 +63,8 @@ bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func,
|
||||||
return addr && (func == wrapper);
|
return addr && (func == wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dlvsym is a GNU extension supported by some other platforms.
|
// Android and Solaris do not have dlvsym
|
||||||
#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
|
#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
||||||
static void *GetFuncAddr(const char *name, const char *ver) {
|
static void *GetFuncAddr(const char *name, const char *ver) {
|
||||||
return dlvsym(RTLD_NEXT, name, ver);
|
return dlvsym(RTLD_NEXT, name, ver);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
|
||||||
*ptr_to_real = (uptr)addr;
|
*ptr_to_real = (uptr)addr;
|
||||||
return addr && (func == wrapper);
|
return addr && (func == wrapper);
|
||||||
}
|
}
|
||||||
#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
|
#endif // !SANITIZER_ANDROID
|
||||||
|
|
||||||
} // namespace __interception
|
} // namespace __interception
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
|
||||||
(::__interception::uptr) & (func), \
|
(::__interception::uptr) & (func), \
|
||||||
(::__interception::uptr) & WRAP(func))
|
(::__interception::uptr) & WRAP(func))
|
||||||
|
|
||||||
// dlvsym is a GNU extension supported by some other platforms.
|
// Android and Solaris do not have dlvsym
|
||||||
#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
|
#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
||||||
#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
||||||
::__interception::InterceptFunction( \
|
::__interception::InterceptFunction( \
|
||||||
#func, symver, \
|
#func, symver, \
|
||||||
|
@ -46,7 +46,7 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
|
||||||
#else
|
#else
|
||||||
#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
||||||
INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
|
INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
|
||||||
#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
|
#endif // !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
||||||
|
|
||||||
#endif // INTERCEPTION_LINUX_H
|
#endif // INTERCEPTION_LINUX_H
|
||||||
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD ||
|
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD ||
|
||||||
|
|
|
@ -33,10 +33,6 @@ int shmdt(const void *);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) && !defined(__GLIBC__) && !defined(__ANDROID__)
|
|
||||||
#define MUSL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -1166,7 +1162,7 @@ TEST(MemorySanitizer, gethostbyaddr) {
|
||||||
EXPECT_HOSTENT_NOT_POISONED(he);
|
EXPECT_HOSTENT_NOT_POISONED(he);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GLIBC__) || defined(__FreeBSD__)
|
#if !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, gethostent_r) {
|
TEST(MemorySanitizer, gethostent_r) {
|
||||||
sethostent(0);
|
sethostent(0);
|
||||||
char buf[2000];
|
char buf[2000];
|
||||||
|
@ -1346,7 +1342,7 @@ TEST(MemorySanitizer, shmat) {
|
||||||
ASSERT_GT(res, -1);
|
ASSERT_GT(res, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, random_r) {
|
TEST(MemorySanitizer, random_r) {
|
||||||
int32_t x;
|
int32_t x;
|
||||||
char z[64];
|
char z[64];
|
||||||
|
@ -1426,7 +1422,7 @@ TEST(MemorySanitizer, realpath_null) {
|
||||||
free(res);
|
free(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, canonicalize_file_name) {
|
TEST(MemorySanitizer, canonicalize_file_name) {
|
||||||
const char* relpath = ".";
|
const char* relpath = ".";
|
||||||
char* res = canonicalize_file_name(relpath);
|
char* res = canonicalize_file_name(relpath);
|
||||||
|
@ -1802,15 +1798,12 @@ TEST_STRTO_INT(strtol, char, )
|
||||||
TEST_STRTO_INT(strtoll, char, )
|
TEST_STRTO_INT(strtoll, char, )
|
||||||
TEST_STRTO_INT(strtoul, char, )
|
TEST_STRTO_INT(strtoul, char, )
|
||||||
TEST_STRTO_INT(strtoull, char, )
|
TEST_STRTO_INT(strtoull, char, )
|
||||||
#ifndef MUSL
|
|
||||||
TEST_STRTO_INT(strtouq, char, )
|
TEST_STRTO_INT(strtouq, char, )
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_STRTO_FLOAT(strtof, char, )
|
TEST_STRTO_FLOAT(strtof, char, )
|
||||||
TEST_STRTO_FLOAT(strtod, char, )
|
TEST_STRTO_FLOAT(strtod, char, )
|
||||||
TEST_STRTO_FLOAT(strtold, char, )
|
TEST_STRTO_FLOAT(strtold, char, )
|
||||||
|
|
||||||
#ifndef MUSL
|
|
||||||
TEST_STRTO_FLOAT_LOC(strtof_l, char, )
|
TEST_STRTO_FLOAT_LOC(strtof_l, char, )
|
||||||
TEST_STRTO_FLOAT_LOC(strtod_l, char, )
|
TEST_STRTO_FLOAT_LOC(strtod_l, char, )
|
||||||
TEST_STRTO_FLOAT_LOC(strtold_l, char, )
|
TEST_STRTO_FLOAT_LOC(strtold_l, char, )
|
||||||
|
@ -1819,7 +1812,6 @@ TEST_STRTO_INT_LOC(strtol_l, char, )
|
||||||
TEST_STRTO_INT_LOC(strtoll_l, char, )
|
TEST_STRTO_INT_LOC(strtoll_l, char, )
|
||||||
TEST_STRTO_INT_LOC(strtoul_l, char, )
|
TEST_STRTO_INT_LOC(strtoul_l, char, )
|
||||||
TEST_STRTO_INT_LOC(strtoull_l, char, )
|
TEST_STRTO_INT_LOC(strtoull_l, char, )
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_STRTO_INT(wcstol, wchar_t, L)
|
TEST_STRTO_INT(wcstol, wchar_t, L)
|
||||||
TEST_STRTO_INT(wcstoll, wchar_t, L)
|
TEST_STRTO_INT(wcstoll, wchar_t, L)
|
||||||
|
@ -1830,7 +1822,6 @@ TEST_STRTO_FLOAT(wcstof, wchar_t, L)
|
||||||
TEST_STRTO_FLOAT(wcstod, wchar_t, L)
|
TEST_STRTO_FLOAT(wcstod, wchar_t, L)
|
||||||
TEST_STRTO_FLOAT(wcstold, wchar_t, L)
|
TEST_STRTO_FLOAT(wcstold, wchar_t, L)
|
||||||
|
|
||||||
#ifndef MUSL
|
|
||||||
TEST_STRTO_FLOAT_LOC(wcstof_l, wchar_t, L)
|
TEST_STRTO_FLOAT_LOC(wcstof_l, wchar_t, L)
|
||||||
TEST_STRTO_FLOAT_LOC(wcstod_l, wchar_t, L)
|
TEST_STRTO_FLOAT_LOC(wcstod_l, wchar_t, L)
|
||||||
TEST_STRTO_FLOAT_LOC(wcstold_l, wchar_t, L)
|
TEST_STRTO_FLOAT_LOC(wcstold_l, wchar_t, L)
|
||||||
|
@ -1839,7 +1830,6 @@ TEST_STRTO_INT_LOC(wcstol_l, wchar_t, L)
|
||||||
TEST_STRTO_INT_LOC(wcstoll_l, wchar_t, L)
|
TEST_STRTO_INT_LOC(wcstoll_l, wchar_t, L)
|
||||||
TEST_STRTO_INT_LOC(wcstoul_l, wchar_t, L)
|
TEST_STRTO_INT_LOC(wcstoul_l, wchar_t, L)
|
||||||
TEST_STRTO_INT_LOC(wcstoull_l, wchar_t, L)
|
TEST_STRTO_INT_LOC(wcstoull_l, wchar_t, L)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
TEST(MemorySanitizer, strtoimax) {
|
TEST(MemorySanitizer, strtoimax) {
|
||||||
|
@ -1983,7 +1973,7 @@ TEST(MemorySanitizer, lgammal_r) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, drand48_r) {
|
TEST(MemorySanitizer, drand48_r) {
|
||||||
struct drand48_data buf;
|
struct drand48_data buf;
|
||||||
srand48_r(0, &buf);
|
srand48_r(0, &buf);
|
||||||
|
@ -1991,7 +1981,9 @@ TEST(MemorySanitizer, drand48_r) {
|
||||||
drand48_r(&buf, &d);
|
drand48_r(&buf, &d);
|
||||||
EXPECT_NOT_POISONED(d);
|
EXPECT_NOT_POISONED(d);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, lrand48_r) {
|
TEST(MemorySanitizer, lrand48_r) {
|
||||||
struct drand48_data buf;
|
struct drand48_data buf;
|
||||||
srand48_r(0, &buf);
|
srand48_r(0, &buf);
|
||||||
|
@ -2342,7 +2334,7 @@ TEST(MemorySanitizer, getmntent) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, getmntent_r) {
|
TEST(MemorySanitizer, getmntent_r) {
|
||||||
TempFstabFile fstabtmp;
|
TempFstabFile fstabtmp;
|
||||||
ASSERT_TRUE(fstabtmp.Create());
|
ASSERT_TRUE(fstabtmp.Create());
|
||||||
|
@ -3104,7 +3096,7 @@ static void GetProgramPath(char *buf, size_t sz) {
|
||||||
int res = sysctl(mib, 4, buf, &sz, NULL, 0);
|
int res = sysctl(mib, 4, buf, &sz, NULL, 0);
|
||||||
ASSERT_EQ(0, res);
|
ASSERT_EQ(0, res);
|
||||||
}
|
}
|
||||||
#elif defined(__GLIBC__) || defined(MUSL)
|
#elif defined(__GLIBC__)
|
||||||
static void GetProgramPath(char *buf, size_t sz) {
|
static void GetProgramPath(char *buf, size_t sz) {
|
||||||
extern char *program_invocation_name;
|
extern char *program_invocation_name;
|
||||||
int res = snprintf(buf, sz, "%s", program_invocation_name);
|
int res = snprintf(buf, sz, "%s", program_invocation_name);
|
||||||
|
@ -3378,7 +3370,7 @@ TEST(MemorySanitizer, pthread_attr_get) {
|
||||||
EXPECT_NOT_POISONED(v);
|
EXPECT_NOT_POISONED(v);
|
||||||
EXPECT_NOT_POISONED(w);
|
EXPECT_NOT_POISONED(w);
|
||||||
}
|
}
|
||||||
#ifdef __GLIBC__
|
#if !defined(__NetBSD__)
|
||||||
{
|
{
|
||||||
cpu_set_t v;
|
cpu_set_t v;
|
||||||
res = pthread_attr_getaffinity_np(&attr, sizeof(v), &v);
|
res = pthread_attr_getaffinity_np(&attr, sizeof(v), &v);
|
||||||
|
@ -3492,7 +3484,7 @@ TEST(MemorySanitizer, valloc) {
|
||||||
free(a);
|
free(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, pvalloc) {
|
TEST(MemorySanitizer, pvalloc) {
|
||||||
uintptr_t PageSize = GetPageSize();
|
uintptr_t PageSize = GetPageSize();
|
||||||
void *p = pvalloc(PageSize + 100);
|
void *p = pvalloc(PageSize + 100);
|
||||||
|
@ -3637,7 +3629,6 @@ TEST(MemorySanitizer, getpwent) {
|
||||||
EXPECT_NOT_POISONED(p->pw_uid);
|
EXPECT_NOT_POISONED(p->pw_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MUSL
|
|
||||||
TEST(MemorySanitizer, getpwent_r) {
|
TEST(MemorySanitizer, getpwent_r) {
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
struct passwd *pwdres;
|
struct passwd *pwdres;
|
||||||
|
@ -3651,9 +3642,8 @@ TEST(MemorySanitizer, getpwent_r) {
|
||||||
EXPECT_NOT_POISONED(pwd.pw_uid);
|
EXPECT_NOT_POISONED(pwd.pw_uid);
|
||||||
EXPECT_NOT_POISONED(pwdres);
|
EXPECT_NOT_POISONED(pwdres);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, fgetpwent) {
|
TEST(MemorySanitizer, fgetpwent) {
|
||||||
FILE *fp = fopen("/etc/passwd", "r");
|
FILE *fp = fopen("/etc/passwd", "r");
|
||||||
struct passwd *p = fgetpwent(fp);
|
struct passwd *p = fgetpwent(fp);
|
||||||
|
@ -3676,7 +3666,7 @@ TEST(MemorySanitizer, getgrent) {
|
||||||
EXPECT_NOT_POISONED(p->gr_gid);
|
EXPECT_NOT_POISONED(p->gr_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, fgetgrent) {
|
TEST(MemorySanitizer, fgetgrent) {
|
||||||
FILE *fp = fopen("/etc/group", "r");
|
FILE *fp = fopen("/etc/group", "r");
|
||||||
struct group *grp = fgetgrent(fp);
|
struct group *grp = fgetgrent(fp);
|
||||||
|
@ -3693,7 +3683,6 @@ TEST(MemorySanitizer, fgetgrent) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GLIBC__) || defined(__FreeBSD__)
|
|
||||||
TEST(MemorySanitizer, getgrent_r) {
|
TEST(MemorySanitizer, getgrent_r) {
|
||||||
struct group grp;
|
struct group grp;
|
||||||
struct group *grpres;
|
struct group *grpres;
|
||||||
|
@ -3708,6 +3697,7 @@ TEST(MemorySanitizer, getgrent_r) {
|
||||||
EXPECT_NOT_POISONED(grpres);
|
EXPECT_NOT_POISONED(grpres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||||
TEST(MemorySanitizer, fgetgrent_r) {
|
TEST(MemorySanitizer, fgetgrent_r) {
|
||||||
FILE *fp = fopen("/etc/group", "r");
|
FILE *fp = fopen("/etc/group", "r");
|
||||||
struct group grp;
|
struct group grp;
|
||||||
|
|
|
@ -330,17 +330,13 @@ static void ioctl_table_fill() {
|
||||||
_(SOUND_PCM_WRITE_CHANNELS, WRITE, sizeof(int));
|
_(SOUND_PCM_WRITE_CHANNELS, WRITE, sizeof(int));
|
||||||
_(SOUND_PCM_WRITE_FILTER, WRITE, sizeof(int));
|
_(SOUND_PCM_WRITE_FILTER, WRITE, sizeof(int));
|
||||||
_(TCFLSH, NONE, 0);
|
_(TCFLSH, NONE, 0);
|
||||||
#if SANITIZER_GLIBC
|
|
||||||
_(TCGETA, WRITE, struct_termio_sz);
|
_(TCGETA, WRITE, struct_termio_sz);
|
||||||
#endif
|
|
||||||
_(TCGETS, WRITE, struct_termios_sz);
|
_(TCGETS, WRITE, struct_termios_sz);
|
||||||
_(TCSBRK, NONE, 0);
|
_(TCSBRK, NONE, 0);
|
||||||
_(TCSBRKP, NONE, 0);
|
_(TCSBRKP, NONE, 0);
|
||||||
#if SANITIZER_GLIBC
|
|
||||||
_(TCSETA, READ, struct_termio_sz);
|
_(TCSETA, READ, struct_termio_sz);
|
||||||
_(TCSETAF, READ, struct_termio_sz);
|
_(TCSETAF, READ, struct_termio_sz);
|
||||||
_(TCSETAW, READ, struct_termio_sz);
|
_(TCSETAW, READ, struct_termio_sz);
|
||||||
#endif
|
|
||||||
_(TCSETS, READ, struct_termios_sz);
|
_(TCSETS, READ, struct_termios_sz);
|
||||||
_(TCSETSF, READ, struct_termios_sz);
|
_(TCSETSF, READ, struct_termios_sz);
|
||||||
_(TCSETSW, READ, struct_termios_sz);
|
_(TCSETSW, READ, struct_termios_sz);
|
||||||
|
@ -368,7 +364,7 @@ static void ioctl_table_fill() {
|
||||||
_(VT_WAITACTIVE, NONE, 0);
|
_(VT_WAITACTIVE, NONE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
|
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
|
||||||
_(CYGETDEFTHRESH, WRITE, sizeof(int));
|
_(CYGETDEFTHRESH, WRITE, sizeof(int));
|
||||||
_(CYGETDEFTIMEOUT, WRITE, sizeof(int));
|
_(CYGETDEFTIMEOUT, WRITE, sizeof(int));
|
||||||
|
|
|
@ -183,7 +183,8 @@ __attribute__((unused)) static bool GetLibcVersion(int *major, int *minor,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SANITIZER_GLIBC && !SANITIZER_GO
|
#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \
|
||||||
|
!SANITIZER_NETBSD && !SANITIZER_SOLARIS
|
||||||
static uptr g_tls_size;
|
static uptr g_tls_size;
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
|
@ -255,7 +256,7 @@ void InitTlsSize() {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void InitTlsSize() { }
|
void InitTlsSize() { }
|
||||||
#endif // SANITIZER_GLIBC && !SANITIZER_GO
|
#endif
|
||||||
|
|
||||||
#if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) || \
|
#if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) || \
|
||||||
defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) || \
|
defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) || \
|
||||||
|
@ -524,15 +525,11 @@ uptr GetTlsSize() {
|
||||||
uptr addr, size;
|
uptr addr, size;
|
||||||
GetTls(&addr, &size);
|
GetTls(&addr, &size);
|
||||||
return size;
|
return size;
|
||||||
#elif SANITIZER_GLIBC
|
#elif defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64
|
||||||
#if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64
|
|
||||||
return RoundUpTo(g_tls_size + TlsPreTcbSize(), 16);
|
return RoundUpTo(g_tls_size + TlsPreTcbSize(), 16);
|
||||||
#else
|
#else
|
||||||
return g_tls_size;
|
return g_tls_size;
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -19,25 +19,12 @@
|
||||||
# error "This operating system is not supported"
|
# error "This operating system is not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get __GLIBC__ on a glibc platform. Exclude Android: features.h includes C
|
|
||||||
// function declarations into a .S file which doesn't compile.
|
|
||||||
// https://crbug.com/1162741
|
|
||||||
#if __has_include(<features.h>) && !defined(__ANDROID__)
|
|
||||||
#include <features.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
# define SANITIZER_LINUX 1
|
# define SANITIZER_LINUX 1
|
||||||
#else
|
#else
|
||||||
# define SANITIZER_LINUX 0
|
# define SANITIZER_LINUX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GLIBC__)
|
|
||||||
# define SANITIZER_GLIBC 1
|
|
||||||
#else
|
|
||||||
# define SANITIZER_GLIBC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
# define SANITIZER_FREEBSD 1
|
# define SANITIZER_FREEBSD 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -46,12 +46,6 @@
|
||||||
#define SI_LINUX_NOT_ANDROID 0
|
#define SI_LINUX_NOT_ANDROID 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
|
||||||
#define SI_GLIBC 1
|
|
||||||
#else
|
|
||||||
#define SI_GLIBC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SANITIZER_ANDROID
|
#if SANITIZER_ANDROID
|
||||||
#define SI_ANDROID 1
|
#define SI_ANDROID 1
|
||||||
#else
|
#else
|
||||||
|
@ -165,7 +159,7 @@
|
||||||
SANITIZER_INTERCEPT_MEMCMP && \
|
SANITIZER_INTERCEPT_MEMCMP && \
|
||||||
((SI_POSIX && _GNU_SOURCE) || SI_NETBSD || SI_FREEBSD)
|
((SI_POSIX && _GNU_SOURCE) || SI_NETBSD || SI_FREEBSD)
|
||||||
#define SANITIZER_INTERCEPT_STRNDUP SI_POSIX
|
#define SANITIZER_INTERCEPT_STRNDUP SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT___STRNDUP SI_GLIBC
|
#define SANITIZER_INTERCEPT___STRNDUP SI_LINUX_NOT_FREEBSD
|
||||||
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
||||||
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
|
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
|
||||||
#define SI_MAC_DEPLOYMENT_BELOW_10_7 1
|
#define SI_MAC_DEPLOYMENT_BELOW_10_7 1
|
||||||
|
@ -189,8 +183,8 @@
|
||||||
#define SANITIZER_INTERCEPT_FPUTS SI_POSIX
|
#define SANITIZER_INTERCEPT_FPUTS SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PUTS SI_POSIX
|
#define SANITIZER_INTERCEPT_PUTS SI_POSIX
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_PREAD64 (SI_GLIBC || SI_SOLARIS32)
|
#define SANITIZER_INTERCEPT_PREAD64 SI_LINUX_NOT_ANDROID || SI_SOLARIS32
|
||||||
#define SANITIZER_INTERCEPT_PWRITE64 (SI_GLIBC || SI_SOLARIS32)
|
#define SANITIZER_INTERCEPT_PWRITE64 SI_LINUX_NOT_ANDROID || SI_SOLARIS32
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_READV SI_POSIX
|
#define SANITIZER_INTERCEPT_READV SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_WRITEV SI_POSIX
|
#define SANITIZER_INTERCEPT_WRITEV SI_POSIX
|
||||||
|
@ -198,8 +192,8 @@
|
||||||
#define SANITIZER_INTERCEPT_PREADV \
|
#define SANITIZER_INTERCEPT_PREADV \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
||||||
#define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PREADV64 SI_GLIBC
|
#define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PWRITEV64 SI_GLIBC
|
#define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_PRCTL SI_LINUX
|
#define SANITIZER_INTERCEPT_PRCTL SI_LINUX
|
||||||
|
|
||||||
|
@ -207,16 +201,16 @@
|
||||||
#define SANITIZER_INTERCEPT_STRPTIME SI_POSIX
|
#define SANITIZER_INTERCEPT_STRPTIME SI_POSIX
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_SCANF SI_POSIX
|
#define SANITIZER_INTERCEPT_SCANF SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_ISOC99_SCANF SI_GLIBC
|
#define SANITIZER_INTERCEPT_ISOC99_SCANF SI_LINUX_NOT_ANDROID
|
||||||
|
|
||||||
#ifndef SANITIZER_INTERCEPT_PRINTF
|
#ifndef SANITIZER_INTERCEPT_PRINTF
|
||||||
#define SANITIZER_INTERCEPT_PRINTF SI_POSIX
|
#define SANITIZER_INTERCEPT_PRINTF SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PRINTF_L (SI_FREEBSD || SI_NETBSD)
|
#define SANITIZER_INTERCEPT_PRINTF_L (SI_FREEBSD || SI_NETBSD)
|
||||||
#define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_GLIBC
|
#define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_LINUX_NOT_ANDROID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT___PRINTF_CHK \
|
#define SANITIZER_INTERCEPT___PRINTF_CHK \
|
||||||
(SANITIZER_INTERCEPT_PRINTF && SI_GLIBC)
|
(SANITIZER_INTERCEPT_PRINTF && SI_LINUX_NOT_ANDROID)
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_FREXP SI_NOT_FUCHSIA
|
#define SANITIZER_INTERCEPT_FREXP SI_NOT_FUCHSIA
|
||||||
#define SANITIZER_INTERCEPT_FREXPF_FREXPL SI_POSIX
|
#define SANITIZER_INTERCEPT_FREXPF_FREXPL SI_POSIX
|
||||||
|
@ -226,11 +220,13 @@
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_GETPWENT \
|
#define SANITIZER_INTERCEPT_GETPWENT \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_FGETGRENT_R (SI_FREEBSD || SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_FGETGRENT_R \
|
||||||
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
#define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_GETPWENT_R \
|
#define SANITIZER_INTERCEPT_GETPWENT_R \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_FGETPWENT_R (SI_FREEBSD || SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_FGETPWENT_R \
|
||||||
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_SETPWENT \
|
#define SANITIZER_INTERCEPT_SETPWENT \
|
||||||
(SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_CLOCK_GETTIME \
|
#define SANITIZER_INTERCEPT_CLOCK_GETTIME \
|
||||||
|
@ -238,8 +234,8 @@
|
||||||
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID SI_LINUX
|
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID SI_LINUX
|
||||||
#define SANITIZER_INTERCEPT_GETITIMER SI_POSIX
|
#define SANITIZER_INTERCEPT_GETITIMER SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_TIME SI_POSIX
|
#define SANITIZER_INTERCEPT_TIME SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_GLOB (SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_GLOB64 SI_GLIBC
|
#define SANITIZER_INTERCEPT_GLOB64 SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_WAIT SI_POSIX
|
#define SANITIZER_INTERCEPT_WAIT SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_INET SI_POSIX
|
#define SANITIZER_INTERCEPT_INET SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM SI_POSIX
|
#define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM SI_POSIX
|
||||||
|
@ -254,7 +250,8 @@
|
||||||
(SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
||||||
#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R \
|
#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R \
|
||||||
(SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_GETHOSTENT_R (SI_FREEBSD || SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_GETHOSTENT_R \
|
||||||
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_GETSOCKOPT SI_POSIX
|
#define SANITIZER_INTERCEPT_GETSOCKOPT SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_ACCEPT SI_POSIX
|
#define SANITIZER_INTERCEPT_ACCEPT SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_ACCEPT4 (SI_LINUX_NOT_ANDROID || SI_NETBSD)
|
#define SANITIZER_INTERCEPT_ACCEPT4 (SI_LINUX_NOT_ANDROID || SI_NETBSD)
|
||||||
|
@ -299,7 +296,8 @@
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
#define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_REALPATH SI_POSIX
|
#define SANITIZER_INTERCEPT_REALPATH SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME (SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME \
|
||||||
|
(SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_CONFSTR \
|
#define SANITIZER_INTERCEPT_CONFSTR \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
|
||||||
|
@ -326,7 +324,7 @@
|
||||||
#define SANITIZER_INTERCEPT_SIGPROCMASK SI_POSIX
|
#define SANITIZER_INTERCEPT_SIGPROCMASK SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_SIGMASK SI_POSIX
|
#define SANITIZER_INTERCEPT_PTHREAD_SIGMASK SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_BACKTRACE \
|
#define SANITIZER_INTERCEPT_BACKTRACE \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
|
#define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
|
||||||
#define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_STATFS \
|
#define SANITIZER_INTERCEPT_STATFS \
|
||||||
|
@ -344,11 +342,11 @@
|
||||||
#define SANITIZER_INTERCEPT_SHMCTL \
|
#define SANITIZER_INTERCEPT_SHMCTL \
|
||||||
(((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) || \
|
(((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) || \
|
||||||
SI_NETBSD || SI_SOLARIS) // NOLINT
|
SI_NETBSD || SI_SOLARIS) // NOLINT
|
||||||
#define SANITIZER_INTERCEPT_RANDOM_R SI_GLIBC
|
#define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_GLIBC
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET_SCHED SI_POSIX
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET_SCHED SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED \
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED \
|
||||||
(SI_POSIX && !SI_NETBSD)
|
(SI_POSIX && !SI_NETBSD)
|
||||||
|
@ -362,7 +360,7 @@
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED \
|
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED \
|
||||||
(SI_POSIX && !SI_NETBSD)
|
(SI_POSIX && !SI_NETBSD)
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETKIND_NP SI_GLIBC
|
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETKIND_NP SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETPSHARED (SI_POSIX && !SI_NETBSD)
|
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETPSHARED (SI_POSIX && !SI_NETBSD)
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETCLOCK \
|
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETCLOCK \
|
||||||
(SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
|
@ -370,7 +368,7 @@
|
||||||
(SI_LINUX_NOT_ANDROID && !SI_NETBSD)
|
(SI_LINUX_NOT_ANDROID && !SI_NETBSD)
|
||||||
#define SANITIZER_INTERCEPT_THR_EXIT SI_FREEBSD
|
#define SANITIZER_INTERCEPT_THR_EXIT SI_FREEBSD
|
||||||
#define SANITIZER_INTERCEPT_TMPNAM SI_POSIX
|
#define SANITIZER_INTERCEPT_TMPNAM SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_TMPNAM_R (SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_TMPNAM_R SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_PTSNAME SI_LINUX
|
#define SANITIZER_INTERCEPT_PTSNAME SI_LINUX
|
||||||
#define SANITIZER_INTERCEPT_PTSNAME_R SI_LINUX
|
#define SANITIZER_INTERCEPT_PTSNAME_R SI_LINUX
|
||||||
#define SANITIZER_INTERCEPT_TTYNAME SI_POSIX
|
#define SANITIZER_INTERCEPT_TTYNAME SI_POSIX
|
||||||
|
@ -383,7 +381,7 @@
|
||||||
#define SANITIZER_INTERCEPT_LGAMMAL (SI_POSIX && !SI_NETBSD)
|
#define SANITIZER_INTERCEPT_LGAMMAL (SI_POSIX && !SI_NETBSD)
|
||||||
#define SANITIZER_INTERCEPT_LGAMMA_R (SI_FREEBSD || SI_LINUX || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_LGAMMA_R (SI_FREEBSD || SI_LINUX || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
#define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_DRAND48_R SI_GLIBC
|
#define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_RAND_R \
|
#define SANITIZER_INTERCEPT_RAND_R \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_ICONV \
|
#define SANITIZER_INTERCEPT_ICONV \
|
||||||
|
@ -398,12 +396,12 @@
|
||||||
(SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC || SI_SOLARIS)
|
(SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC || SI_SOLARIS)
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_MUTEX SI_POSIX
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEX SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT___PTHREAD_MUTEX SI_GLIBC
|
#define SANITIZER_INTERCEPT___PTHREAD_MUTEX SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT___LIBC_MUTEX SI_NETBSD
|
#define SANITIZER_INTERCEPT___LIBC_MUTEX SI_NETBSD
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
|
#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP \
|
#define SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_GLIBC || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_TLS_GET_ADDR \
|
#define SANITIZER_INTERCEPT_TLS_GET_ADDR \
|
||||||
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)
|
||||||
|
@ -421,19 +419,19 @@
|
||||||
#else
|
#else
|
||||||
#define SANITIZER_INTERCEPT_AEABI_MEM 0
|
#define SANITIZER_INTERCEPT_AEABI_MEM 0
|
||||||
#endif
|
#endif
|
||||||
#define SANITIZER_INTERCEPT___BZERO SI_MAC || SI_GLIBC
|
#define SANITIZER_INTERCEPT___BZERO SI_MAC || SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_BZERO SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_BZERO SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_FTIME (!SI_FREEBSD && !SI_NETBSD && SI_POSIX)
|
#define SANITIZER_INTERCEPT_FTIME (!SI_FREEBSD && !SI_NETBSD && SI_POSIX)
|
||||||
#define SANITIZER_INTERCEPT_XDR (SI_GLIBC || SI_SOLARIS)
|
#define SANITIZER_INTERCEPT_XDR SI_LINUX_NOT_ANDROID || SI_SOLARIS
|
||||||
#define SANITIZER_INTERCEPT_XDRREC SI_GLIBC
|
#define SANITIZER_INTERCEPT_XDRREC SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_TSEARCH \
|
#define SANITIZER_INTERCEPT_TSEARCH \
|
||||||
(SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD || SI_SOLARIS)
|
(SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_GLIBC
|
#define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_FOPEN SI_POSIX
|
#define SANITIZER_INTERCEPT_FOPEN SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_FOPEN64 (SI_GLIBC || SI_SOLARIS32)
|
#define SANITIZER_INTERCEPT_FOPEN64 SI_LINUX_NOT_ANDROID || SI_SOLARIS32
|
||||||
#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM \
|
#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM \
|
||||||
(SI_LINUX_NOT_ANDROID || SI_NETBSD || SI_SOLARIS)
|
(SI_LINUX_NOT_ANDROID || SI_NETBSD || SI_SOLARIS)
|
||||||
#define SANITIZER_INTERCEPT_OBSTACK SI_GLIBC
|
#define SANITIZER_INTERCEPT_OBSTACK SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_FFLUSH SI_POSIX
|
#define SANITIZER_INTERCEPT_FFLUSH SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_FCLOSE SI_POSIX
|
#define SANITIZER_INTERCEPT_FCLOSE SI_POSIX
|
||||||
|
|
||||||
|
@ -481,12 +479,20 @@
|
||||||
|
|
||||||
#define SANITIZER_INTERCEPT_MMAP SI_POSIX
|
#define SANITIZER_INTERCEPT_MMAP SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
|
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
|
||||||
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO (SI_GLIBC || SI_ANDROID)
|
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
|
||||||
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && SI_NOT_FUCHSIA && SI_NOT_RTEMS && \
|
||||||
|
!SI_SOLARIS) // NOLINT
|
||||||
#define SANITIZER_INTERCEPT_MEMALIGN \
|
#define SANITIZER_INTERCEPT_MEMALIGN \
|
||||||
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && SI_NOT_RTEMS)
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && SI_NOT_RTEMS)
|
||||||
#define SANITIZER_INTERCEPT___LIBC_MEMALIGN SI_GLIBC
|
#define SANITIZER_INTERCEPT___LIBC_MEMALIGN \
|
||||||
#define SANITIZER_INTERCEPT_PVALLOC (SI_GLIBC || SI_ANDROID)
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS && \
|
||||||
#define SANITIZER_INTERCEPT_CFREE SI_GLIBC
|
!SI_ANDROID) // NOLINT
|
||||||
|
#define SANITIZER_INTERCEPT_PVALLOC \
|
||||||
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && SI_NOT_FUCHSIA && SI_NOT_RTEMS && \
|
||||||
|
!SI_SOLARIS) // NOLINT
|
||||||
|
#define SANITIZER_INTERCEPT_CFREE \
|
||||||
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && SI_NOT_FUCHSIA && SI_NOT_RTEMS && \
|
||||||
|
!SI_SOLARIS && !SANITIZER_ANDROID) // NOLINT
|
||||||
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
|
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
|
||||||
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
|
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
|
||||||
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
|
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
|
||||||
|
@ -526,7 +532,7 @@
|
||||||
#define SANITIZER_INTERCEPT_STRMODE (SI_NETBSD || SI_FREEBSD)
|
#define SANITIZER_INTERCEPT_STRMODE (SI_NETBSD || SI_FREEBSD)
|
||||||
#define SANITIZER_INTERCEPT_TTYENT SI_NETBSD
|
#define SANITIZER_INTERCEPT_TTYENT SI_NETBSD
|
||||||
#define SANITIZER_INTERCEPT_PROTOENT (SI_NETBSD || SI_LINUX)
|
#define SANITIZER_INTERCEPT_PROTOENT (SI_NETBSD || SI_LINUX)
|
||||||
#define SANITIZER_INTERCEPT_PROTOENT_R SI_GLIBC
|
#define SANITIZER_INTERCEPT_PROTOENT_R (SI_LINUX_NOT_ANDROID)
|
||||||
#define SANITIZER_INTERCEPT_NETENT SI_NETBSD
|
#define SANITIZER_INTERCEPT_NETENT SI_NETBSD
|
||||||
#define SANITIZER_INTERCEPT_SETVBUF \
|
#define SANITIZER_INTERCEPT_SETVBUF \
|
||||||
(SI_NETBSD || SI_FREEBSD || SI_LINUX || SI_MAC)
|
(SI_NETBSD || SI_FREEBSD || SI_LINUX || SI_MAC)
|
||||||
|
@ -577,7 +583,7 @@
|
||||||
#define SANITIZER_INTERCEPT_GETENTROPY SI_FREEBSD
|
#define SANITIZER_INTERCEPT_GETENTROPY SI_FREEBSD
|
||||||
#define SANITIZER_INTERCEPT_QSORT \
|
#define SANITIZER_INTERCEPT_QSORT \
|
||||||
(SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID)
|
(SI_POSIX && !SI_IOSSIM && !SI_WATCHOS && !SI_TVOS && !SI_ANDROID)
|
||||||
#define SANITIZER_INTERCEPT_QSORT_R SI_GLIBC
|
#define SANITIZER_INTERCEPT_QSORT_R (SI_LINUX && !SI_ANDROID)
|
||||||
// sigaltstack on i386 macOS cannot be intercepted due to setjmp()
|
// sigaltstack on i386 macOS cannot be intercepted due to setjmp()
|
||||||
// calling it and assuming that it does not clobber registers.
|
// calling it and assuming that it does not clobber registers.
|
||||||
#define SANITIZER_INTERCEPT_SIGALTSTACK \
|
#define SANITIZER_INTERCEPT_SIGALTSTACK \
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -59,6 +58,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !SANITIZER_ANDROID
|
#if !SANITIZER_ANDROID
|
||||||
|
#include <fstab.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#include <utmpx.h>
|
#include <utmpx.h>
|
||||||
|
@ -110,31 +110,20 @@ typedef struct user_fpregs elf_fpregset_t;
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_LINUX
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
#if SANITIZER_GLIBC
|
#include <glob.h>
|
||||||
#include <fstab.h>
|
#include <obstack.h>
|
||||||
|
#include <mqueue.h>
|
||||||
#include <net/if_ppp.h>
|
#include <net/if_ppp.h>
|
||||||
#include <netax25/ax25.h>
|
#include <netax25/ax25.h>
|
||||||
#include <netipx/ipx.h>
|
#include <netipx/ipx.h>
|
||||||
#include <netrom/netrom.h>
|
#include <netrom/netrom.h>
|
||||||
#include <obstack.h>
|
|
||||||
#if HAVE_RPC_XDR_H
|
#if HAVE_RPC_XDR_H
|
||||||
# include <rpc/xdr.h>
|
# include <rpc/xdr.h>
|
||||||
#endif
|
#endif
|
||||||
#include <scsi/scsi.h>
|
#include <scsi/scsi.h>
|
||||||
#else
|
|
||||||
#include <linux/if_ppp.h>
|
|
||||||
#include <linux/kd.h>
|
|
||||||
#include <linux/ppp_defs.h>
|
|
||||||
#endif // SANITIZER_GLIBC
|
|
||||||
|
|
||||||
#if SANITIZER_ANDROID
|
|
||||||
#include <linux/mtio.h>
|
|
||||||
#else
|
|
||||||
#include <glob.h>
|
|
||||||
#include <mqueue.h>
|
|
||||||
#include <sys/kd.h>
|
|
||||||
#include <sys/mtio.h>
|
#include <sys/mtio.h>
|
||||||
|
#include <sys/kd.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#include <sys/timex.h>
|
#include <sys/timex.h>
|
||||||
|
@ -153,14 +142,20 @@ typedef struct user_fpregs elf_fpregset_t;
|
||||||
#include <sys/msg.h>
|
#include <sys/msg.h>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <crypt.h>
|
#include <crypt.h>
|
||||||
#endif // SANITIZER_ANDROID
|
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
|
||||||
|
#if SANITIZER_ANDROID
|
||||||
|
#include <linux/kd.h>
|
||||||
|
#include <linux/mtio.h>
|
||||||
|
#include <linux/ppp_defs.h>
|
||||||
|
#include <linux/if_ppp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#else
|
|
||||||
#include <fstab.h>
|
|
||||||
#endif // SANITIZER_LINUX
|
#endif // SANITIZER_LINUX
|
||||||
|
|
||||||
#if SANITIZER_MAC
|
#if SANITIZER_MAC
|
||||||
|
@ -207,10 +202,8 @@ namespace __sanitizer {
|
||||||
unsigned struct_statfs64_sz = sizeof(struct statfs64);
|
unsigned struct_statfs64_sz = sizeof(struct statfs64);
|
||||||
#endif // (SANITIZER_MAC && !TARGET_CPU_ARM64) && !SANITIZER_IOS
|
#endif // (SANITIZER_MAC && !TARGET_CPU_ARM64) && !SANITIZER_IOS
|
||||||
|
|
||||||
#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC
|
|
||||||
unsigned struct_fstab_sz = sizeof(struct fstab);
|
|
||||||
#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC
|
|
||||||
#if !SANITIZER_ANDROID
|
#if !SANITIZER_ANDROID
|
||||||
|
unsigned struct_fstab_sz = sizeof(struct fstab);
|
||||||
unsigned struct_statfs_sz = sizeof(struct statfs);
|
unsigned struct_statfs_sz = sizeof(struct statfs);
|
||||||
unsigned struct_sockaddr_sz = sizeof(struct sockaddr);
|
unsigned struct_sockaddr_sz = sizeof(struct sockaddr);
|
||||||
unsigned ucontext_t_sz = sizeof(ucontext_t);
|
unsigned ucontext_t_sz = sizeof(ucontext_t);
|
||||||
|
@ -306,7 +299,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr));
|
||||||
unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
int glob_nomatch = GLOB_NOMATCH;
|
int glob_nomatch = GLOB_NOMATCH;
|
||||||
int glob_altdirfunc = GLOB_ALTDIRFUNC;
|
int glob_altdirfunc = GLOB_ALTDIRFUNC;
|
||||||
#endif
|
#endif
|
||||||
|
@ -429,9 +422,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
unsigned struct_input_id_sz = sizeof(struct input_id);
|
unsigned struct_input_id_sz = sizeof(struct input_id);
|
||||||
unsigned struct_mtpos_sz = sizeof(struct mtpos);
|
unsigned struct_mtpos_sz = sizeof(struct mtpos);
|
||||||
unsigned struct_rtentry_sz = sizeof(struct rtentry);
|
unsigned struct_rtentry_sz = sizeof(struct rtentry);
|
||||||
#if SANITIZER_GLIBC || SANITIZER_ANDROID
|
|
||||||
unsigned struct_termio_sz = sizeof(struct termio);
|
unsigned struct_termio_sz = sizeof(struct termio);
|
||||||
#endif
|
|
||||||
unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
|
unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
|
||||||
unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
|
unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
|
||||||
unsigned struct_vt_stat_sz = sizeof(struct vt_stat);
|
unsigned struct_vt_stat_sz = sizeof(struct vt_stat);
|
||||||
|
@ -456,7 +447,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
|
unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
|
||||||
#endif // SANITIZER_LINUX
|
#endif // SANITIZER_LINUX
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
|
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
|
||||||
unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
|
unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
|
||||||
#if EV_VERSION > (0x010000)
|
#if EV_VERSION > (0x010000)
|
||||||
|
@ -479,10 +470,12 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
unsigned struct_sockaddr_ax25_sz = sizeof(struct sockaddr_ax25);
|
unsigned struct_sockaddr_ax25_sz = sizeof(struct sockaddr_ax25);
|
||||||
unsigned struct_unimapdesc_sz = sizeof(struct unimapdesc);
|
unsigned struct_unimapdesc_sz = sizeof(struct unimapdesc);
|
||||||
unsigned struct_unimapinit_sz = sizeof(struct unimapinit);
|
unsigned struct_unimapinit_sz = sizeof(struct unimapinit);
|
||||||
|
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info);
|
unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info);
|
||||||
unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats);
|
unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats);
|
||||||
#endif // SANITIZER_GLIBC
|
#endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
|
||||||
|
|
||||||
#if !SANITIZER_ANDROID && !SANITIZER_MAC
|
#if !SANITIZER_ANDROID && !SANITIZER_MAC
|
||||||
unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);
|
unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);
|
||||||
|
@ -888,7 +881,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
unsigned IOCTL_PIO_UNIMAP = PIO_UNIMAP;
|
unsigned IOCTL_PIO_UNIMAP = PIO_UNIMAP;
|
||||||
unsigned IOCTL_PIO_UNIMAPCLR = PIO_UNIMAPCLR;
|
unsigned IOCTL_PIO_UNIMAPCLR = PIO_UNIMAPCLR;
|
||||||
unsigned IOCTL_PIO_UNISCRNMAP = PIO_UNISCRNMAP;
|
unsigned IOCTL_PIO_UNISCRNMAP = PIO_UNISCRNMAP;
|
||||||
#if SANITIZER_GLIBC
|
|
||||||
unsigned IOCTL_SCSI_IOCTL_GET_IDLUN = SCSI_IOCTL_GET_IDLUN;
|
unsigned IOCTL_SCSI_IOCTL_GET_IDLUN = SCSI_IOCTL_GET_IDLUN;
|
||||||
unsigned IOCTL_SCSI_IOCTL_PROBE_HOST = SCSI_IOCTL_PROBE_HOST;
|
unsigned IOCTL_SCSI_IOCTL_PROBE_HOST = SCSI_IOCTL_PROBE_HOST;
|
||||||
unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE = SCSI_IOCTL_TAGGED_DISABLE;
|
unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE = SCSI_IOCTL_TAGGED_DISABLE;
|
||||||
|
@ -907,7 +899,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
|
||||||
unsigned IOCTL_SIOCNRGETPARMS = SIOCNRGETPARMS;
|
unsigned IOCTL_SIOCNRGETPARMS = SIOCNRGETPARMS;
|
||||||
unsigned IOCTL_SIOCNRRTCTL = SIOCNRRTCTL;
|
unsigned IOCTL_SIOCNRRTCTL = SIOCNRRTCTL;
|
||||||
unsigned IOCTL_SIOCNRSETPARMS = SIOCNRSETPARMS;
|
unsigned IOCTL_SIOCNRSETPARMS = SIOCNRSETPARMS;
|
||||||
#endif
|
|
||||||
unsigned IOCTL_TIOCGSERIAL = TIOCGSERIAL;
|
unsigned IOCTL_TIOCGSERIAL = TIOCGSERIAL;
|
||||||
unsigned IOCTL_TIOCSERGETMULTI = TIOCSERGETMULTI;
|
unsigned IOCTL_TIOCSERGETMULTI = TIOCSERGETMULTI;
|
||||||
unsigned IOCTL_TIOCSERSETMULTI = TIOCSERSETMULTI;
|
unsigned IOCTL_TIOCSERSETMULTI = TIOCSERSETMULTI;
|
||||||
|
@ -978,7 +969,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
|
||||||
CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
|
CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
|
||||||
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
|
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
|
||||||
|
|
||||||
#if SANITIZER_GLIBC || SANITIZER_FREEBSD
|
#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
|
||||||
CHECK_TYPE_SIZE(glob_t);
|
CHECK_TYPE_SIZE(glob_t);
|
||||||
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
|
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
|
||||||
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
|
CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
|
||||||
|
@ -989,7 +980,7 @@ CHECK_SIZE_AND_OFFSET(glob_t, gl_readdir);
|
||||||
CHECK_SIZE_AND_OFFSET(glob_t, gl_opendir);
|
CHECK_SIZE_AND_OFFSET(glob_t, gl_opendir);
|
||||||
CHECK_SIZE_AND_OFFSET(glob_t, gl_lstat);
|
CHECK_SIZE_AND_OFFSET(glob_t, gl_lstat);
|
||||||
CHECK_SIZE_AND_OFFSET(glob_t, gl_stat);
|
CHECK_SIZE_AND_OFFSET(glob_t, gl_stat);
|
||||||
#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD
|
#endif
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(addrinfo);
|
CHECK_TYPE_SIZE(addrinfo);
|
||||||
CHECK_SIZE_AND_OFFSET(addrinfo, ai_flags);
|
CHECK_SIZE_AND_OFFSET(addrinfo, ai_flags);
|
||||||
|
@ -1012,27 +1003,17 @@ CHECK_TYPE_SIZE(iovec);
|
||||||
CHECK_SIZE_AND_OFFSET(iovec, iov_base);
|
CHECK_SIZE_AND_OFFSET(iovec, iov_base);
|
||||||
CHECK_SIZE_AND_OFFSET(iovec, iov_len);
|
CHECK_SIZE_AND_OFFSET(iovec, iov_len);
|
||||||
|
|
||||||
// In POSIX, int msg_iovlen; socklen_t msg_controllen; socklen_t cmsg_len; but
|
|
||||||
// many implementations don't conform to the standard. Since we pick the
|
|
||||||
// non-conforming glibc definition, exclude the checks for musl (incompatible
|
|
||||||
// sizes but compatible offsets).
|
|
||||||
CHECK_TYPE_SIZE(msghdr);
|
CHECK_TYPE_SIZE(msghdr);
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_name);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_name);
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen);
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_iov);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_iov);
|
||||||
#if SANITIZER_GLIBC || SANITIZER_ANDROID
|
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_iovlen);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_iovlen);
|
||||||
#endif
|
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_control);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_control);
|
||||||
#if SANITIZER_GLIBC || SANITIZER_ANDROID
|
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_controllen);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_controllen);
|
||||||
#endif
|
|
||||||
CHECK_SIZE_AND_OFFSET(msghdr, msg_flags);
|
CHECK_SIZE_AND_OFFSET(msghdr, msg_flags);
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(cmsghdr);
|
CHECK_TYPE_SIZE(cmsghdr);
|
||||||
#if SANITIZER_GLIBC || SANITIZER_ANDROID
|
|
||||||
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
|
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
|
||||||
#endif
|
|
||||||
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
|
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
|
||||||
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
|
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
|
||||||
|
|
||||||
|
@ -1140,7 +1121,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno);
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(ether_addr);
|
CHECK_TYPE_SIZE(ether_addr);
|
||||||
|
|
||||||
#if SANITIZER_GLIBC || SANITIZER_FREEBSD
|
#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
|
||||||
CHECK_TYPE_SIZE(ipc_perm);
|
CHECK_TYPE_SIZE(ipc_perm);
|
||||||
# if SANITIZER_FREEBSD
|
# if SANITIZER_FREEBSD
|
||||||
CHECK_SIZE_AND_OFFSET(ipc_perm, key);
|
CHECK_SIZE_AND_OFFSET(ipc_perm, key);
|
||||||
|
@ -1202,7 +1183,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
|
||||||
CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
|
CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC || SANITIZER_ANDROID
|
#if SANITIZER_LINUX
|
||||||
COMPILER_CHECK(sizeof(__sanitizer_struct_mallinfo) == sizeof(struct mallinfo));
|
COMPILER_CHECK(sizeof(__sanitizer_struct_mallinfo) == sizeof(struct mallinfo));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1252,7 +1233,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
|
||||||
COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
|
COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
|
COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
|
||||||
CHECK_SIZE_AND_OFFSET(FILE, _flags);
|
CHECK_SIZE_AND_OFFSET(FILE, _flags);
|
||||||
CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
|
CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
|
||||||
|
@ -1269,7 +1250,9 @@ CHECK_SIZE_AND_OFFSET(FILE, _IO_save_end);
|
||||||
CHECK_SIZE_AND_OFFSET(FILE, _markers);
|
CHECK_SIZE_AND_OFFSET(FILE, _markers);
|
||||||
CHECK_SIZE_AND_OFFSET(FILE, _chain);
|
CHECK_SIZE_AND_OFFSET(FILE, _chain);
|
||||||
CHECK_SIZE_AND_OFFSET(FILE, _fileno);
|
CHECK_SIZE_AND_OFFSET(FILE, _fileno);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk));
|
COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk));
|
||||||
CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit);
|
CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit);
|
||||||
CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev);
|
CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev);
|
||||||
|
@ -1284,7 +1267,7 @@ CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, read);
|
||||||
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, write);
|
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, write);
|
||||||
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, seek);
|
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, seek);
|
||||||
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, close);
|
CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, close);
|
||||||
#endif // SANITIZER_GLIBC
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_LINUX || SANITIZER_FREEBSD
|
#if SANITIZER_LINUX || SANITIZER_FREEBSD
|
||||||
CHECK_TYPE_SIZE(sem_t);
|
CHECK_TYPE_SIZE(sem_t);
|
||||||
|
|
|
@ -443,8 +443,6 @@ struct __sanitizer_cmsghdr {
|
||||||
int cmsg_type;
|
int cmsg_type;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
// In POSIX, int msg_iovlen; socklen_t msg_controllen; socklen_t cmsg_len; but
|
|
||||||
// many implementations don't conform to the standard.
|
|
||||||
struct __sanitizer_msghdr {
|
struct __sanitizer_msghdr {
|
||||||
void *msg_name;
|
void *msg_name;
|
||||||
unsigned msg_namelen;
|
unsigned msg_namelen;
|
||||||
|
|
|
@ -54,6 +54,10 @@ using namespace __tsan;
|
||||||
#define vfork __vfork14
|
#define vfork __vfork14
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SANITIZER_ANDROID
|
||||||
|
#define mallopt(a, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __mips__
|
#ifdef __mips__
|
||||||
const int kSigCount = 129;
|
const int kSigCount = 129;
|
||||||
#else
|
#else
|
||||||
|
@ -93,7 +97,7 @@ extern "C" void _exit(int status);
|
||||||
extern "C" int fileno_unlocked(void *stream);
|
extern "C" int fileno_unlocked(void *stream);
|
||||||
extern "C" int dirfd(void *dirp);
|
extern "C" int dirfd(void *dirp);
|
||||||
#endif
|
#endif
|
||||||
#if SANITIZER_GLIBC
|
#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_NETBSD
|
||||||
extern "C" int mallopt(int param, int value);
|
extern "C" int mallopt(int param, int value);
|
||||||
#endif
|
#endif
|
||||||
#if SANITIZER_NETBSD
|
#if SANITIZER_NETBSD
|
||||||
|
@ -2664,7 +2668,7 @@ void InitializeInterceptors() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Instruct libc malloc to consume less memory.
|
// Instruct libc malloc to consume less memory.
|
||||||
#if SANITIZER_GLIBC
|
#if SANITIZER_LINUX
|
||||||
mallopt(1, 0); // M_MXFAST
|
mallopt(1, 0); // M_MXFAST
|
||||||
mallopt(-3, 32*1024); // M_MMAP_THRESHOLD
|
mallopt(-3, 32*1024); // M_MMAP_THRESHOLD
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue