summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include/sanitizer/asan_interface.h
Commit message (Collapse)AuthorAgeFilesLines
* [asan] Provide an interface to update an allocation stack trace.Evgenii Stepanov2019-10-311-0/+4
| | | | | | | | | | | | | | Summary: Sometimes an allocation stack trace is not very informative. Provide a way to replace it with a stack trace of the user's choice. Reviewers: pcc, kcc Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69208
* [compiler-rt] Update comments in asan header to doxygen format; NFC.Pierre Gousseau2019-06-111-117/+285
| | | | | | | | | | | | | Add description to undocumented functions. Improve spelling, grammar and formatting. Patch by: Craig Flores, Filipe Cabecinhas, Pierre Gousseau Reviewed By: Johannes Doerfert Differential Revision: https://reviews.llvm.org/D62245 llvm-svn: 363038
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [sanitizer] Make function declarations C-compatiblePetr Hosek2017-12-211-12/+12
| | | | | | | | | | | | | | | | | The public sanitizer headers are intended to be usable from either C++ or C, but they declare no-argument functions with the syntax that is not a proper prototype declaration in C. This goes unnoticed until someone uses -Wsystem-headers. Patch By: mcgrathr Reviewers: phosek, vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D41475 llvm-svn: 321305
* [ASAN] Revert r313303 - Add macro denoting availability of new ↵Eric Fiselier2017-09-141-4/+0
| | | | | | | | | | `__asan_handle_no_return()` function. It was pointed out that compiler-rt has always defined the symbol, but only recently added it to the public headers. Meaning that libc++abi can re-declare it instead of needing this macro. llvm-svn: 313306
* [ASAN] Add macro denoting availability of new `__asan_handle_no_return()` ↵Eric Fiselier2017-09-141-0/+4
| | | | | | | | | | | | | | | | | | | function. Summary: Libc++abi attempts to use the newly added `__asan_handle_no_return()` when built under ASAN. Unfortunately older versions of compiler-rt do not provide this symbol, and so libc++abi needs a way to detect if `asan_interface.h` actually provides the function. This patch adds the macro `SANITIZER_ASAN_INTERFACE_HAS_HANDLE_NO_RETURN` which can be used to detect the availability of the new function. Reviewers: phosek, kcc, vitalybuka, alekseyshl Reviewed By: phosek Subscribers: mclow.lists, cfe-commits Differential Revision: https://reviews.llvm.org/D37871 llvm-svn: 313303
* [asan] Move __asan_handle_no_return to public headerPetr Hosek2017-08-281-0/+4
| | | | | | | | | | | | | | Heretofore asan_handle_no_return was used only by interceptors, i.e. code private to the ASan runtime. However, on systems without interceptors, code like libc++abi is built with -fsanitize=address itself and should call asan_handle_no_return directly from __cxa_throw so that no interceptor is required. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D36811 llvm-svn: 311869
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all sanitizers. Summary: Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan into one entity. Additionally, make sure sanitizer_common now uses the value of common_flags()->exitcode when dying on error, so that this flag will automatically work for other sanitizers (UBSan and DFSan) as well. User-visible changes: * "exit_code" MSan runtime flag is now deprecated. If explicitly specified, this flag will take precedence over "exitcode". The users are encouraged to migrate to the new version. * __asan_set_error_exit_code() and __msan_set_exit_code() functions are removed. With few exceptions, we don't support changing runtime flags during program execution - we can't make them thread-safe. The users should use __sanitizer_set_death_callback() that would call _exit() with proper exit code instead. * Plugin tools (LSan and UBSan) now inherit the exit code of the parent tool. In particular, this means that ASan would now crash the program with exit code "1" instead of "23" if it detects leaks. Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12120 llvm-svn: 245734
* [asan] introduce __sanitizer_set_death_callback, deprecate ↵Kostya Serebryany2014-12-151-2/+1
| | | | | | __asan_set_death_callback llvm-svn: 224286
* Fix minor typos in comments.Filipe Cabecinhas2014-10-131-1/+1
| | | | llvm-svn: 219632
* [compiler-rt] recommit of r218481: ASan debugging API for report info ↵Kuba Brecka2014-09-261-0/+26
| | | | | | | | | | extraction and locating addresses Reviewed at http://reviews.llvm.org/D4527 Fixed a test case failure on 32-bit Linux, I did right shift on intptr_t, instead it should have been uintptr_t. llvm-svn: 218538
* [compiler-rt] revert r218481 due to test failure on sanitizer-x86_64-linux Kuba Brecka2014-09-261-26/+0
| | | | llvm-svn: 218501
* [compiler-rt] ASan debugging API for report info extraction and locating ↵Kuba Brecka2014-09-251-0/+26
| | | | | | | | | | addresses Reviewed at http://reviews.llvm.org/D4527 This patch is part of an effort to implement a more generic debugging API, as proposed in http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/074656.html, with first part reviewed at http://reviews.llvm.org/D4466. Now adding several new APIs: __asan_report_present, __asan_get_report_{pc,bp,sp,address,type,size,description}, __asan_locate_address. These return whether an asan report happened yet, the PC, BP, SP, address, access type (read/write), access size and bug description (e.g. "heap-use-after-free"), __asan_locate_address takes a pointer and tries to locate it, i.e. say whether it is a heap pointer, a global or a stack, or whether it's a pointer into the shadow memory. If global or stack, tries to also return the variable name, address and size. If heap, tries to return the chunk address and size. Generally these should serve as an alternative to "asan_describe_address", which only returns all the data in text form. Having an API to get these data could allow having debugging scripts/extensions that could show additional information about a variable/expression/pointer. Test cases in test/asan/TestCases/debug_locate.cc and test/asan/TestCasea/debug_report.cc. llvm-svn: 218481
* [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in ↵Alexey Samsonov2014-08-121-49/+0
| | | | | | | | favor of a unified interface in <sanitizer/allocator_interface.h>. llvm-svn: 215469
* [ASan] Add ASan debugging API to get malloc/free stack traces and shadow ↵Kuba Brecka2014-07-151-0/+16
| | | | | | | | memory mapping info Reviewed at http://reviews.llvm.org/D4466 llvm-svn: 213080
* Generalize sanitizer allocator public interface.Alexey Samsonov2014-07-071-0/+15
| | | | | | | | | | | | | | Introduce new public header <sanitizer/allocator_interface.h> and a set of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc. that will eventually replace their tool-specific equivalents (__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific functions are now deprecated and implemented as stubs redirecting to __sanitizer_ versions (which are implemented differently in each tool). Replace all uses of __xsan_ versions with __sanitizer_ versions in unit and lit tests. llvm-svn: 212469
* [asan] don't use bool in public interface, make sure the interface headers ↵Kostya Serebryany2014-04-141-6/+7
| | | | | | are usable in plain C llvm-svn: 206160
* [asan] introduce two functions that will allow implementations of C++ ↵Kostya Serebryany2014-02-061-0/+18
| | | | | | garbage colection to work with asan's fake stack llvm-svn: 200908
* [ASan] Get rid of __asan_symbolize functionAlexey Samsonov2013-12-191-8/+0
| | | | llvm-svn: 197670
* [asan] make asan work with 7fff8000 offset and prelinkKostya Serebryany2013-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When prelink is installed in the system, prelink-ed libraries map between 0x003000000000 and 0x004000000000 thus occupying the shadow Gap, so we need so split the address space even further, like this: || [0x10007fff8000, 0x7fffffffffff] || HighMem || || [0x02008fff7000, 0x10007fff7fff] || HighShadow || || [0x004000000000, 0x02008fff6fff] || ShadowGap3 || || [0x003000000000, 0x003fffffffff] || MidMem || || [0x00087fff8000, 0x002fffffffff] || ShadowGap2 || || [0x00067fff8000, 0x00087fff7fff] || MidShadow || || [0x00008fff7000, 0x00067fff7fff] || ShadowGap || || [0x00007fff8000, 0x00008fff6fff] || LowShadow || || [0x000000000000, 0x00007fff7fff] || LowMem || Do it only if necessary. Also added a bit of profiling code to make sure that the mapping code is efficient. Added a lit test to simulate prelink-ed libraries. Unfortunately, this test does not work with binutils-gold linker. If gold is the default linker the test silently passes. Also replaced __has_feature(address_sanitizer) with __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) in two places. Patch partially by Jakub Jelinek. llvm-svn: 175263
* [ASan] Split ASan interface header into private and public parts. Add a test ↵Alexey Samsonov2013-01-311-106/+31
| | | | | | that makes sure users can include interface header llvm-svn: 174058
* [asan] kill some dead codeKostya Serebryany2013-01-181-5/+0
| | | | llvm-svn: 172815
* [asan] add a new interface function __asan_describe_address, useful for ↵Kostya Serebryany2012-12-291-0/+4
| | | | | | running asan-ified binary under a debugger (e.g. gdb) llvm-svn: 171217
* [asan] one more change missed at r171198Kostya Serebryany2012-12-281-0/+5
| | | | llvm-svn: 171199
* ASan: change the strategy we use for installing malloc/free/symbolization ↵Alexey Samsonov2012-12-071-9/+9
| | | | | | hooks on Linux: don't provide a default no-op implementations for hooks in runtime, and optionally call hooks if they are provided by the user. Don't force weak interface functions into runtime. llvm-svn: 169641
* ASan: add new interface functions - __asan_(un)poison_stack_memory. Calls to ↵Alexey Samsonov2012-12-041-0/+9
| | | | | | these functions are inserted by the instrumentation pass in use-after-scope mode llvm-svn: 169201
* [ASan] Change __asan_set_on_error_callback to weak overridable ↵Alexey Samsonov2012-10-021-6/+5
| | | | | | __asan_on_error, so that ASan would call the latter even if it finds the error early (i.e. during module initialization) llvm-svn: 165008
* [Sanitizer/ASan] Simplify the code that prints and symbolizes stack traces. ↵Alexey Samsonov2012-10-021-7/+5
| | | | | | Fall back to module+offset if user-provided symbolizer failed. Use weak function __asan_symbolize instead of __asan_set_symbolize_callback in ASan interface, so that we're able to symbolize reports for errors that happen before the main() is called, for example, during module initialization. llvm-svn: 165000
* Relocate the external headers provided by ASan and the common sanitizerChandler Carruth2012-08-291-0/+202
library. These headers are intended to be available to user code when built with AddressSanitizer (or one of the other sanitizer's in the future) to interface with the runtime library. As such, they form stable external C interfaces, and the headers shouldn't be located within the implementation. I've pulled them out into what seem like fairly obvious locations and names, but I'm wide open to further bikeshedding of these names and locations. I've updated the code and the build system to cope with the new locations, both CMake and Makefile. Please let me know if this breaks anyone's build. The eventual goal is to install these headers along side the Clang builtin headers when we build the ASan runtime and install it. My current thinking is to locate them at: <prefix>/lib/clang/X.Y/include/sanitizer/common_interface_defs.h <prefix>/lib/clang/X.Y/include/sanitizer/asan_interface.h <prefix>/lib/clang/X.Y/include/sanitizer/... But maybe others have different suggestions? Fixing the style of the #include between these headers at least unblocks experimentation with installing them as they now should work when installed in these locations. llvm-svn: 162822
OpenPOWER on IntegriCloud