summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/esan
Commit message (Collapse)AuthorAgeFilesLines
* Remove esan.Nico Weber2019-03-1116-984/+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
* [Esan] Port cache frag to FreeBSDDavid Carlier2018-10-048-2/+15
| | | | | | | | | | | | Data involving struct accesses accounting work (plan to support only efficiency-cache-frag flag in the frontend side). Reviewers: krytarowski, vitalybuka, jfb Reviewed By : vitalybuka Differential Revision: https://reviews.llvm.org/D52608 llvm-svn: 343812
* [tsan] Update unittest for logging changes of r308637Vitaly Buka2017-07-201-2/+2
| | | | llvm-svn: 308660
* [esan] Disable flaky tests for PR33590Derek Bruening2017-06-263-0/+9
| | | | | | | Disables 3 esan workingset tests until their underlying failures are determined and resolved. llvm-svn: 306259
* Remove unused variable.Sam McCall2017-03-311-1/+0
| | | | llvm-svn: 299206
* [ESan][MIPS] Adds support for MIPS64Sagar Thakur2016-10-063-13/+31
| | | | | | | | | With this patch 12 out of 13 tests are passing. Reviewed by zhaoqin. Differential: D23799 llvm-svn: 283435
* [ESan][MIPS] Fix tests struct-simple.cpp on MIPSSagar Thakur2016-09-221-22/+22
| | | | | | | | | 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 llvm-svn: 282142
* Revert "[ESan][MIPS] Adds support for MIPS64"Qin Zhao2016-09-082-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 280954
* [ESan][MIPS] Adds support for MIPS64Sagar Thakur2016-09-072-8/+12
| | | | | | | | | | | | | | | 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 llvm-svn: 280795
* [esan] Add iterator to esan's generic hashtableDerek Bruening2016-08-081-0/+45
| | | | | | | | | | | | 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 llvm-svn: 278027
* [esan] Add generic resizing hashtableDerek Bruening2016-08-081-0/+134
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 278024
* [esan|wset] Fix flaky sampling testsDerek Bruening2016-07-192-18/+19
| | | | | | | 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
* [compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron2016-07-111-1/+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/+73
| | | | | | | | | | | | | | | | | | | | | 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
* [esan|cfrag] Handle binaries built with -esan-aux-field-info=falseQin Zhao2016-07-071-13/+13
| | | | | | | | | | | | | | | | 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 llvm-svn: 274727
* [esan|wset] Ensure SIGSEGV is not blockedDerek Bruening2016-07-061-4/+19
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 274672
* [esan|wset] Further reduce flakiness of sampling testDerek Bruening2016-07-061-3/+7
| | | | | | | Enhances the sampling test to try and reduce flakiness further by increasing the workload to ensure a few samples are gathered. llvm-svn: 274669
* Attempt to reduce flakiness in workingset-samples.cppDavid Majnemer2016-07-061-5/+5
| | | | | | | The test is matching against 'KB' but it looks like the output can be 'MB'. llvm-svn: 274587
* [esan|cfrag] Add struct array access reportQin Zhao2016-07-021-16/+31
| | | | | | | | | | | | | | | 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 llvm-svn: 274421
* [esan|cfrag] Add the struct field size array in StructInfoQin Zhao2016-06-171-16/+16
| | | | | | | | | | | | | | | 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 llvm-svn: 272988
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-141-0/+33
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 272676
* Revert r272591, http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 has ↵Nico Weber2016-06-141-33/+0
| | | | | | been broken since this landed. llvm-svn: 272659
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-131-0/+33
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 272591
* Revert "[sanitizer][esan] Add internal_sigaction_syscall"Derek Bruening2016-06-131-33/+0
| | | | | | | | This reverts commit r272553. The iOS build fails to link. llvm-svn: 272557
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-131-0/+33
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 272553
* [esan|cfrag] Add the struct field offset array in StructInfoQin Zhao2016-06-101-23/+23
| | | | | | | | | | | | | | | 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 llvm-svn: 272363
* [esan|wset] Reduce flakiness in samples testDerek Bruening2016-06-081-5/+5
| | | | | | | Generalizes the workingset-samples test to pass when a sample has a size of 0, which can happen on a loaded machine. llvm-svn: 272175
* [esan|cfrag] Compute the struct field access difference ratioQin Zhao2016-06-032-2/+32
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 271734
* [esan] Eliminate flakiness in large-stack testDerek Bruening2016-06-031-1/+1
| | | | | | | Turns off sampling for the large-stack test to remove nondeterminism in the output and fix bot failures. llvm-svn: 271691
* [esan|wset] Add 8-level working set snapshot accumulationDerek Bruening2016-06-031-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271683
* [esan] Add sideline itimer supportDerek Bruening2016-06-033-1/+28
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271682
* [esan] Add support for log_exe_nameDerek Bruening2016-06-021-2/+2
| | | | | | | | | | | | | | | 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 llvm-svn: 271586
* [esan|cfrag] Add struct info registrationQin Zhao2016-06-021-10/+125
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271564
* [esan|cfrag] Add the skeleton to handle the cfrag argumentQin Zhao2016-05-311-4/+4
| | | | | | | | | | | | | | | | 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 llvm-svn: 271337
* [esan] Add circular buffer data structureDerek Bruening2016-05-312-0/+67
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271286
* [esan|wset] Iterate all memory to compute the total working setDerek Bruening2016-05-313-2/+32
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271277
* [esan] Intercept and chain signal handlersDerek Bruening2016-05-311-0/+59
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 271272
* [esan] Add handling of large stack size rlimitsDerek Bruening2016-05-284-5/+82
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271079
* [esan] Fix workingset-memset test failureDerek Bruening2016-05-271-4/+3
| | | | | | | | Fixes an esan workingset-memset test failure by switching to malloc to avoid a shadow mapping issue with mmap in certain situations that will be fully fixed separately. llvm-svn: 270949
* [esan][cfrag] Add skeleton for cache fragmentation tool supportQin Zhao2016-05-251-5/+11
| | | | | | | | | | | | | | | 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 llvm-svn: 270737
* Add working set base runtime libraryDerek Bruening2016-05-252-0/+24
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 270650
* [esan|cfrag] Add test struct-simple.cppDerek Bruening2016-05-241-0/+38
| | | | | | | | | | | | | | | Summary: Adds a new test struct-simple.cpp for testing the cache-fragmentation tool with a multi-compilation-unit application. Patch by Qin Zhao. Reviewers: bruening Subscribers: kubabrecka, kcc, vitalybuka, eugenis, aizatsky, llvm-commits, zhaoqin Differential Revision: http://reviews.llvm.org/D20599 llvm-svn: 270631
* [esan] Extend shadow mapping to cover low librariesDerek Bruening2016-05-202-2/+2
| | | | | | | | | | | | | | | Summary: Adds support for app libraries starting slightly below 0x7f00'00000000 (the mmap ASLR range extends down to 0x7efb'f8000000 for reasonable stack limits) by switching to a shadow mapping offset of 0x1300'00000000. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20479 llvm-svn: 270255
* [esan] EfficiencySanitizer shadow memoryDerek Bruening2016-05-112-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds shadow memory mapping support common to all tools to the new Efficiencysanitizer ("esan") family of tools. This includes: + Shadow memory layout and mapping support for 64-bit Linux for any power-of-2 scale-down (1x, 2x, 4x, 8x, 16x, etc.) that ensures that shadow(shadow(address)) does not overlap shadow or application memory. + Mmap interception to ensure the application does not map on top of our shadow memory. + Init-time sanity checks for shadow regions. + A test of the mmap conflict mechanism. Reviewers: aizatsky, filcab Subscribers: filcab, kubabrecka, llvm-commits, vitalybuka, eugenis, kcc, zhaoqin Differential Revision: http://reviews.llvm.org/D19921 llvm-svn: 269198
* [esan] EfficiencySanitizer libc interceptorsDerek Bruening2016-04-232-2/+20
| | | | | | | | | | | | | | | | Summary: Adds libc interceptors to the runtime library for the new EfficiencySanitizer ("esan") family of tools. The interceptors cover the memory operations in most common library calls and will be shared among all esan tools. Reviewers: aizatsky Subscribers: zhaoqin, tberghammer, danalbert, srhines, llvm-commits, vitalybuka, eugenis, kcc Differential Revision: http://reviews.llvm.org/D19411 llvm-svn: 267293
* [esan] EfficiencySanitizer base runtime libraryDerek Bruening2016-04-214-0/+89
Summary: Adds the initial version of a runtime library for the new EfficiencySanitizer ("esan") family of tools. The library includes: + Slowpath code via callouts from the compiler instrumentation for each memory access. + Registration of atexit() to call finalization code. + Runtime option flags controlled by the environment variable ESAN_OPTIONS. The common sanitizer flags are supported such as verbosity and log_path. + An initial simple test. Still TODO: common code for libc interceptors and shadow memory mapping, and tool-specific code for shadow state updating. Reviewers: eugenis, vitalybuka, aizatsky, filcab Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc Differential Revision: http://reviews.llvm.org/D19168 llvm-svn: 267060
OpenPOWER on IntegriCloud