summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_interface_internal.h
Commit message (Collapse)AuthorAgeFilesLines
* [asan] Fix lint failure in asan_interface.hEvgenii Stepanov2019-10-311-1/+2
|
* [asan] Provide an interface to update an allocation stack trace.Evgenii Stepanov2019-10-311-0/+2
| | | | | | | | | | | | | | 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
* [hwasan, asan] Intercept vfork.Evgeniy Stepanov2019-02-271-0/+2
| | | | | | | | | | | | | | | Summary: Intercept vfork on arm, aarch64, i386 and x86_64. Reviewers: pcc, vitalybuka Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58533 llvm-svn: 355030
* Revert "[asan] Fix vfork handling.", +1Evgeniy Stepanov2019-02-211-3/+0
| | | | | | Revert r354625, r354627 - multiple build failures. llvm-svn: 354629
* [hwasan,asan] Intercept vfork.Evgeniy Stepanov2019-02-211-0/+3
| | | | | | | | | | | | | | Summary: AArch64 only for now. Reviewers: vitalybuka, pcc Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, jdoerfert, #sanitizers, llvm-commits, kcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58313 llvm-svn: 354625
* 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
* [asan] Fix dead stripping of globals on Linux (compiler-rt).Evgeniy Stepanov2017-04-271-0/+5
| | | | | | | Third attempt. See the description of the corresponding commit in LLVM for more details. llvm-svn: 301588
* Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)."Evgeniy Stepanov2017-04-101-5/+0
| | | | | | This reverts r299698, which caused a big increase in object file size. llvm-svn: 299881
* [asan] Fix dead stripping of globals on Linux (compiler-rt).Evgeniy Stepanov2017-04-061-0/+5
| | | | | | This is a re-land of r298173, r298169, r298159. llvm-svn: 299698
* Revert r298174, r298173, r298169, r298159.Evgeniy Stepanov2017-03-201-5/+0
| | | | | | | | | | | Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF." Revert "[asan] Remove gc-sections test with bfd." Revert "[asan] Disable globals-gc test with ld.bfd." Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)" OOM in gold linker. llvm-svn: 298287
* [asan] Fix dead stripping of globals on Linux (compiler-rt)Evgeniy Stepanov2017-03-171-0/+5
| | | | | | | | Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests. Differential Revision: https://reviews.llvm.org/D30120 llvm-svn: 298159
* [sanitizer] Add list of symbols exported in sanitizers' interface.Marcos Pividori2017-01-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new auxiliary file to each sanitizer: sanitizer_interface.inc, listing all the functions exported, with the macros: INTERFACE_FUNCTION() and INTERFACE_WEAK_FUNCTION(). So, when we need to define or repeat a procedure for each function in the sanitizer's interface, we can define the macros and include that header. In particular, these files are needed for Windows, in the nexts commits. Also, this files could replace the existing files: weak_symbols.txt for Apple. Instead of reading weak_symbols.txt to get the list of weak symbols, we could read the file sanitizer_interface.inc and consider all the symbols included with the macro INTERFACE_WEAK_FUNCTION(Name). In this commit, I only include these files to the sanitizers that work on Windows. We could do the same for the rest of the sanitizers when needed. I updated tests for: Linux, Darwin and Windows. If a new function is exported but is not present in the interface list, the tests "interface_symbols_[darwin|windows|linux].c" fail. Also, I remove the comments: "/* OPTIONAL */" which are not required any more, because we use the macro: INTERFACE_WEAK_FUNCTION() for weak functions. Differential Revision: https://reviews.llvm.org/D29148 llvm-svn: 293682
* [asan] Fix tests for exported interfaces.Marcos Pividori2017-01-291-1/+1
| | | | | | | | Add "OPTIONAL" comment to declaration of weak function in the internal interface. This fix the tests `interface_symbols_linux.c` and `interface_symbols_darwin.c` which were failing after r293423. llvm-svn: 293442
* [asan] Add missing declaration in the internal interfaceMarcos Pividori2017-01-291-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D29230 llvm-svn: 293423
* [compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron2016-09-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding support for dynamic shadow allocation. This is a merge and re-commit of the following patches. ``` [compiler-rt] Fix Asan build on Android https://reviews.llvm.org/D24768 [compiler-rt] Add support for the dynamic shadow allocation https://reviews.llvm.org/D23363 ``` This patch needed to re-land at the same time: ``` [asan] Support dynamic shadow address instrumentation https://reviews.llvm.org/D23354 ``` Reviewers: rnk, zaks.anna Subscribers: tberghammer, danalbert, kubabrecka, dberris, chrisha, llvm-commits Differential Revision: https://reviews.llvm.org/D25104 llvm-svn: 282882
* revert 282085, 281909, they broke 32-bit dynamic ASan and the ↵Nico Weber2016-09-211-7/+0
| | | | | | sanitizer-windows bot llvm-svn: 282096
* [compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron2016-09-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding the needed code to compiler-rt to support dynamic shadow. This is to support this patch: https://reviews.llvm.org/D23354 It's adding support for using a shadow placed at a dynamic address determined at runtime. The dynamic shadow is required to work on windows 64-bits. Reviewers: rnk, kcc, vitalybuka Subscribers: kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23363 llvm-svn: 281909
* [compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks2016-09-151-0/+2
| | | | | | | | | | | | The definitions in sanitizer_common may conflict with definitions from system headers because: The runtime includes the system headers after the project headers (as per LLVM coding guidelines). lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry. Differential Revision: https://reviews.llvm.org/D21947 llvm-svn: 281657
* [asan] Remove runtime flag detect_stack_use_after_scopeVitaly Buka2016-08-291-4/+0
| | | | | | | | | | | | | | | Summary: We are going to use store instructions to poison some allocas. Runtime flag will require branching in instrumented code on every lifetime intrinsic. We'd like to avoid that. Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23967 llvm-svn: 279981
* [asan] Add __asan_set_shadow_*Vitaly Buka2016-08-181-0/+14
| | | | | | | | | | | | | | | | Summary: We are poisoning small allocas using store instruction from instrumented code. For larger allocas we'd like to insert function calls instead of multiple stores. PR27453 Reviewers: kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23616 llvm-svn: 279019
* Add detect_stack_use_after_scope runtime flagVitaly Buka2016-07-191-0/+4
| | | | | | | | | | Summary: This flag could be used to disable check in runtime. Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D22495 llvm-svn: 276004
* [asan] Add runtime support for __asan_(un)register_image_globalsRyan Govostes2016-03-281-0/+8
| | | | | | | | | | | This change introduces routines that register and unregister all instrumented globals in a loaded executable image. These routines are only implemented on Darwin, where globals metadata is expected to be placed in the __DATA,__asan_globals section. Review: http://reviews.llvm.org/D16841 llvm-svn: 264644
* [asan] Introduce new approach for ODR violation detection based on odr ↵Maxim Ostapenko2016-02-081-0/+1
| | | | | | | | | | | | | | indicator symbols. This is a compiler-rt part of this http://reviews.llvm.org/D15642 patch. Here, we add a new approach for ODR violation detection. Instead of using __asan_region_is_poisoned(g->beg, g->size_with_redzone) on global address (that would return false now due to using private alias), we can use new globally visible indicator symbol to perform the check. Differential Revision: http://reviews.llvm.org/D15644 llvm-svn: 260076
* [ASan] Enable optional ASan recovery.Yury Gribov2015-11-111-0/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D12318 llvm-svn: 252723
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-211-2/+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] Rename the ABI versioning symbol to '__asan_version_mismatch_check' ↵Kuba Brecka2015-07-231-2/+6
| | | | | | | | | | instead of abusing '__asan_init' We currently version `__asan_init` and when the ABI version doesn't match, the linker gives a `undefined reference to '__asan_init_v5'` message. From this, it might not be obvious that it's actually a version mismatch error. This patch makes the error message much clearer by changing the name of the undefined symbol to be `__asan_version_mismatch_check_xxx` (followed by the version string). We obviously don't want the initializer to be named like that, so it's a separate symbol that is used only for the purpose of version checking. Reviewed at http://reviews.llvm.org/D11004 llvm-svn: 243004
* [ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!Yury Gribov2015-05-281-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D7098 llvm-svn: 238401
* asan: optimization experimentsDmitry Vyukov2015-03-171-1/+16
| | | | | | | | | | | | | | | | | | | | The experiments can be used to evaluate potential optimizations that remove instrumentation (assess false negatives). Instead of completely removing some instrumentation, you set Exp to a non-zero value (mask of optimization experiments that want to remove instrumentation of this instruction). If Exp is non-zero, this pass will emit special calls into runtime (e.g. __asan_report_exp_load1 instead of __asan_report_load1). These calls make runtime terminate the program in a special way (with a different exit status). Then you run the new compiler on a buggy corpus, collect the special terminations (ideally, you don't see them at all -- no false negatives) and make the decision on the optimization. The exact reaction to experiments in runtime is not implemented in this patch. It will be defined and implemented in a subsequent patch. http://reviews.llvm.org/D8198 llvm-svn: 232501
* [Sanitizers] Move the common sanitizer interface from ↵Timur Iskhodzhanov2015-02-191-2/+5
| | | | | | | | sanitizer_internal_defs.h to a new sanitizer_interface_internal.h file Reviewed at http://reviews.llvm.org/D7758 llvm-svn: 229858
* Revert "[ASan] Add the new __asan_mz_* symbols to asan_interface_internal.h"Juergen Ributzka2015-02-041-18/+0
| | | | | | Reverting r228137 to unbreak the build bots. llvm-svn: 228172
* [ASan] Add the new __asan_mz_* symbols to asan_interface_internal.hAlexander Potapenko2015-02-041-0/+18
| | | | | | to fix the interface_symbols_darwin.c test. llvm-svn: 228137
* [asan] the run-time part of intra-object-overflow detector ↵Kostya Serebryany2014-10-171-0/+4
| | | | | | (-fsanitize-address-field-padding=1). Note that all of this is still experimental; don't use unless you are brave. llvm-svn: 220013
* [compiler-rt] recommit of r218481: ASan debugging API for report info ↵Kuba Brecka2014-09-261-0/+22
| | | | | | | | | | 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-22/+0
| | | | llvm-svn: 218501
* [compiler-rt] ASan debugging API for report info extraction and locating ↵Kuba Brecka2014-09-251-0/+22
| | | | | | | | | | 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
* [asan] introduce __asan_load_cxx_array_cookie: check that the array cookie ↵Kostya Serebryany2014-08-281-0/+2
| | | | | | address is properly poisoned and return the cookie value. If not, return 0 to avoid infinite loop of DTORs (in case of use-after-free). Calls to this function will be inserted by clang (separate change) llvm-svn: 216692
* [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in ↵Alexey Samsonov2014-08-121-16/+0
| | | | | | | | favor of a unified interface in <sanitizer/allocator_interface.h>. llvm-svn: 215469
* [asan] introduce __asan_poison_cxx_array_cookie. This is asan-rt part of ↵Kostya Serebryany2014-08-041-0/+3
| | | | | | PR19838 (Left OOB accesses on new[]-allocated arrays with array cookies are not detected). No tests yet. They will follow once I commit the clang part. llvm-svn: 214711
* [ASan] Add ASan debugging API to get malloc/free stack traces and shadow ↵Kuba Brecka2014-07-151-0/+11
| | | | | | | | memory mapping info Reviewed at http://reviews.llvm.org/D4466 llvm-svn: 213080
* [ASan] Only define macros in asan_init_version.h, move the __asan_init ↵Timur Iskhodzhanov2014-07-151-0/+6
| | | | | | | | | | declaration back to asan_interface_internal.h This fixes the issues we've uncovered after landing r212815. Reviewed at http://reviews.llvm.org/D4500 llvm-svn: 213053
* [ASan/Win] Don't hardcode ASan runtime version in ASan dll thunkTimur Iskhodzhanov2014-07-101-14/+2
| | | | | | Reviewed at http://reviews.llvm.org/D4459 llvm-svn: 212699
* Generalize sanitizer allocator public interface.Alexey Samsonov2014-07-071-6/+8
| | | | | | | | | | | | | | 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] Print exact source location of global variables in error reports.Alexey Samsonov2014-07-021-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the original feature request. Introduce llvm.asan.globals metadata, which Clang (or any other frontend) may use to report extra information about global variables to ASan instrumentation pass in the backend. This metadata replaces llvm.asan.dynamically_initialized_globals that was used to detect init-order bugs. llvm.asan.globals contains the following data for each global: 1) source location (file/line/column info); 2) whether it is dynamically initialized; 3) whether it is blacklisted (shouldn't be instrumented). Source location data is then emitted in the binary and can be picked up by ASan runtime in case it needs to print error report involving some global. For example: 0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40 These source locations are printed even if the binary doesn't have any debug info. This is an ABI-breaking change. ASan initialization is renamed to __asan_init_v4(). Pre-built libraries compiled with older Clang will not work with the fresh runtime. llvm-svn: 212188
* Fix typosAlp Toker2014-05-151-1/+1
| | | | llvm-svn: 208841
* [asan] add __asan_memset and friendsKostya Serebryany2014-04-211-0/+7
| | | | llvm-svn: 206748
* [asan] implement __asan_loadN/__asan_storeN for out-lined asan checksKostya Serebryany2014-04-211-0/+2
| | | | llvm-svn: 206733
* [asan] add __asan_load1/__asan_store1/... callbacks to asan-rt; together ↵Kostya Serebryany2014-04-161-0/+14
| | | | | | with -mllvm -asan-instrumentation-with-call-threshold=N this will be a workaround for PR17409 llvm-svn: 206387
* [asan] don't use bool in public interface, make sure the interface headers ↵Kostya Serebryany2014-04-141-3/+3
| | | | | | are usable in plain C llvm-svn: 206160
* [ASan] Get rid of __asan_symbolize functionAlexey Samsonov2013-12-191-4/+0
| | | | llvm-svn: 197670
* [asan] add a run-time option detect_stack_use_after_return, add verbosity ↵Kostya Serebryany2013-09-181-0/+4
| | | | | | output for fake stack llvm-svn: 190932
OpenPOWER on IntegriCloud