diff options
author | kcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-10 12:44:08 +0000 |
---|---|---|
committer | kcc <kcc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-10 12:44:08 +0000 |
commit | f5ed54288a2a1d1f8d99490f2529fc36b3d2c150 (patch) | |
tree | 23cebf7ab15836f70e055aee309f853c0c377de6 /libsanitizer/include | |
parent | efc3a86d56685d9e49ef92d2bfb175c1e67f0476 (diff) | |
download | gcc-f5ed54288a2a1d1f8d99490f2529fc36b3d2c150.tar.gz |
libsanitizer mege from upstream r171973
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195083 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer/include')
-rw-r--r-- | libsanitizer/include/sanitizer/asan_interface.h | 27 | ||||
-rw-r--r-- | libsanitizer/include/sanitizer/common_interface_defs.h | 12 |
2 files changed, 30 insertions, 9 deletions
diff --git a/libsanitizer/include/sanitizer/asan_interface.h b/libsanitizer/include/sanitizer/asan_interface.h index b94b303f3ac..47f780ceaa3 100644 --- a/libsanitizer/include/sanitizer/asan_interface.h +++ b/libsanitizer/include/sanitizer/asan_interface.h @@ -115,6 +115,15 @@ extern "C" { bool __asan_address_is_poisoned(void const volatile *addr) SANITIZER_INTERFACE_ATTRIBUTE; + // If at least on byte in [beg, beg+size) is poisoned, return the address + // of the first such byte. Otherwise return 0. + uptr __asan_region_is_poisoned(uptr beg, uptr size) + SANITIZER_INTERFACE_ATTRIBUTE; + + // Print the description of addr (useful when debugging in gdb). + void __asan_describe_address(uptr addr) + SANITIZER_INTERFACE_ATTRIBUTE; + // This is an internal function that is called to report an error. // However it is still a part of the interface because users may want to // set a breakpoint on this function in a debugger. @@ -138,7 +147,7 @@ extern "C" { // User may provide function that would be called right when ASan detects // an error. This can be used to notice cases when ASan detects an error, but // the program crashes before ASan report is printed. - void __asan_on_error() + /* OPTIONAL */ void __asan_on_error() SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; // User may provide its own implementation for symbolization function. @@ -146,7 +155,8 @@ extern "C" { // "out_buffer". Description should be at most "out_size" bytes long. // User-specified function should return true if symbolization was // successful. - bool __asan_symbolize(const void *pc, char *out_buffer, int out_size) + /* OPTIONAL */ bool __asan_symbolize(const void *pc, char *out_buffer, + int out_size) SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; // Returns the estimated number of bytes that will be reserved by allocator @@ -186,20 +196,19 @@ extern "C" { void __asan_print_accumulated_stats() SANITIZER_INTERFACE_ATTRIBUTE; - // This function may be overriden by user to provide a string containing - // ASan runtime options. See asan_flags.h for details. - const char* __asan_default_options() + // This function may be optionally provided by user and should return + // a string containing ASan runtime options. See asan_flags.h for details. + /* OPTIONAL */ const char* __asan_default_options() SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; - // Malloc hooks that may be overriden by user. + // Malloc hooks that may be optionally provided by user. // __asan_malloc_hook(ptr, size) is called immediately after // allocation of "size" bytes, which returned "ptr". // __asan_free_hook(ptr) is called immediately before // deallocation of "ptr". - // If user doesn't provide implementations of these hooks, they are no-op. - void __asan_malloc_hook(void *ptr, uptr size) + /* OPTIONAL */ void __asan_malloc_hook(void *ptr, uptr size) SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; - void __asan_free_hook(void *ptr) + /* OPTIONAL */ void __asan_free_hook(void *ptr) SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; } // extern "C" diff --git a/libsanitizer/include/sanitizer/common_interface_defs.h b/libsanitizer/include/sanitizer/common_interface_defs.h index f6e814df6f5..9fba976a041 100644 --- a/libsanitizer/include/sanitizer/common_interface_defs.h +++ b/libsanitizer/include/sanitizer/common_interface_defs.h @@ -28,6 +28,12 @@ # define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak)) #endif +#ifdef __linux__ +# define SANITIZER_SUPPORTS_WEAK_HOOKS 1 +#else +# define SANITIZER_SUPPORTS_WEAK_HOOKS 0 +#endif + // __has_feature #if !defined(__has_feature) # define __has_feature(x) 0 @@ -73,6 +79,12 @@ extern "C" { // stderr. void __sanitizer_set_report_fd(int fd) SANITIZER_INTERFACE_ATTRIBUTE; + + // Notify the tools that the sandbox is going to be turned on. The reserved + // parameter will be used in the future to hold a structure with functions + // that the tools may call to bypass the sandbox. + void __sanitizer_sandbox_on_notify(void *reserved) + SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE; } // extern "C" #endif // SANITIZER_COMMON_INTERFACE_DEFS_H |