summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include
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] FuzzedDataProvider: do not call memcpy on empty vector.Max Moroz2019-12-041-0/+6
| | | | | | | | | | | | | | | | Summary: Some versions of memcpy mark pointer arguments as __nonnull, that triggers UBSan errors even when the length passed is 0. Reviewers: manojgupta, metzman Subscribers: dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71031 [compiler-rt] FDP: assert that num_bytes_to_consume == 0 when size == 0.
* Revert "[Coverage] Revise format to reduce binary size"Vedant Kumar2019-12-041-40/+9
| | | | | | | | | | This reverts commit e18531595bba495946aa52c0a16b9f9238cff8bc. On Windows, there is an error: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/54963/steps/stage%201%20check/logs/stdio error: C:\b\slave\sanitizer-windows\build\stage1\projects\compiler-rt\test\profile\Profile-x86_64\Output\instrprof-merging.cpp.tmp.v1.o: Failed to load coverage: Malformed coverage data
* [Coverage] Revise format to reduce binary sizeVedant Kumar2019-12-041-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revise the coverage mapping format to reduce binary size by: 1. Naming function records and marking them `linkonce_odr`, and 2. Compressing filenames. This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB) and speeds up end-to-end single-threaded report generation by 10%. For reference the compressed name data in llc is 81MB (__llvm_prf_names). Rationale for changes to the format: - With the current format, most coverage function records are discarded. E.g., more than 97% of the records in llc are *duplicate* placeholders for functions visible-but-not-used in TUs. Placeholders *are* used to show under-covered functions, but duplicate placeholders waste space. - We reached general consensus about giving (1) a try at the 2017 code coverage BoF [1]. The thinking was that using `linkonce_odr` to merge duplicates is simpler than alternatives like teaching build systems about a coverage-aware database/module/etc on the side. - Revising the format is expensive due to the backwards compatibility requirement, so we might as well compress filenames while we're at it. This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB). See CoverageMappingFormat.rst for the details on what exactly has changed. Fixes PR34533 [2], hopefully. [1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html [2] https://bugs.llvm.org/show_bug.cgi?id=34533 Differential Revision: https://reviews.llvm.org/D69471
* Reland "[CMake] Support installation of InstrProfData.inc"Petr Hosek2019-11-222-1/+767
| | | | | | | | | | | This header fragment is useful on its own for any consumer that wants to use custom instruction profile runtime with the LLVM instrumentation. The concrete use case is in Fuchsia's kernel where we want to use instruction profile instrumentation, but we cannot use the compiler-rt runtime because it's not designed for use in the kernel environment. This change allows installing this header as part of compiler-rt. Differential Revision: https://reviews.llvm.org/D64532
* Revert "[CMake] Support installation of InstrProfData.inc"Petr Hosek2019-11-222-767/+1
| | | | | This reverts commit f11bc1776fd2815b60e0b1ed97be00b517348162 since it's failing to build on some bots.
* [CMake] Support installation of InstrProfData.incPetr Hosek2019-11-222-1/+767
| | | | | | | | | | | This header fragment is useful on its own for any consumer that wants to use custom instruction profile runtime with the LLVM instrumentation. The concrete use case is in Fuchsia's kernel where we want to use instruction profile instrumentation, but we cannot use the compiler-rt runtime because it's not designed for use in the kernel environment. This change allows installing this header as part of compiler-rt. Differential Revision: https://reviews.llvm.org/D64532
* [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-132-0/+33
| | | | | | | | | | This is to document __ubsan_default_options(). Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D67503 llvm-svn: 371822
* [compiler-rt] Remove some cpplint filtersVitaly Buka2019-09-121-2/+2
| | | | llvm-svn: 371704
* [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
* Update compiler-rt cpplint.pyVitaly Buka2019-09-111-1/+1
| | | | | | https://github.com/cpplint/cpplint/commit/adb3500107f409ac5491188ae652ac3f4d03d9d3 llvm-svn: 371675
* [compiler-rt] FuzzedDataProvider: use C++ headers only instead of a C/C++ mix.Max Moroz2019-08-091-4/+3
| | | | | | | | | | | | | | Reviewers: Dor1s Reviewed By: Dor1s Subscribers: dberris, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D66017 llvm-svn: 368448
* [compiler-rt] Add ConsumeProbability and ConsumeFloatingPoint methods to FDP.Max Moroz2019-08-082-6/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Also slightly cleaned up the comments and changed the header's extension back to `.h` as per comments on https://reviews.llvm.org/D65812. New methods added: * `ConsumeProbability` returns [0.0, 1.0] by consuming an unsigned integer value from the input data and dividing that value by the integer's max value. * `ConsumeFloatingPointInRange` returns a floating point value in the given range. Relies on `ConsumeProbability` method. This method does not have the limitation of `std::uniform_real_distribution` that requires the given range to be <= the floating point type's max. If the range is too large, this implementation will additionally call `ConsumeBool` to decide whether the result will be in the first or the second half of the range. * `ConsumeFloatingPoint` returns a floating point value in the range `[std::numeric_limits<T>::lowest(), std::numeric_limits<T>::min()]`. Tested on Linux, Mac, Windows. Reviewers: morehouse Reviewed By: morehouse Subscribers: kubamracek, mgorny, dberris, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65905 llvm-svn: 368331
* [compiler-rt] Rename FuzzedDataProvider.h to .hpp and other minor changes.Max Moroz2019-08-062-2/+2
| | | | | | | | | | | | | | | | | | Summary: .hpp makes more sense for this header as it's C++ only, plus it contains the actual implementation. Reviewers: Dor1s Reviewed By: Dor1s Subscribers: kubamracek, dberris, mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65812 llvm-svn: 368054
* [compiler-rt] Move FDP to include/fuzzer/FuzzedDataProvider.h for easier use.Max Moroz2019-08-052-0/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: FuzzedDataProvider is a helper class for writing fuzz targets that fuzz multple inputs simultaneously. The header is supposed to be used for fuzzing engine agnostic fuzz targets (i.e. the same target can be used with libFuzzer, AFL, honggfuzz, and other engines). The common thing though is that fuzz targets are typically compiled with clang, as it provides all sanitizers as well as different coverage instrumentation modes. Therefore, making this FDP class a part of the compiler-rt installation package would make it easier to develop and distribute fuzz targets across different projects, build systems, etc. Some context also available in https://github.com/google/oss-fuzz/pull/2547. This CL does not delete the header from `lib/fuzzer/utils` directory in order to provide the downstream users some time for a smooth migration to the new header location. Reviewers: kcc, morehouse Reviewed By: morehouse Subscribers: lebedev.ri, kubamracek, dberris, mgorny, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65661 llvm-svn: 367917
* [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-112-50/+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-1917-68/+51
| | | | | | | | | | | | | | | | | 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
* xray: Add missing header to list of installed headers.Peter Collingbourne2019-01-171-0/+1
| | | | | | | | Spotted by gn's llvm/utils/gn/build/sync_source_lists_from_cmake.py script. Differential Revision: https://reviews.llvm.org/D56797 llvm-svn: 351479
* Make compiler-rt CMakeLists.txt formatting a bit more like LLVM's usual ↵Nico Weber2019-01-161-2/+4
| | | | | | formatting llvm-svn: 351363
* 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
* [XRay] Remove the deprecated __xray_log_init APIPetr Hosek2018-09-151-23/+2
| | | | | | | | | This API has been deprecated three months ago and shouldn't be used anymore, all clients should migrate to the new string based API. Differential Revision: https://reviews.llvm.org/D51606 llvm-svn: 342318
* [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
* [XRay] basic mode PID and TID always fetchDean Michael Berris2018-07-111-3/+6
| | | | | | | | | | | | | | Summary: XRayRecords now includes a PID field. Basic handlers fetch pid and tid each time they are called instead of caching the value. Added a testcase that calls fork and checks if the child TID is different from the parent TID to verify that the processes' TID are different in the trace. Reviewers: dberris, Maknee Reviewed By: dberris, Maknee Subscribers: kpw, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49025 llvm-svn: 336769
* [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
* Fix a typo; NFCGeorge Burgess IV2018-05-261-1/+1
| | | | llvm-svn: 333331
OpenPOWER on IntegriCloud