summaryrefslogtreecommitdiff
path: root/lib/esan
AgeCommit message (Collapse)Author
2017-11-10[esan] Fix compilation of signal handlersVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317874 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22[esan] Use stack_t instead of struct sigaltstack (PR34011)Hans Wennborg
The struct tag is going away in soon-to-be-released glibc 2.26 and the stack_t typedef seems to have been there forever. Patch by Bernhard Rosenkraenzer! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11Refactor MemoryMappingLayout::Next to use a single struct instead of output ↵Francis Ricci
parameters. NFC. Summary: This is the first in a series of patches to refactor sanitizer_procmaps to allow MachO section information to be exposed on darwin. In addition, grouping all segment information in a single struct is cleaner than passing it through a large set of output parameters, and avoids the need for annotations of NULL parameters for unneeded information. The filename string is optional and must be managed and supplied by the calling function. This is to allow the MemoryMappedSegment struct to be stored on the stack without causing overly large stack sizes. Reviewers: alekseyshl, kubamracek, glider Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35135 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11[asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau
Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30[sanitizer] Move fread and fwrite interceptors to sanitizer_commonMaxim Ostapenko
{M, T, E}San have fread and fwrite interceptors, let's move them to sanitizer_common to enable ASan checks as well. Differential Revision: https://reviews.llvm.org/D31456 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky
This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12[sancov] moving sancov rt to sancov/ directoryMike Aizatsky
Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07[esan] Fix ESan test failure on Debian Sid botQin Zhao
Summary: Increase early allocation buffer size. Reviewers: bruening Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D25380 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@283598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06[ESan][MIPS] Adds support for MIPS64Sagar Thakur
With this patch 12 out of 13 tests are passing. Reviewed by zhaoqin. Differential: D23799 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@283435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03[esan] Fix ESan test failure on Debian Sid botQin Zhao
Summary: Handles early allocation from dlsym by allocating memory from a local static buffer. Reviewers: bruening Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D25193 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@283139 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22[ESan][MIPS] Fix tests struct-simple.cpp on MIPSSagar Thakur
For mips assember '#' is the start of comment. We get assembler error messages if # is used in the struct names. Therefore using '$' which works for all architectures. Differential: D24335 Reviewed by: zhaoqin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282142 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15[compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08Revert "[ESan][MIPS] Adds support for MIPS64"Qin Zhao
Summary: This reverts commit 62b3eecdbe72af0255f0639b0446087a47efbf48. (D23799) The CL cause 13 ESan test failure on x86_64: Failing Tests (13): EfficiencySanitizer-x86_64 :: TestCases/large-stack-linux.c EfficiencySanitizer-x86_64 :: TestCases/libc-intercept.c EfficiencySanitizer-x86_64 :: TestCases/mmap-shadow-conflict.c EfficiencySanitizer-x86_64 :: TestCases/struct-simple.cpp EfficiencySanitizer-x86_64 :: TestCases/verbose-simple.c EfficiencySanitizer-x86_64 :: TestCases/workingset-early-fault.c EfficiencySanitizer-x86_64 :: TestCases/workingset-memset.cpp EfficiencySanitizer-x86_64 :: TestCases/workingset-midreport.cpp EfficiencySanitizer-x86_64 :: TestCases/workingset-samples.cpp EfficiencySanitizer-x86_64 :: TestCases/workingset-signal-posix.cpp EfficiencySanitizer-x86_64 :: TestCases/workingset-simple.cpp EfficiencySanitizer-x86_64 :: Unit/circular_buffer.cpp EfficiencySanitizer-x86_64 :: Unit/hashtable.cpp Unexpected Failures: 13 Reviewers: bruening, slthakur Subscribers: sdardis, kubabrecka, beanz Differential Revision: https://reviews.llvm.org/D24350 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07[ESan][MIPS] Adds support for MIPS64Sagar Thakur
With this patch 10 out of 13 tests are passing. Following is the list of failing tests: struct-simple.cpp workingset-signal-posix.cpp mmap-shadow-conflict.c Reviewed by bruening Differential: D23799 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08[esan] Add iterator to esan's generic hashtableDerek Bruening
Summary: Adds simple iterator support to the esan hashtable. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D22682 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08[esan] Add generic resizing hashtableDerek Bruening
Summary: Adds a new, generic, resizing hashtable data structure for use by esan tools. No existing sanitizer hashtable is suitable for the use case for most esan tools: we need non-fixed-size tables, parameterized keys and payloads, and write access to payloads. The new hashtable uses either simple internal or external mutex locking and supports custom hash and comparision operators. The focus is on functionality, not performance, to catalyze creation of a variety of tools. We can optimize the more successful tools later. Adds tests of the data structure. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D22681 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19[esan|wset] Fix flaky sampling testsDerek Bruening
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19[esan] Fix sideline thread flaky assertDerek Bruening
Fixes an esan sideline thread CHECK that failed to account for the sideline thread reaching its code before the internal_clone() return value was assigned in the parent. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-09[esan] Add __esan_report for mid-run dataDerek Bruening
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07[esan|cfrag] Handle binaries built with -esan-aux-field-info=falseQin Zhao
Summary: Handles binaries built with -esan-aux-field-info=false and print less information. Updates test struct-simple.cpp. Reviewers: aizatsky Subscribers: llvm-commits, bruening, eugenis, kcc, zhaoqin, kubabrecka, vitalybuka Differential Revision: http://reviews.llvm.org/D22020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06[esan|wset] Ensure SIGSEGV is not blockedDerek Bruening
Summary: Adds interception of sigprocmask and pthread_sigmask to esan so that the working set tool can prevent SIGSEGV from being blocked. A blocked SIGSEGV results in crashes due to our lazy shadow page allocation scheme. Adds new sanitizer helper functions internal_sigemptyset and internal_sigismember. Adds a test to workingset-signal-posix.cpp. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D22063 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274672 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02[esan|cfrag] Add struct array access reportQin Zhao
Summary: Adds struct array access counter report. Updates test struct-simple.cpp. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, bruening, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21595 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17[esan|cfrag] Add the struct field size array in StructInfoQin Zhao
Summary: Adds the struct field size array in the struct StructInfo. Prints struct field size info in the report. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, bruening, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21342 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16[esan] Use internal_mmap during initializationDerek Bruening
Fixes another interceptor issue where an app with a static tcmalloc library that prevents our early-calloc handling from triggering yet does not have a static mmap crashes in our mmap interceptor. The solution is to call internal_mmap when REAL(mmap) is not yet set up. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272870 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15[esan|cfrag] Minor cfrag report adjustmentQin Zhao
Summary: Reports the struct field access info only if it has been used at least once. Adds type printing size limit. Formats the cache_frag.cpp with clang-format. Reviewers: bruening Subscribers: llvm-commits, eugenis, kcc, zhaoqin, vitalybuka, aizatsky, kubabrecka Differential Revision: http://reviews.llvm.org/D21351 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272810 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14[sanitizer][esan] Add internal_sigaction_syscallDerek Bruening
Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272676 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14Revert r272591, http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 has ↵Nico Weber
been broken since this landed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272659 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13[sanitizer][esan] Add internal_sigaction_syscallDerek Bruening
Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13Revert "[sanitizer][esan] Add internal_sigaction_syscall"Derek Bruening
This reverts commit r272553. The iOS build fails to link. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13[sanitizer][esan] Add internal_sigaction_syscallDerek Bruening
Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-10[esan|cfrag] Add the struct field offset array in StructInfoQin Zhao
Summary: Adds the struct field offset array in the struct StructInfo. Prints struct size and field offset info in the report. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, bruening, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21191 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[esan] Intercept calloc to avoid deadlocks with tcmallocDerek Bruening
Summary: When tcmalloc initializes before esan, esan's initialization ends up calling back into tcmalloc due to the calloc done by dlsym. This results in a deadlock. We avoid this by special-casing this single allocation. Intercepting calloc also gives us the opportunity to act on its zeroing as stores by the application. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21086 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan] Initialize runtime during early interceptorsDerek Bruening
Summary: Adds initialization of esan's runtime library during any early interceptors that are sometimes called prior to the official __esan_init() invocation (we see this with apps using tcmalloc). Adds handling of interceptors called during interceptor initialization. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20976 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271744 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan|cfrag] Compute the struct field access difference ratioQin Zhao
Summary: Computes the struct field access variation based on each field access count. Adds a flag to control the report thresholds. Updates struct-simple.cpp with variance report output. Reviewers: aizatsky Subscribers: kubabrecka, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening Differential Revision: http://reviews.llvm.org/D20914 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan] Specify which tool via a global variableDerek Bruening
Summary: Adds a global variable to specify the tool, to support handling early interceptors that invoke instrumented code, thus requiring shadow memory to be initialized prior to __esan_init() being invoked. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20974 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271714 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan|wset] Add 8-level working set snapshot accumulationDerek Bruening
Summary: Adds a new option -snapshot_step controlling the frequency distribution for an 8-level series of samples using each bit of each shadow byte. Implements accumulation from each level to the next higher level at the specified frequency. Adds storage of the 8 series of samples using CircularBuffer instances. Fixes an error in the circular buffer data structure where a static object's destructor will be called too early. Prints the results out at the end in a simple manner to give us something to start with. Updates the workingset-samples test to test the new feature. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20833 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271683 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan] Add sideline itimer supportDerek Bruening
Summary: Adds support for creating a separate thread for performing "sideline" actions on a periodic basis via an itimer. A new class SidelineThread implements this feature, exposing a sampling callback to the caller. Adds initial usage of sideline sampling to the working set tool. For now it simply prints the usage at each snapshot at verbosity level 1. Adds a test of this behavior. Adds a new option -record_snapshots to control whether we sample and a new option -sample_freq to control the periodicity of the sampling. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20751 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[esan] Ensure internal_sigaction() bypasses interceptorsDerek Bruening
Summary: Implements real_sigaction() which it turns out is required for internal_sigaction() to bypass the libc interceptors. Without real_sigaction(), our internal_sigaction() calls during init happen to work due to the EsanDuringInit check in COMMON_INTERCEPTOR_ENTER (though even here it does not feel right for an "internal_" call to go through the interceptor). The real problem is when we call internal_sigaction() after we're initialized, which only happens on an unhandled SIGSEGV for which the app has no handler: then we'll spin in an infinite loop as our attempts to remove our own handler repeatedly fail. It's not easy to add a test for that, unfortunately. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20832 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02[esan] Add support for log_exe_nameDerek Bruening
Summary: Adds the call needed to cache the binary name to support the sanitizer option log_exe_name for usable log file results when running multiple applications. Adds a test. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20747 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02[esan|cfrag] Add struct info registrationQin Zhao
Summary: Adds StructInfo to CacheFragInfo to match the LLVM's EfficiencySanitizer structs. Uses StructHashMap to keep track of the struct info used by the app. Adds registerStructInfo/unregisterStructInfo to add/remove struct infos to/from StructHashMap. updates test struct-simple.cpp with more C structs. Reviewers: aizatsky, filcab Subscribers: filcab, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening, kubabrecka Differential Revision: http://reviews.llvm.org/D20590 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31[esan|cfrag] Add the skeleton to handle the cfrag argumentQin Zhao
Summary: Adds the struct declaration for the cache-fragmentation tool variable passed to the runtime library. Updates test struct-simple.cpp. Reviewers: aizatsky, bruening Subscribers: filcab, kubabrecka, bruening, kcc, vitalybuka, eugenis, llvm-commits, zhaoqin Differential Revision: http://reviews.llvm.org/D20542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31[esan] Add circular buffer data structureDerek Bruening
Summary: Adds a new class, CircularBuffer, for holding a wrap-around fixed-size sequence of a primitive data type. This will be used initially by the working set tool. Adds a unit test for CircularBuffer, including infrastructure support to include esan headers and to link with the esan library by pretending to want the working set tool. Reviewers: aizatsky, filcab Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20579 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271286 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31[esan|wset] Iterate all memory to compute the total working setDerek Bruening
Summary: Adds iteration of all application memory in an efficient manner using shadow faults. Shadow memory starts out inaccessible and we mark it writable one page at a time on each fault when the instrumentation touches it. This allows iteration over just the mapped shadow memory, saving significant time. Adds a process-end iteration and pretty-printing of the final result. Adds a new test and updates the existing tests. Reviewers: aizatsky, filcab Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20578 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31[esan] Intercept and chain signal handlersDerek Bruening
Summary: In preparation for fault-based shadow memory iteration, we add support for our own signal handler by adding app signal handler interception as well as chaining for SIGSEGV. This is done in a simple manner: we do not honor the app's alternate stack nor any sigaction flags for SIGSEGV. Adds a new test of transparency in app signal handling. Reviewers: aizatsky Subscribers: filcab, kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits Differential Revision: http://reviews.llvm.org/D20577 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28[esan] Add handling of large stack size rlimitsDerek Bruening
Summary: Adds detection of large stack size rlimits (over 1 TB or unlimited), which results in an mmap location that our shadow mapping does not support. We re-exec the application in this situation. Adds a test of this behavior. Adds general detection of mmap regions outside of our app regions. In the future we want to try to adaptively handle these but for now we abort. Moves the existing Linux-specific mmap code into a platform-specific file where the new rlimit code lives. Reviewers: eugenis Subscribers: vitalybuka, zhaoqin, kcc, aizatsky, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20745 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271079 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25[esan][cfrag] Add skeleton for cache fragmentation tool supportQin Zhao
Summary: Adds cache_frag.h and cache_frag.cpp for the cache fragmentation tool. Updates test struct-simple.cpp. Reviewers: aizatsky Subscribers: filcab, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening, kubabrecka Differential Revision: http://reviews.llvm.org/D20538 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270737 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25Add working set base runtime libraryDerek Bruening
Summary: Adds the base runtime library for the working set tool. Adds slowpath code for updating the shadow memory. To be added in the future: + Scan memory and report the total size. + Take samples for intermediate values. Reviewers: aizatsky Subscribers: kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits Differential Revision: http://reviews.llvm.org/D20485 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270650 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24[esan] Add compilation unit init/exit routines.Derek Bruening
Summary: Adds processCompilationUnitInit and processCompilationUnitExit for compilation unit init/exit. Adds a tool-specific argument passed to esan_init. Adds the dtor and esan_exit called from the dtor. A test will be added separately (adding it here results in failure until the corresponding compilation patch is in place). Reviewers: aizatsky Subscribers: kubabrecka, bruening, kcc, vitalybuka, eugenis, llvm-commits Differential Revision: http://reviews.llvm.org/D20486 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270624 91177308-0d34-0410-b5e6-96231b3b80d8