1 //===-- asan_interceptors.h -------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of AddressSanitizer, an address sanity checker. 11 // 12 // ASan-private header for asan_interceptors.cc 13 //===----------------------------------------------------------------------===// 14 #ifndef ASAN_INTERCEPTORS_H 15 #define ASAN_INTERCEPTORS_H 16 17 #include "asan_internal.h" 18 #include "interception/interception.h" 19 20 DECLARE_REAL(int, memcmp, const void *a1, const void *a2, size_t size); 21 DECLARE_REAL(void*, memcpy, void *to, const void *from, size_t size); 22 DECLARE_REAL(void*, memset, void *block, int c, size_t size); 23 DECLARE_REAL(char*, strchr, const char *str, int c); 24 DECLARE_REAL(size_t, strlen, const char *s); 25 DECLARE_REAL(char*, strncpy, char *to, const char *from, size_t size); 26 DECLARE_REAL(size_t, strnlen, const char *s, size_t maxlen); 27 struct sigaction; 28 DECLARE_REAL(int, sigaction, int signum, const struct sigaction *act, 29 struct sigaction *oldact); 30 31 namespace __asan { 32 33 // __asan::internal_X() is the implementation of X() for use in RTL. 34 int64_t internal_atoll(const char *nptr); 35 size_t internal_strlen(const char *s); 36 size_t internal_strnlen(const char *s, size_t maxlen); 37 char* internal_strchr(const char *s, int c); 38 void* internal_memchr(const void* s, int c, size_t n); 39 void* internal_memset(void *s, int c, size_t n); 40 int internal_memcmp(const void* s1, const void* s2, size_t n); 41 char *internal_strstr(const char *haystack, const char *needle); 42 char *internal_strncat(char *dst, const char *src, size_t n); 43 int internal_strcmp(const char *s1, const char *s2); 44 char *internal_strncpy(char *dst, const char *src, size_t n); 45 // Works only for base=10 and doesn't set errno. 46 int64_t internal_simple_strtoll(const char *nptr, char **endptr, int base); 47 48 void InitializeAsanInterceptors(); 49 50 #if defined(__APPLE__) 51 void InitializeMacInterceptors(); 52 #endif // __APPLE__ 53 54 } // namespace __asan 55 56 #endif // ASAN_INTERCEPTORS_H 57