summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include/sanitizer
Commit message (Collapse)AuthorAgeFilesLines
* [compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30Kamil Rytarowski2019-12-241-1/+1
| | | | | Enable compat support for now legacy PT_LWPINFO. Support PT_LWPSTATUS and PT_LWPNEXT.
* [compiler-rt] Sync NetBSD syscall hooks with 9.99.17Kamil Rytarowski2019-11-031-42/+123
| | | | | Document the minimal version supported as 9.0 and add compat code for renamed syscalls after 9.0.
* [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] Add ubsan interface header.Pierre Gousseau2019-09-131-0/+32
| | | | | | | | | | This is to document __ubsan_default_options(). Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D67503 llvm-svn: 371822
* [dfsan] Revert dfsan_set_label removalVitaly Buka2019-09-111-0/+5
| | | | | | It's part of interface, maybe it is used in external code. llvm-svn: 371691
* Remove NOLINTs from compiler-rtVitaly Buka2019-09-112-9/+4
| | | | llvm-svn: 371687
* [dfsan] Introduce dfsan_flush().Kostya Serebryany2019-06-131-0/+6
| | | | | | | | | | | | | | | | | | | Summary: dfsan_flush() allows to restart tain tracking from scratch in the same process. The primary purpose right now is to allow more efficient data flow tracing for DFT fuzzing: https://github.com/google/oss-fuzz/issues/1632 Reviewers: pcc Reviewed By: pcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D63037 llvm-svn: 363321
* [compiler-rt] Update comments in asan header to doxygen format; NFC.Pierre Gousseau2019-06-112-295/+609
| | | | | | | | | | | | | 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
* [MSan] Introduce __msan_unpoison_param().Matt Morehouse2019-05-091-0/+3
| | | | | | | | | | | | | | | | | | | Summary: This allows libFuzzer to unpoison parameter shadow before calling LLVMFuzzerTestOneInput to eliminate the false positives described in https://github.com/google/oss-fuzz/issues/2369. Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, metzman, kcc Tags: #llvm Differential Revision: https://reviews.llvm.org/D61751 llvm-svn: 360379
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-011-0/+1
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 llvm-svn: 359708
* Remove esan.Nico Weber2019-03-111-49/+0
| | | | | | | | | | | It hasn't seen active development in years, and it hasn't reached a state where it was useful. Remove the code until someone is interested in working on it again. Differential Revision: https://reviews.llvm.org/D59133 llvm-svn: 355862
* [hwasan, asan] Intercept vfork.Evgeniy Stepanov2019-02-271-0/+8
| | | | | | | | | | | | | | | 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-8/+0
| | | | | | Revert r354625, r354627 - multiple build failures. llvm-svn: 354629
* [hwasan,asan] Intercept vfork.Evgeniy Stepanov2019-02-211-0/+8
| | | | | | | | | | | | | | 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
* Dmitry Vyukov2019-02-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | tsan: add fiber support This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 [The previous commit of this change was reverted, this is a resubmit with a squashed fix for check_analyze.sh and COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED] llvm-svn: 353947
* Revert "tsan: add fiber support"Diana Picus2019-02-131-18/+0
| | | | | | | This reverts commit r353817 because we think it broke AARch64 and PowerPC buildbots. llvm-svn: 353939
* tsan: add fiber supportDmitry Vyukov2019-02-121-0/+18
| | | | | | | | | | | | | | | | | This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 llvm-svn: 353817
* hwasan: Add __hwasan_init_static() function.Peter Collingbourne2019-01-311-4/+8
| | | | | | | | | | | This function initializes enough of the runtime to be able to run instrumented code in a statically linked executable. It replaces __hwasan_shadow_init() which wasn't doing enough initialization for instrumented code that uses either TLS or IFUNC to work. Differential Revision: https://reviews.llvm.org/D57490 llvm-svn: 352816
* Adjust documentation for git migration.James Y Knight2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes most references to the paths: llvm.org/svn/ llvm.org/git/ llvm.org/viewvc/ github.com/llvm-mirror/ github.com/llvm-project/ reviews.llvm.org/diffusion/ to instead point to https://github.com/llvm/llvm-project. This is *not* a trivial substitution, because additionally, all the checkout instructions had to be migrated to instruct users on how to use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of checking out various projects into various subdirectories. I've attempted to not change any scripts here, only documentation. The scripts will have to be addressed separately. Additionally, I've deleted one document which appeared to be outdated and unneeded: lldb/docs/building-with-debug-llvm.txt Differential Revision: https://reviews.llvm.org/D57330 llvm-svn: 352514
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1914-56/+42
| | | | | | | | | | | | | | | | | 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
* Regenerate syscall hooks for NetBSD 8.99.25Kamil Rytarowski2018-10-301-24/+22
| | | | | | | | | | Register new syscall getsockopt2. Drop removed syscalls pmc_get_info and pmc_control. While there address compiler warnings about potentially unused variables. llvm-svn: 345582
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-0/+6
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343605
* Revert "[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output"Jessica Paquette2018-10-021-6/+0
| | | | | | | | | This reverts r343554. It was breaking some bots: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/49997/ llvm-svn: 343600
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-0/+6
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343554
* [hwasan] introduce __hwasan_print_memory_usageKostya Serebryany2018-09-061-0/+3
| | | | llvm-svn: 341592
* [hwasan] Add a (almost) no-interceptor mode.Evgeniy Stepanov2018-08-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The idea behind this change is to allow sanitization of libc. We are prototyping on Bionic, but the tool interface will be general enough (or at least generalizable) to support any other libc. When libc depends on libclang_rt.hwasan, the latter can not interpose libc functions. In fact, majority of interceptors become unnecessary when libc code is instrumented. This change gets rid of most hwasan interceptors and provides interface for libc to notify hwasan about thread creation and destruction events. Some interceptors (pthread_create) are kept under #ifdef to enable testing with uninstrumented libc. They are expressed in terms of the new libc interface. The new cmake switch, COMPILER_RT_HWASAN_WITH_INTERCEPTORS, ON by default, builds testing version of the library with the aforementioned pthread_create interceptor. With the OFF setting, the library becomes more of a libc plugin. Reviewers: vitalybuka, kcc, jfb Subscribers: srhines, kubamracek, mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D50922 llvm-svn: 340216
* Revert "Revert "[hwasan] Add __hwasan_handle_longjmp.""Evgeniy Stepanov2018-08-161-0/+7
| | | | | | | | | | | This reapplies commit r339935 with the following changes: * make longjmp test C, not C++, to avoid dependency on libc++/libstdc++ * untag pointer in memset interceptor x86_64 does not have TBI, so hwasan barely works there. Tests must be carefully written in a way that does not leak tagged pointer to system libraries. llvm-svn: 339963
* Revert "[hwasan] Add __hwasan_handle_longjmp."Evgeniy Stepanov2018-08-161-7/+0
| | | | | | This reverts commit 339935 which breaks hwasan tests on x86_64. llvm-svn: 339957
* [hwasan] Add __hwasan_handle_longjmp.Evgeniy Stepanov2018-08-161-0/+7
| | | | | | | | | | | | | | | | | Summary: A callback to annotate longjmp-like code. Unlike __asan_handle_no_return, in hwasan we can not conservatively "unpoison" the entire thread stack, because there is no such thing as unpoisoned memory. Pointer and memory tags must always match. Reviewers: vitalybuka, kcc Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D50752 llvm-svn: 339935
* [hwasan] Add a basic API.Evgeniy Stepanov2018-08-151-0/+12
| | | | | | | | | | | | | | | | Summary: Add user tag manipulation functions: __hwasan_tag_memory __hwasan_tag_pointer __hwasan_print_shadow (very simple and ugly, for now) Reviewers: vitalybuka, kcc Subscribers: kubamracek, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D50746 llvm-svn: 339746
* [hwasan] Provide __sanitizer_* aliases to allocator functions.Evgeniy Stepanov2018-08-132-1/+15
| | | | | | | | | | | | | | | | Summary: Export __sanitizer_malloc, etc as aliases to malloc, etc. This way users can wrap sanitizer malloc, even in fully static binaries. Both jemalloc and tcmalloc provide similar aliases (je_* and tc_*). Reviewers: vitalybuka, kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D50570 llvm-svn: 339614
* [hwasan] Allow optional early shadow setup.Evgeniy Stepanov2018-08-131-0/+6
| | | | | | | | | | | | | | | | Summary: Provide __hwasan_shadow_init that can be used to initialize shadow w/o touching libc. It can be used to bootstrap an unusual case of fully-static executable with hwasan-instrumented libc, which needs to run hwasan code before it is ready to serve user calls like madvise(). Reviewers: vitalybuka, kcc Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D50581 llvm-svn: 339606
* [MSan] Add functions to enable/disable interceptor checks.Matt Morehouse2018-07-061-0/+8
| | | | | | | | | | | | | | | | | | Summary: The motivation for this change is to make libFuzzer+MSan possible without instrumenting libFuzzer. See https://github.com/google/sanitizers/issues/958. Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D48890 llvm-svn: 336447
* [libFuzzer] Report at most one crash per input.Matt Morehouse2018-05-011-0/+5
| | | | | | | | | | | | | | | | | | Summary: Fixes https://github.com/google/sanitizers/issues/788/, a deadlock caused by multiple crashes happening at the same time. Before printing a crash report, we now test and set an atomic flag. If the flag was already set, the crash handler returns immediately. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D46277 llvm-svn: 331310
* [scudo] Adding an interface function to print allocator statsKostya Kortchinsky2018-04-251-0/+5
| | | | | | | | | | | | | | | | Summary: This adds `__scudo_print_stats` as an interface function to display the Primary and Secondary allocator statistics for Scudo. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D46016 llvm-svn: 330857
* Remove obsolete ptrace(2) operations from NetBSDKamil Rytarowski2018-03-031-1/+1
| | | | | | | | | PT_SET_SIGMASK and PT_GET_SIGMASK will be removed from NetBSD without backward compat (it shortlived in a development branch). Sponsored by <The NetBSD Foundation> llvm-svn: 326657
* Implement a large part of NetBSD syscalls of netbsd_syscall_hooks.hKamil Rytarowski2018-02-151-0/+4689
| | | | | | | | | | This is a follow up of: r325206 - Add NetBSD syscall hooks skeleton in sanitizers Sponsored by <The NetBSD Foundation> llvm-svn: 325248
* Add NetBSD syscall hooks skeleton in sanitizersKamil Rytarowski2018-02-151-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implement the skeleton of NetBSD syscall hooks for use with sanitizers. Add a script that generates the rules to handle syscalls on NetBSD: generate_netbsd_syscalls.awk. It has been written in NetBSD awk(1) (patched nawk) and is compatible with gawk. Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h that is a public header for applications, and included as: <sanitizer_common/sanitizer_platform_limits_netbsd.h>. Generate sanitizer_syscalls_netbsd.inc that defines all the syscall rules for NetBSD. This file is modeled after the Linux specific file: sanitizer_common_syscalls.inc. Start recognizing NetBSD syscalls with existing sanitizers: ASan, ESan, HWASan, TSan, MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis Reviewed By: vitalybuka Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42048 llvm-svn: 325206
* [scudo] s/unsigned long/size_t/ for __scudo_set_rss_limitKostya Kortchinsky2018-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: `__scudo_set_rss_limit`'s `LimitMb` should really be a `size_t`. Update accordingly the prototype. To avoid the `NOLINT` and conform with the other Sanitizers, use the sanitizers types for the internal definition. This should have no functional change. Additionally, capitalize a variable name to follow the LLVM coding standards. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41704 llvm-svn: 321803
* [sanitizer] Make function declarations C-compatiblePetr Hosek2017-12-219-37/+37
| | | | | | | | | | | | | | | | | 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
* [scudo] Adding a public Scudo interfaceKostya Kortchinsky2017-12-131-0/+34
| | | | | | | | | | | | | | | | Summary: The first and only function to start with allows to set the soft or hard RSS limit at runtime. Add associated tests. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: mgorny, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41128 llvm-svn: 320611
* Hardware-assisted AddressSanitizer (compiler-rt)Evgeniy Stepanov2017-12-091-0/+33
| | | | | | | | | | | | | | Summary: Runtime library for HWASan, initial commit. Does not randomize tags yet, does not handle stack or globals. Reviewers: kcc, pcc, alekseyshl Subscribers: srhines, kubamracek, dberris, mgorny, llvm-commits, krytarowski Differential Revision: https://reviews.llvm.org/D40935 llvm-svn: 320231
* [Sanitizers] New sanitizer API to purge allocator quarantine.Alex Shlyapnikov2017-10-231-0/+7
| | | | | | | | | | | | | | | | Summary: Purging allocator quarantine and returning memory to OS might be desired between fuzzer iterations since, most likely, the quarantine is not going to catch bugs in the code under fuzz, but reducing RSS might significantly prolong the fuzzing session. Reviewers: cryptoad Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39153 llvm-svn: 316347
* [tsan] Add Mutex annotation flag for constant-initialized ↵Dmitry Vyukov2017-10-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | __tsan_mutex_linker_init behavior Add a new flag, _⁠_tsan_mutex_not_static, which has the opposite sense of _⁠_tsan_mutex_linker_init. When the new _⁠_tsan_mutex_not_static flag is passed to _⁠_tsan_mutex_destroy, tsan ignores the destruction unless the mutex was also created with the _⁠_tsan_mutex_not_static flag. This is useful for constructors that otherwise woud set _⁠_tsan_mutex_linker_init but cannot, because they are declared constexpr. Google has a custom mutex with two constructors, a "linker initialized" constructor that relies on zero-initialization and sets ⁠_⁠_tsan_mutex_linker_init, and a normal one which sets no tsan flags. The "linker initialized" constructor is morally constexpr, but we can't declare it constexpr because of the need to call into tsan as a side effect. With this new flag, the normal c'tor can set _⁠_tsan_mutex_not_static, the "linker initialized" constructor can rely on tsan's lazy initialization, and _⁠_tsan_mutex_destroy can still handle both cases correctly. Author: Greg Falcon (gfalcon) Reviewed in: https://reviews.llvm.org/D39095 llvm-svn: 316209
* [lsan] Add __lsan_default_optionsVitaly Buka2017-09-221-0/+4
| | | | | | For consistency with asan, msan, tsan and ubsan. llvm-svn: 314048
* [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
* Prevent DCE on __lsan_is_turned_off and re-enable test caseFrancis Ricci2017-09-081-0/+2
| | | | | | | | | | | | | | | Summary: -dead_strip in ld64 strips weak interface symbols, which I believe is most likely the cause of this test failure. Re-enable after marking the interface function as used. Reviewers: alekseyshl, kubamracek, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37635 llvm-svn: 312824
* [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
* [sancov] Implement __sanitizer_cov_reset.Evgeniy Stepanov2017-07-271-2/+5
| | | | | | | | | | | | Summary: Clears all collected coverage. Reviewers: kcc Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D35958 llvm-svn: 309333
OpenPOWER on IntegriCloud