summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] add one more argument to __sanitizer_print_memory_profile, remove a ↵Kostya Serebryany2017-03-151-1/+3
| | | | | | redundant weak definition. llvm-svn: 297914
* [XRay] [compiler-rt] Allow logging the first argument of a function call.Dean Michael Berris2017-03-061-1/+18
| | | | | | | | | | | | | | | | | | | Summary: Functions with the LOG_ARGS_ENTRY sled kind at their beginning will be handled in a way to (optionally) pass their first call argument to your logging handler. For practical and performance reasons, only the first argument is supported, and only up to 64 bits. Reviewers: javed.absar, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29703 llvm-svn: 297000
* [XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris2017-01-252-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 llvm-svn: 293015
* Revert "[XRay][compiler-rt] XRay Flight Data Recorder Mode"Dean Michael Berris2017-01-032-57/+0
| | | | | | This reverts rL290852 as it breaks aarch64 and arm. llvm-svn: 290854
* [XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris2017-01-032-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 llvm-svn: 290852
* [sancov] __sanitizer_dump_coverage apiMike Aizatsky2016-12-121-0/+5
| | | | | | | | Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D26758 llvm-svn: 289498
* [sanitizers] __sanitizer_get_module_and_offset_for_pc interface functionMike Aizatsky2016-12-051-0/+7
| | | | | | | | | | | | Summary: The function computes full module name and coverts pc into offset. Reviewers: kcc Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26820 llvm-svn: 288711
* [XRay] Support AArch64 in compiler-rtDean Michael Berris2016-11-211-0/+7
| | | | | | | | | | | | | | | | | | This patch adds XRay support in compiler-rt for AArch64 targets. This patch is one of a series: LLVM: https://reviews.llvm.org/D26412 Clang: https://reviews.llvm.org/D26415 Author: rSerge Reviewers: rengolin, dberris Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown Differential Revision: https://reviews.llvm.org/D26413 llvm-svn: 287517
* [compiler-rt][XRay] Support tail call sledsDean Michael Berris2016-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change depends on D23986 which adds tail call-specific sleds. For now we treat them first as normal exits, and in the future leave room for implementing this as a different kind of log entry. The reason for deferring the change is so that we can keep the naive logging implementation more accurate without additional complexity for reading the log. The accuracy is gained in effectively interpreting call stacks like: A() B() C() Which when tail-call merged will end up not having any exit entries for A() nor B(), but effectively in turn can be reasoned about as: A() B() C() Although we lose the fact that A() had called B() then had called C() with the naive approach, a later iteration that adds the explicit tail call entries would be a change in the log format and thus necessitate a version change for the header. We can do this later to have a chance at releasing some tools (in D21987) that are able to handle the naive log format, then support higher version numbers of the log format too. Reviewers: echristo, kcc, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D23988 llvm-svn: 284178
* [sanitizer-coverage] remove stale code, second attempt after failed r282994Kostya Serebryany2016-10-041-8/+0
| | | | llvm-svn: 283185
* [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiberDmitry Vyukov2016-09-281-1/+3
| | | | | | | | | | | This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size. This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it. Author: Andrii Grynenko (andriigrynenko) Reviewed in: https://reviews.llvm.org/D24628 llvm-svn: 282582
* [sanitizer] rename __sanitizer_symbolize_data to ↵Kostya Serebryany2016-09-191-2/+2
| | | | | | __sanitizer_symbolize_global (to avoid conflict with another definition) llvm-svn: 281902
* [sanitizer] add __sanitizer_symbolize_data (can only print the names of the ↵Kostya Serebryany2016-09-191-0/+3
| | | | | | globals for now) llvm-svn: 281886
* [compiler-rt][XRay] Initial per-thread inmemory logging implementationDean Michael Berris2016-08-261-0/+80
| | | | | | | | | | | | | | | | | | | | | | Depends on D21612 which implements the building blocks for the compiler-rt implementation of the XRay runtime. We use a naive in-memory log of fixed-size entries that get written out to a log file when the buffers are full, and when the thread exits. This implementation lays some foundations on to allowing for more complex XRay records to be written to the log in subsequent changes. It also defines the format that the function call accounting tool in D21987 will start building upon. Once D21987 lands, we should be able to start defining more tests using that tool once the function call accounting tool becomes part of the llvm distribution. Reviewers: echristo, kcc, rnk, eugenis, majnemer, rSerge Subscribers: sdardis, rSerge, dberris, tberghammer, danalbert, srhines, majnemer, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D21982 llvm-svn: 279805
* [sanitizer] add __sanitizer_symbolize_pc. ↵Kostya Serebryany2016-08-251-0/+7
| | | | | | https://github.com/google/sanitizers/issues/322 llvm-svn: 279780
* [sanitizers] trace buffer API to use user-allocated buffer.Mike Aizatsky2016-08-051-7/+9
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D23186 llvm-svn: 277858
* [compiler-rt][XRay] Address follow-up comments to initial interface and ↵Dean Michael Berris2016-07-291-15/+7
| | | | | | | | | | | | | | | | | | initialisation code This addresses some comments from D21612, which contains the following changes: - Update __xray_patch() and __xray_unpatch() API documentation to not imply asynchrony. - Introduce a scope cleanup mechanism to make sure we can roll-back changes to the XRayPatching global atomic. - Introduce a few more comments for potential extension points for other platforms (for the implementation details of patching and un-patching). Reviewers: eugenis, rnk, kcc, echristo, majnemer Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22911 llvm-svn: 277124
* [compiler-rt][XRay] re-submitting r276117, with fixes for build breakage due ↵Dean Michael Berris2016-07-212-1/+78
| | | | | | | | | | | | | | | | | | | | | | | to extraneous and missing dependencies and attempts to build on unsupported OSes Summary: This is a fixed-up version of D21612, to address failure identified post-commit. Original commit description: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Fixes include: - Gating XRay build to only Linux x86_64 and with the right dependencies in case it is the only library being built - Including <cstddef> to fix std::size_t issue Reviewers: kcc, rnk, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22611 llvm-svn: 276251
* Revert r276117 "[XRay] Basic initialization and flag definition for XRay ↵Hans Wennborg2016-07-202-78/+1
| | | | | | | | | | | | | | | | | | | | | | | runtime" and also the follow-up "[xray] Only build xray on Linux for now" Two build errors were reported on the llvm-commits list: [ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found #include "llvm/Support/ELF.h" ^ and In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16: /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error: no type named 'size_t' in namespace 'std' std::size_t Entries; ~~~~~^ llvm-svn: 276186
* [compiler-rt] [XRay] Basic initialization and flag definition for XRay runtimeDean Michael Berris2016-07-202-1/+78
| | | | | | | | | | | | | | | Summary: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Depends on D19904 Reviewers: echristo, kcc, rnk Subscribers: rnk, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D21612 llvm-svn: 276117
* [esan|wset] Fix flaky sampling testsDerek Bruening2016-07-191-0/+4
| | | | | | | Adds a new esan public interface routine __esan_get_sample_count() and uses it to ensure that tests of sampling receive the minimum number of samples. llvm-svn: 275948
* [sanitizers] add interceptor for memmem; add weak hooks for strncasecmp, ↵Kostya Serebryany2016-07-151-0/+11
| | | | | | strcasecmp, strstr, strcasestr, memmem llvm-svn: 275621
* [compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron2016-07-111-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 llvm-svn: 275111
* [esan] Add __esan_report for mid-run dataDerek Bruening2016-07-092-0/+47
| | | | | | | | | | | | | | | | | | | | | Summary: Adds a new public interface routine __esan_report() which can be used to request profiling results prior to abnormal termination (e.g., for a server process killed by its parent where the normal exit does not allow for normal result reporting). Implements this for the working-set tool. The cache frag tool is left unimplemented as it requires missing iteration capabilities. Adds a new test. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D22098 llvm-svn: 274964
* [sanitizer] Add syscall handlers for sigaction and rt_sigaction.Evgeniy Stepanov2016-06-241-5/+18
| | | | llvm-svn: 273746
* [asan] add primitives that allow coroutine implementationsDmitry Vyukov2016-06-211-0/+20
| | | | | | | | | | | | | | | | | This patch adds the __sanitizer_start_switch_fiber and __sanitizer_finish_switch_fiber methods inspired from what can be found here https://github.com/facebook/folly/commit/2ea64dd24946cbc9f3f4ac3f6c6b98a486c56e73 . These methods are needed when the compiled software needs to implement coroutines, fibers or the like. Without a way to annotate them, when the program jumps to a stack that is not the thread stack, __asan_handle_no_return shows a warning about that, and the fake stack mechanism may free fake frames that are still in use. Author: blastrock (Philippe Daouadi) Reviewed in http://reviews.llvm.org/D20913 llvm-svn: 273260
* [sanitizers] introduce yet another API function: ↵Kostya Serebryany2016-06-161-0/+17
| | | | | | __sanitizer_install_malloc_and_free_hooks llvm-svn: 272943
* [asan] fix arm buildKostya Serebryany2016-06-021-1/+1
| | | | llvm-svn: 271474
* [asan] add an interface function __sanitizer_print_memory_profile (a basic ↵Kostya Serebryany2016-06-021-0/+6
| | | | | | memory profiler; asan/Linux-only for now) llvm-svn: 271463
* [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the ↵Kostya Serebryany2016-05-271-0/+3
| | | | | | sanitizer logging to another fd from inside the process llvm-svn: 271046
* [libFuzzer] extend the weak memcmp/strcmp/strncmp interceptors to receive ↵Kostya Serebryany2016-01-121-2/+4
| | | | | | the result of the computations. With that, don't do any mutations if memcmp/etc returned 0 llvm-svn: 257423
* [sancov] coverage pc bufferMike Aizatsky2016-01-051-0/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D15871 llvm-svn: 256804
* Asan: utility function to determine first wrongly poisoned byte inMike Aizatsky2015-11-041-0/+6
| | | | | | | | container. Differential Revision: http://reviews.llvm.org/D14341 llvm-svn: 252071
* [sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairsKostya Serebryany2015-10-221-1/+3
| | | | llvm-svn: 251071
* [msan] Add __msan_copy_shadow interface function.Evgeniy Stepanov2015-10-121-0/+6
| | | | | | This can be used to annotate copies of memory that are not observed by MSan. llvm-svn: 250124
* [MSan] Deprecate __msan_set_death_callback() in favor of ↵Alexey Samsonov2015-08-211-2/+1
| | | | | | __sanitizer_set_death_callback(). llvm-svn: 245754
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-213-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [sanitizer] add a weak hook for strncmp interceptor, both to dfsan and other ↵Kostya Serebryany2015-07-302-2/+6
| | | | | | sanitizers. Hide the declaration and the calls in better macros llvm-svn: 243610
* [sanitizer] add a weak hook for memcmp interceptor, to be used primarily for ↵Kostya Serebryany2015-07-301-0/+9
| | | | | | fuzzing. More hooks will be added later. So far this is a Linux-only feature llvm-svn: 243601
* re-added changes due to svn config setting issuesNaomi Musgrave2015-07-171-0/+3
| | | | llvm-svn: 242589
* Add dfsan_weak_hook_memcmpKostya Serebryany2015-05-071-0/+10
| | | | | | | | | | | | | | | | | | | Summary: Add a weak hook to be called from dfsan's custom memcmp. The primary user will be lib/Fuzzer. If this works well we'll add more hooks (strcmp, etc). Test Plan: Will be covered by lib/Fuzzer tests. Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9541 llvm-svn: 236679
* [lsan] Add an interface function for on-demand leak checking.Sergey Matveev2015-04-241-6/+17
| | | | | | | | | | | | | | | | | | | | | | Summary: Add an interface function which can be used to periodically trigger leak detection in a long-running process. NB: The meaning of the kIgnored tag has been changed to allow easy clean-up between subsequent leak checks. Previously, this tag was applied to explicitly ignored (i.e. with __lsan_disable() or __lsan_ignore_object()) chunks *and* any chunks only reachable from those. With this change, it's only applied to explicitly ignored chunks. Reviewers: samsonov Reviewed By: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9159 llvm-svn: 235728
* Revert r235726 "interface"Sergey Matveev2015-04-241-17/+6
| | | | | | Accidentally committed from local branch. :( llvm-svn: 235727
* interfaceSergey Matveev2015-04-241-6/+17
| | | | llvm-svn: 235726
* [sanitizer/coverage] Add AFL-style coverage counters (search heuristic for ↵Kostya Serebryany2015-03-031-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | fuzzing). Introduce -mllvm -sanitizer-coverage-8bit-counters=1 which adds imprecise thread-unfriendly 8-bit coverage counters. The run-time library maps these 8-bit counters to 8-bit bitsets in the same way AFL (http://lcamtuf.coredump.cx/afl/technical_details.txt) does: counter values are divided into 8 ranges and based on the counter value one of the bits in the bitset is set. The AFL ranges are used here: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+. These counters provide a search heuristic for single-threaded coverage-guided fuzzers, we do not expect them to be useful for other purposes. Depending on the value of -fsanitize-coverage=[123] flag, these counters will be added to the function entry blocks (=1), every basic block (=2), or every edge (=3). Use these counters as an optional search heuristic in the Fuzzer library. Add a test where this heuristic is critical. llvm-svn: 231166
* [msan] Fix MsanTest to pass in track_origins=2 mode.Evgeniy Stepanov2015-02-261-0/+5
| | | | llvm-svn: 230639
* [sanitizer] move the coverage interface into a separate header, ↵Kostya Serebryany2015-02-033-20/+47
| | | | | | <sanitizer/coverage_interface.h>. NFC, except for the header name change. This may break existing users, but in this case it's better this way (not too many users so far) llvm-svn: 228017
* [sanitizer] allow to reset the bb/edge coverage data inside the process ↵Kostya Serebryany2015-01-281-0/+8
| | | | | | while it is running (single-threaded). Also expose the current coverage set to the process. llvm-svn: 227387
* [msan] Refactor shadow operations.Evgeniy Stepanov2015-01-211-1/+3
| | | | | | | Move a bunch of functions to a new source file and rename some of them for consistency. No functional changes. llvm-svn: 226673
* [asan] introduce __sanitizer_set_death_callback, deprecate ↵Kostya Serebryany2014-12-152-2/+4
| | | | | | __asan_set_death_callback llvm-svn: 224286
OpenPOWER on IntegriCloud