2012-12-13 16:50:16 +08:00
|
|
|
//===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines macro telling whether sanitizer tools can/should intercept
|
|
|
|
// given library functions on a given platform.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2013-04-24 19:06:05 +08:00
|
|
|
#ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
|
|
|
|
#define SANITIZER_PLATFORM_INTERCEPTORS_H
|
2012-12-13 16:50:16 +08:00
|
|
|
|
|
|
|
#include "sanitizer_internal_defs.h"
|
|
|
|
|
2013-03-19 22:33:38 +08:00
|
|
|
#if !SANITIZER_WINDOWS
|
2017-02-08 14:31:56 +08:00
|
|
|
# define SI_WINDOWS 0
|
2013-01-18 14:43:13 +08:00
|
|
|
# define SI_NOT_WINDOWS 1
|
2013-02-19 17:19:16 +08:00
|
|
|
# include "sanitizer_platform_limits_posix.h"
|
2012-12-13 16:50:16 +08:00
|
|
|
#else
|
2017-02-08 14:31:56 +08:00
|
|
|
# define SI_WINDOWS 1
|
2013-01-18 14:43:13 +08:00
|
|
|
# define SI_NOT_WINDOWS 0
|
2012-12-13 16:50:16 +08:00
|
|
|
#endif
|
|
|
|
|
2017-06-01 17:37:22 +08:00
|
|
|
#if SANITIZER_POSIX
|
|
|
|
# define SI_POSIX 1
|
|
|
|
#else
|
|
|
|
# define SI_POSIX 0
|
|
|
|
#endif
|
|
|
|
|
2013-03-19 22:33:38 +08:00
|
|
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
2013-01-18 14:43:13 +08:00
|
|
|
# define SI_LINUX_NOT_ANDROID 1
|
2012-12-13 16:50:16 +08:00
|
|
|
#else
|
2013-01-18 14:43:13 +08:00
|
|
|
# define SI_LINUX_NOT_ANDROID 0
|
2012-12-13 16:50:16 +08:00
|
|
|
#endif
|
|
|
|
|
2016-05-04 07:43:45 +08:00
|
|
|
#if SANITIZER_ANDROID
|
|
|
|
# define SI_ANDROID 1
|
|
|
|
#else
|
|
|
|
# define SI_ANDROID 0
|
|
|
|
#endif
|
|
|
|
|
2014-09-04 22:24:27 +08:00
|
|
|
#if SANITIZER_FREEBSD
|
|
|
|
# define SI_FREEBSD 1
|
|
|
|
#else
|
|
|
|
# define SI_FREEBSD 0
|
|
|
|
#endif
|
|
|
|
|
2017-07-18 04:49:13 +08:00
|
|
|
#if SANITIZER_NETBSD
|
|
|
|
# define SI_NETBSD 1
|
|
|
|
#else
|
|
|
|
# define SI_NETBSD 0
|
|
|
|
#endif
|
|
|
|
|
2013-03-19 22:33:38 +08:00
|
|
|
#if SANITIZER_LINUX
|
2013-02-20 23:27:58 +08:00
|
|
|
# define SI_LINUX 1
|
|
|
|
#else
|
|
|
|
# define SI_LINUX 0
|
|
|
|
#endif
|
|
|
|
|
2013-04-01 22:47:21 +08:00
|
|
|
#if SANITIZER_MAC
|
|
|
|
# define SI_MAC 1
|
2016-03-24 05:24:28 +08:00
|
|
|
# define SI_NOT_MAC 0
|
2013-04-01 22:47:21 +08:00
|
|
|
#else
|
|
|
|
# define SI_MAC 0
|
2016-03-24 05:24:28 +08:00
|
|
|
# define SI_NOT_MAC 1
|
2013-04-01 22:47:21 +08:00
|
|
|
#endif
|
|
|
|
|
2013-11-01 01:38:18 +08:00
|
|
|
#if SANITIZER_IOS
|
|
|
|
# define SI_IOS 1
|
|
|
|
#else
|
|
|
|
# define SI_IOS 0
|
|
|
|
#endif
|
|
|
|
|
2016-03-22 05:36:17 +08:00
|
|
|
#if !SANITIZER_WINDOWS && !SANITIZER_MAC
|
|
|
|
# define SI_UNIX_NOT_MAC 1
|
|
|
|
#else
|
|
|
|
# define SI_UNIX_NOT_MAC 0
|
|
|
|
#endif
|
|
|
|
|
2017-06-01 17:37:22 +08:00
|
|
|
#if SANITIZER_LINUX && !SANITIZER_FREEBSD
|
|
|
|
# define SI_LINUX_NOT_FREEBSD 1
|
|
|
|
# else
|
|
|
|
# define SI_LINUX_NOT_FREEBSD 0
|
|
|
|
#endif
|
|
|
|
|
2016-03-11 08:45:49 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRLEN 1
|
2016-03-24 05:24:28 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRNLEN SI_NOT_MAC
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRCMP 1
|
2015-05-28 17:24:33 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRSTR 1
|
|
|
|
#define SANITIZER_INTERCEPT_STRCASESTR SI_NOT_WINDOWS
|
2017-03-24 05:39:52 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRTOK 1
|
2016-03-22 05:36:17 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRCHR 1
|
|
|
|
#define SANITIZER_INTERCEPT_STRCHRNUL SI_UNIX_NOT_MAC
|
|
|
|
#define SANITIZER_INTERCEPT_STRRCHR 1
|
2015-05-28 17:24:33 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRSPN 1
|
|
|
|
#define SANITIZER_INTERCEPT_STRPBRK 1
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TEXTDOMAIN SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_STRCASECMP SI_NOT_WINDOWS
|
[sanitizer] Add memset, memmove, and memcpy to the common interceptors
Summary:
Currently, sanitizer_common_interceptors.inc has an implicit, undocumented
assumption that the sanitizer including it has previously declared
interceptors for memset and memmove. Since the memset, memmove, and memcpy
routines require interception by many sanitizers, we add them to the
set of common interceptions, both to address the undocumented assumption
and to speed future tool development. They are intercepted under a new
flag intercept_intrin.
The tsan interceptors are removed in favor of the new common versions. The
asan and msan interceptors for these are more complex (they incur extra
interception steps and their function bodies are exposed to the compiler)
so they opt out of the common versions and keep their own.
Reviewers: vitalybuka
Subscribers: zhaoqin, llvm-commits, kcc
Differential Revision: http://reviews.llvm.org/D18465
llvm-svn: 264451
2016-03-26 03:33:45 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MEMSET 1
|
|
|
|
#define SANITIZER_INTERCEPT_MEMMOVE 1
|
|
|
|
#define SANITIZER_INTERCEPT_MEMCPY 1
|
2015-07-30 07:53:08 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MEMCMP 1
|
2017-06-01 17:37:22 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRNDUP SI_POSIX
|
|
|
|
#define SANITIZER_INTERCEPT___STRNDUP SI_LINUX_NOT_FREEBSD
|
2017-02-03 14:58:14 +08:00
|
|
|
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
|
|
|
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
|
|
|
|
# define SI_MAC_DEPLOYMENT_BELOW_10_7 1
|
|
|
|
#else
|
|
|
|
# define SI_MAC_DEPLOYMENT_BELOW_10_7 0
|
|
|
|
#endif
|
|
|
|
// memmem on Darwin doesn't exist on 10.6
|
2016-07-16 07:13:03 +08:00
|
|
|
// FIXME: enable memmem on Windows.
|
2017-02-03 14:58:14 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MEMMEM \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7)
|
2014-03-05 21:25:32 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MEMCHR 1
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MEMRCHR (SI_FREEBSD || SI_LINUX || SI_NETBSD)
|
2013-05-21 17:01:23 +08:00
|
|
|
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_READ SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PREAD SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_WRITE SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PWRITE SI_NOT_WINDOWS
|
2013-01-18 14:43:13 +08:00
|
|
|
|
2017-03-30 15:25:33 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FREAD SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_FWRITE SI_NOT_WINDOWS
|
|
|
|
|
2013-06-24 18:43:23 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PREAD64 SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PWRITE64 SI_LINUX_NOT_ANDROID
|
|
|
|
|
|
|
|
#define SANITIZER_INTERCEPT_READV SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS
|
|
|
|
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PREADV \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-06-24 18:43:23 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID
|
|
|
|
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PRCTL SI_LINUX
|
|
|
|
|
|
|
|
#define SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_STRPTIME SI_NOT_WINDOWS
|
|
|
|
|
|
|
|
#define SANITIZER_INTERCEPT_SCANF SI_NOT_WINDOWS
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ISOC99_SCANF SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
|
2014-01-21 19:58:33 +08:00
|
|
|
#ifndef SANITIZER_INTERCEPT_PRINTF
|
|
|
|
# define SANITIZER_INTERCEPT_PRINTF SI_NOT_WINDOWS
|
2017-07-18 06:49:46 +08:00
|
|
|
# define SANITIZER_INTERCEPT_PRINTF_L (SI_FREEBSD || SI_NETBSD)
|
2014-07-03 22:20:56 +08:00
|
|
|
# define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_LINUX_NOT_ANDROID
|
2014-01-21 19:58:33 +08:00
|
|
|
#endif
|
|
|
|
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FREXP 1
|
|
|
|
#define SANITIZER_INTERCEPT_FREXPF_FREXPL SI_NOT_WINDOWS
|
|
|
|
|
|
|
|
#define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2015-02-02 17:49:28 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETPWENT \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2014-03-28 21:03:55 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETPWENT_R \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_SETPWENT (SI_MAC || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_CLOCK_GETTIME (SI_FREEBSD || SI_NETBSD || SI_LINUX)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_WAIT SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_INET SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETADDRINFO SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETNAMEINFO SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETSOCKNAME SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETHOSTBYNAME SI_NOT_WINDOWS
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R (SI_FREEBSD || SI_LINUX)
|
|
|
|
#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R \
|
|
|
|
(SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_GETHOSTENT_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETSOCKOPT SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_ACCEPT SI_NOT_WINDOWS
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ACCEPT4 SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MODF SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_RECVMSG SI_NOT_WINDOWS
|
2016-06-17 08:43:11 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SENDMSG SI_NOT_WINDOWS
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETPEERNAME SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_IOCTL SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_INET_ATON SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_SYSINFO SI_LINUX
|
|
|
|
#define SANITIZER_INTERCEPT_READDIR SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_READDIR64 SI_LINUX_NOT_ANDROID
|
2016-01-20 06:02:12 +08:00
|
|
|
#if SI_LINUX_NOT_ANDROID && \
|
2015-06-26 04:50:18 +08:00
|
|
|
(defined(__i386) || defined(__x86_64) || defined(__mips64) || \
|
2016-04-26 18:41:30 +08:00
|
|
|
defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
|
|
|
|
defined(__s390__))
|
2016-01-20 06:02:12 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTRACE 1
|
|
|
|
#else
|
|
|
|
#define SANITIZER_INTERCEPT_PTRACE 0
|
|
|
|
#endif
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SETLOCALE SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_GETCWD SI_NOT_WINDOWS
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GET_CURRENT_DIR_NAME SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRTOIMAX SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_MBSTOWCS SI_NOT_WINDOWS
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MBSNRTOWCS (SI_MAC || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS
|
2014-12-22 22:45:30 +08:00
|
|
|
#define SANITIZER_INTERCEPT_WCSNRTOMBS \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2015-08-26 08:14:08 +08:00
|
|
|
#define SANITIZER_INTERCEPT_WCRTOMB \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID
|
2015-01-21 16:56:40 +08:00
|
|
|
#define SANITIZER_INTERCEPT_CONFSTR \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
|
2015-01-22 22:03:07 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SCHED_GETPARAM SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STRERROR SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_STRERROR_R SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_XPG_STRERROR_R SI_LINUX_NOT_ANDROID
|
2015-05-07 20:14:32 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SCANDIR \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SCANDIR64 SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_GETGROUPS SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_POLL SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PPOLL SI_LINUX_NOT_ANDROID
|
2014-12-22 20:21:35 +08:00
|
|
|
#define SANITIZER_INTERCEPT_WORDEXP \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SIGWAIT SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_SIGWAITINFO SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_SIGTIMEDWAIT SI_LINUX_NOT_ANDROID
|
2014-09-06 15:46:55 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SIGSETOPS \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SIGPENDING SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_SIGPROCMASK SI_NOT_WINDOWS
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_BACKTRACE \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
|
|
|
|
#define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STATFS \
|
|
|
|
(SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STATFS64 \
|
2017-07-18 06:49:46 +08:00
|
|
|
((SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID)
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STATVFS \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_INITGROUPS SI_NOT_WINDOWS
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ETHER_NTOA_ATON SI_NOT_WINDOWS
|
2015-02-02 18:00:23 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ETHER_HOST \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
|
|
|
|
#define SANITIZER_INTERCEPT_SHMCTL \
|
|
|
|
(SI_NETBSD || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \
|
|
|
|
SANITIZER_WORDSIZE == 64)) // NOLINT
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID
|
2014-06-19 18:19:57 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETTYPE SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPROTOCOL \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2014-06-19 18:19:57 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPRIOCEILING \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2014-06-19 18:19:57 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETKIND_NP SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETPSHARED SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GETCLOCK SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GETPSHARED SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TMPNAM SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_TMPNAM_R SI_LINUX_NOT_ANDROID
|
2016-09-10 07:09:34 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TTYNAME_R SI_NOT_WINDOWS
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TEMPNAM SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_SINCOS SI_LINUX
|
|
|
|
#define SANITIZER_INTERCEPT_REMQUO SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_LGAMMA SI_NOT_WINDOWS
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_LGAMMA_R (SI_FREEBSD || SI_LINUX)
|
2014-07-03 22:20:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
|
2015-05-07 20:11:10 +08:00
|
|
|
#define SANITIZER_INTERCEPT_RAND_R \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ICONV \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS
|
2013-04-24 19:06:05 +08:00
|
|
|
|
2013-10-31 09:17:41 +08:00
|
|
|
// FIXME: getline seems to be available on OSX 10.7
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETLINE \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-10-31 09:17:41 +08:00
|
|
|
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT__EXIT \
|
|
|
|
(SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC)
|
2013-10-03 23:22:29 +08:00
|
|
|
|
2013-12-30 17:22:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PHTREAD_MUTEX SI_NOT_WINDOWS
|
2014-10-24 17:23:06 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2013-10-16 16:20:31 +08:00
|
|
|
|
2014-11-25 21:08:02 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TLS_GET_ADDR \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
|
2014-01-29 17:29:16 +08:00
|
|
|
|
2014-01-30 20:21:12 +08:00
|
|
|
#define SANITIZER_INTERCEPT_LISTXATTR SI_LINUX
|
|
|
|
#define SANITIZER_INTERCEPT_GETXATTR SI_LINUX
|
2014-02-06 23:12:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETRESID SI_LINUX
|
2015-05-06 17:24:02 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETIFADDRS \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
|
2015-05-11 22:46:16 +08:00
|
|
|
#define SANITIZER_INTERCEPT_IF_INDEXTONAME \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
|
2014-02-13 03:29:49 +08:00
|
|
|
#define SANITIZER_INTERCEPT_CAPGET SI_LINUX_NOT_ANDROID
|
2016-01-20 06:02:12 +08:00
|
|
|
#if SI_LINUX && defined(__arm__)
|
|
|
|
#define SANITIZER_INTERCEPT_AEABI_MEM 1
|
|
|
|
#else
|
|
|
|
#define SANITIZER_INTERCEPT_AEABI_MEM 0
|
|
|
|
#endif
|
2014-03-27 22:20:34 +08:00
|
|
|
#define SANITIZER_INTERCEPT___BZERO SI_MAC
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FTIME (!SI_FREEBSD && !SI_NETBSD && SI_NOT_WINDOWS)
|
2014-04-04 22:51:23 +08:00
|
|
|
#define SANITIZER_INTERCEPT_XDR SI_LINUX_NOT_ANDROID
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TSEARCH \
|
|
|
|
(SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD)
|
2014-04-25 21:26:21 +08:00
|
|
|
#define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_LINUX_NOT_ANDROID
|
2014-05-13 16:36:31 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FOPEN SI_NOT_WINDOWS
|
2014-05-13 20:05:38 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FOPEN64 SI_LINUX_NOT_ANDROID
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM (SI_LINUX_NOT_ANDROID || SI_NETBSD)
|
2014-05-07 19:50:56 +08:00
|
|
|
#define SANITIZER_INTERCEPT_OBSTACK SI_LINUX_NOT_ANDROID
|
2014-05-13 16:36:31 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FFLUSH SI_NOT_WINDOWS
|
|
|
|
#define SANITIZER_INTERCEPT_FCLOSE SI_NOT_WINDOWS
|
2016-05-19 00:05:52 +08:00
|
|
|
|
|
|
|
#ifndef SANITIZER_INTERCEPT_DLOPEN_DLCLOSE
|
2014-10-09 16:59:59 +08:00
|
|
|
#define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
|
2016-05-19 00:05:52 +08:00
|
|
|
#endif
|
|
|
|
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETPASS \
|
|
|
|
(SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD)
|
2014-08-07 22:21:42 +08:00
|
|
|
#define SANITIZER_INTERCEPT_TIMERFD SI_LINUX_NOT_ANDROID
|
2014-01-30 20:21:12 +08:00
|
|
|
|
2014-08-26 04:57:59 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MLOCKX SI_NOT_WINDOWS
|
2015-06-19 09:28:41 +08:00
|
|
|
#define SANITIZER_INTERCEPT_FOPENCOOKIE SI_LINUX_NOT_ANDROID
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SEM (SI_LINUX || SI_FREEBSD || SI_NETBSD)
|
2015-10-20 07:00:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PTHREAD_SETCANCEL SI_NOT_WINDOWS
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MINCORE (SI_LINUX || SI_NETBSD)
|
2015-10-23 04:35:42 +08:00
|
|
|
#define SANITIZER_INTERCEPT_PROCESS_VM_READV SI_LINUX
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_CTERMID \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_LINUX || SI_MAC || SI_FREEBSD || SI_NETBSD)
|
|
|
|
#define SANITIZER_INTERCEPT_CTERMID_R (SI_MAC || SI_FREEBSD)
|
2015-08-28 02:51:18 +08:00
|
|
|
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPTOR_HOOKS (SI_LINUX || SI_MAC || SI_WINDOWS)
|
2016-02-25 17:36:20 +08:00
|
|
|
#define SANITIZER_INTERCEPT_RECV_RECVFROM SI_NOT_WINDOWS
|
2016-06-17 08:43:11 +08:00
|
|
|
#define SANITIZER_INTERCEPT_SEND_SENDTO SI_NOT_WINDOWS
|
2016-06-25 07:32:30 +08:00
|
|
|
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX
|
2014-08-26 04:57:59 +08:00
|
|
|
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_STAT \
|
|
|
|
(SI_FREEBSD || SI_MAC || SI_ANDROID || SI_NETBSD)
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT___XSTAT \
|
|
|
|
(!SANITIZER_INTERCEPT_STAT && SI_NOT_WINDOWS)
|
2016-05-12 04:02:15 +08:00
|
|
|
#define SANITIZER_INTERCEPT___XSTAT64 SI_LINUX_NOT_ANDROID
|
|
|
|
#define SANITIZER_INTERCEPT___LXSTAT SANITIZER_INTERCEPT___XSTAT
|
|
|
|
#define SANITIZER_INTERCEPT___LXSTAT64 SI_LINUX_NOT_ANDROID
|
2016-12-16 06:00:14 +08:00
|
|
|
|
2017-07-18 06:49:46 +08:00
|
|
|
#define SANITIZER_INTERCEPT_UTMP (SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD)
|
|
|
|
#define SANITIZER_INTERCEPT_UTMPX (SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD)
|
2016-12-16 06:00:14 +08:00
|
|
|
|
2017-03-16 09:06:22 +08:00
|
|
|
#define SANITIZER_INTERCEPT_GETLOADAVG \
|
2017-07-18 06:49:46 +08:00
|
|
|
(SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD || SI_NETBSD)
|
2017-03-16 09:06:22 +08:00
|
|
|
|
2017-07-18 04:49:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
|
|
|
|
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
|
|
|
|
#define SANITIZER_INTERCEPT_MEMALIGN (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
|
|
|
|
#define SANITIZER_INTERCEPT_PVALLOC (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
|
|
|
|
#define SANITIZER_INTERCEPT_CFREE (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)
|
2017-02-14 05:06:13 +08:00
|
|
|
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC)
|
|
|
|
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC)
|
2017-05-03 15:09:10 +08:00
|
|
|
#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
|
2017-06-28 06:52:38 +08:00
|
|
|
#define SANITIZER_INTERCEPT_WCSCAT SI_NOT_WINDOWS
|
Recommit: Stop intercepting some malloc-related functions on FreeBSD and
macOS
Summary:
In https://bugs.freebsd.org/215125 I was notified that some configure
scripts attempt to test for the Linux-specific `mallinfo` and `mallopt`
functions by compiling and linking small programs which references the
functions, and observing whether that results in errors.
FreeBSD and macOS do not have the `mallinfo` and `mallopt` functions, so
normally these tests would fail, but when sanitizers are enabled, they
incorrectly succeed, because the sanitizers define interceptors for
these functions. This also applies to some other malloc-related
functions, such as `memalign`, `pvalloc` and `cfree`.
Fix this by not intercepting `mallinfo`, `mallopt`, `memalign`,
`pvalloc` and `cfree` for FreeBSD and macOS, in all sanitizers.
Also delete the non-functional `cfree` wrapper for Windows, to fix the
test cases on that platform.
Reviewers: emaste, kcc, rnk
Subscribers: timurrrr, eugenis, hans, joerg, llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D27654
llvm-svn: 293536
2017-01-31 03:06:13 +08:00
|
|
|
|
2013-04-24 19:06:05 +08:00
|
|
|
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
|