summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/esan
Commit message (Collapse)AuthorAgeFilesLines
...
* [esan|wset] Add 8-level working set snapshot accumulationDerek Bruening2016-06-033-13/+96
| | | | | | | | | | | | | | | | | | | | | | | | | 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-035-1/+272
| | | | | | | | | | | | | | | | | | | | | 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] Ensure internal_sigaction() bypasses interceptorsDerek Bruening2016-06-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271626
* [esan] Add support for log_exe_nameDerek Bruening2016-06-021-0/+1
| | | | | | | | | | | | | | | 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-6/+69
| | | | | | | | | | | | | | | | | | | | | 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-312-2/+28
| | | | | | | | | | | | | | | | 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-311-0/+92
| | | | | | | | | | | | | | | | | | | 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-11/+93
| | | | | | | | | | | | | | | | | | | | | 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-317-1/+170
| | | | | | | | | | | | | | | | | | 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-286-39/+104
| | | | | | | | | | | | | | | | | | | | | 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][cfrag] Add skeleton for cache fragmentation tool supportQin Zhao2016-05-254-5/+78
| | | | | | | | | | | | | | | 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-255-6/+146
| | | | | | | | | | | | | | | | | | 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] Add compilation unit init/exit routines.Derek Bruening2016-05-245-2/+24
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 270624
* [esan] Add custom flag supportDerek Bruening2016-05-205-17/+126
| | | | | | | | | | | | | | | Summary: Adds custom flag support to EfficiencySanitizer's runtime library. Adds an initial flag cache_line_size which will be used by multiple tools. Reviewers: aizatsky, vitalybuka Subscribers: llvm-commits, eugenis, kcc, zhaoqin, aizatsky, kubabrecka Differential Revision: http://reviews.llvm.org/D20478 llvm-svn: 270256
* [esan] Extend shadow mapping to cover low librariesDerek Bruening2016-05-202-20/+37
| | | | | | | | | | | | | | | 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] Fix isShadowMem endpoint bugDerek Bruening2016-05-171-2/+1
| | | | | | | Fixes a bug in checking the endpoint of a shadow region and removes an invalid check (both introduced in http://reviews.llvm.org/rL269198). llvm-svn: 269834
* [sanitizer] Move *stat to the common interceptorsEvgeniy Stepanov2016-05-111-71/+0
| | | | | | | | | | | Adds *stat to the common interceptors. Removes the now-duplicate *stat interceptor from msan/tsan/esan. This adds *stat to asan, which previously did not intercept it. Patch by Qin Zhao. llvm-svn: 269223
* [esan] EfficiencySanitizer shadow memoryDerek Bruening2016-05-113-0/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky2016-05-031-18/+0
| | | | | | | | | | | | | | | | | | Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D19875 with win build fixes. Reviewers: aizatsky, eugenis Subscribers: tberghammer, llvm-commits, danalbert, vitalybuka, bruening, srhines, kubabrecka, kcc Differential Revision: http://reviews.llvm.org/D19890 llvm-svn: 268466
* Revert "[sanitizer] Move stat/__xstat to the common interceptors"Mike Aizatsky2016-05-031-0/+18
| | | | | | | | This reverts commit 268440 because it breaks the windows bot. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21425/steps/build%20compiler-rt/logs/stdio llvm-svn: 268448
* [sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky2016-05-031-18/+0
| | | | | | | | | | | | | | | | Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Reviewers: aizatsky, eugenis Subscribers: tberghammer, danalbert, srhines, kubabrecka, llvm-commits, vitalybuka, eugenis, kcc, bruening Differential Revision: http://reviews.llvm.org/D19875 llvm-svn: 268440
* [esan] Use do-while rather than braces for empty interceptorsDerek Bruening2016-05-031-28/+129
| | | | | | | | | | | | | | | Summary: Replaces {} with a do..while sequence in esan's empty interceptors to allow natural use with a trailing semicolon. The sequence uses each argument to avoid warnings. Reviewers: filcab Subscribers: kubabrecka, llvm-commits, zhaoqin Differential Revision: http://reviews.llvm.org/D19832 llvm-svn: 268426
* [sanitizers] Get the proper symbol version when long double transition is ↵Marcin Koscielnicki2016-04-271-0/+2
| | | | | | | | | | | | | | | | | involved. On linux, some architectures had an ABI transition from 64-bit long double (ie. same as double) to 128-bit long double. On those, glibc symbols involving long doubles come in two versions, and we need to pass the correct one to dlvsym when intercepting them. A few more functions we intercept are also versioned (all printf, scanf, strtold variants), but there's no need to fix these, as the REAL() versions are never called. Differential Revision: http://reviews.llvm.org/D19555 llvm-svn: 267794
* [esan] Fix uninitialized warning from interception contextDerek Bruening2016-04-251-0/+2
| | | | | | | | The interception context is not used by esan, but the compiler complains about it being uninitialized all the same. We set it to null to avoid the warning. llvm-svn: 267376
* [esan] EfficiencySanitizer libc interceptorsDerek Bruening2016-04-234-1/+343
| | | | | | | | | | | | | | | | 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-216-0/+368
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