1 //===-- sanitizer/common_interface_defs.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 // Common part of the public sanitizer interface. 11 //===----------------------------------------------------------------------===// 12 13 #ifndef SANITIZER_COMMON_INTERFACE_DEFS_H 14 #define SANITIZER_COMMON_INTERFACE_DEFS_H 15 16 #include <stddef.h> 17 #include <stdint.h> 18 19 // GCC does not understand __has_feature. 20 #if !defined(__has_feature) 21 # define __has_feature(x) 0 22 #endif 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 // Tell the tools to write their reports to "path.<pid>" instead of stderr. 28 void __sanitizer_set_report_path(const char *path); 29 30 // Tell the tools to write their reports to given file descriptor instead of 31 // stderr. 32 void __sanitizer_set_report_fd(int fd); 33 34 // Notify the tools that the sandbox is going to be turned on. The reserved 35 // parameter will be used in the future to hold a structure with functions 36 // that the tools may call to bypass the sandbox. 37 void __sanitizer_sandbox_on_notify(void *reserved); 38 39 // This function is called by the tool when it has just finished reporting 40 // an error. 'error_summary' is a one-line string that summarizes 41 // the error message. This function can be overridden by the client. 42 void __sanitizer_report_error_summary(const char *error_summary); 43 44 // Some of the sanitizers (e.g. asan/tsan) may miss bugs that happen 45 // in unaligned loads/stores. In order to find such bugs reliably one needs 46 // to replace plain unaligned loads/stores with these calls. 47 uint16_t __sanitizer_unaligned_load16(const void *p); 48 uint32_t __sanitizer_unaligned_load32(const void *p); 49 uint64_t __sanitizer_unaligned_load64(const void *p); 50 void __sanitizer_unaligned_store16(void *p, uint16_t x); 51 void __sanitizer_unaligned_store32(void *p, uint32_t x); 52 void __sanitizer_unaligned_store64(void *p, uint64_t x); 53 54 #ifdef __cplusplus 55 } // extern "C" 56 #endif 57 58 #endif // SANITIZER_COMMON_INTERFACE_DEFS_H 59