summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Commit message (Collapse)AuthorAge
* Rename BlackList class to SpecialCaseList and move it to Transforms/Utils.Peter Collingbourne2013-07-09
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1089 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185975 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Unpoison stack allocations and undef values in blacklisted functions.Evgeniy Stepanov2013-07-03
| | | | | | | | | This changes behavior of -msan-poison-stack=0 flag from not poisoning stack allocations to actively unpoisoning them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185538 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Handle mixed track-origins and keep-going settings (llvm part).Evgeniy Stepanov2013-05-31
| | | | | | | | | | | | | | | Before this change, each module defined a weak_odr global __msan_track_origins with a value of 1 if origin tracking is enabled, 0 if disabled. If there are modules with different values, any of them may win. If 0 wins, and there is at least one module with 1, the program will most likely crash. With this change, __msan_track_origins is only emitted if origin tracking is on. Then runtime library detects if there is at least one module with origin tracking, and enables runtime support for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182997 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix argument shadow alignment.Evgeniy Stepanov2013-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182771 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] A no-op implementation of VarArg handling.Evgeniy Stepanov2013-05-21
| | | | | | | | This stuff is used on platforms where MSan does not have a proper VarArg implementation (anything other than x86_64 at the moment). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182375 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Switch TLS globals to initial-exec model.Evgeniy Stepanov2013-05-16
| | | | | | | They are always defined in the main executable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181994 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a documentation warning: \bried -> \briefDmitri Gribenko2013-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181551 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Add an option to disable poisoning of shadow for undef values.Evgeniy Stepanov2013-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177630 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Implement sanitize_memory attribute.Evgeniy Stepanov2013-02-28
| | | | | | | | | | | Shadow checks are disabled and memory loads always produce fully initialized values in functions that don't have a sanitize_memory attribute. Value and argument shadow is propagated as usual. This change also updates blacklist behaviour to match the above. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176247 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused leftover declarations.Evgeniy Stepanov2013-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176240 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing warnings revealed by gcc release buildEdwin Vane2013-01-29
| | | | | | | | | Fixed set-but-not-used warnings. Reviewer: gribozavr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173810 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Mostly disable msan-handle-icmp-exact.Evgeniy Stepanov2013-01-28
| | | | | | | | | It is way too slow. Change the default option value to 0. Always do exact shadow propagation for unsigned ICmp with constants, it is cheap (under 1% cpu time) and required for correctness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173682 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r173678.Evgeniy Stepanov2013-01-28
| | | | | | | Broken tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173679 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Make msan-handle-icmp-exact=0 by default.Evgeniy Stepanov2013-01-28
| | | | | | | 50% slowdown on one of the specs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173678 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] A comment on ICmp handling logic.Evgeniy Stepanov2013-01-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173453 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Implement exact shadow propagation for relational ICmp.Evgeniy Stepanov2013-01-25
| | | | | | | | | Only for integers, pointers, and vectors of those. No floats. Instrumentation seems very heavy, and may need to be replaced with some approximation in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173452 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKindBill Wendling2013-01-23
| | | | | | | when removing one attribute. This further encapsulates the use of the attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173214 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Export the value of msan-keep-going flag for the runtime.Evgeniy Stepanov2013-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173156 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Do not insert check on volatile store.Evgeniy Stepanov2013-01-22
| | | | | | | Volatile bitfields can cause valid stores of uninitialized bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173153 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort all of the includes. Several files got checked in with mis-sortedChandler Carruth2013-01-19
| | | | | | includes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172891 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Blacklist.h to include/ to enable use from clang.Will Dietz2013-01-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172806 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix handling of equality comparison of pointer vectors.Evgeniy Stepanov2013-01-15
| | | | | | | Also improve test coveration of the handling of relational comparisons. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172539 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Change va_start/va_copy shadow memset alignment to 8.Peter Collingbourne2013-01-10
| | | | | | | | | This fixes va_start/va_copy of a va_list field which happens to not be laid out at a 16-byte boundary. Differential Revision: http://llvm-reviews.chandlerc.com/D276 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172128 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually update the CMake and Makefile builds correctly, and update theChandler Carruth2013-01-02
| | | | | | | | | | code that includes Intrinsics.gen directly. This never showed up in my testing because the old Intrinsics.gen was still kicking around in the make build system and was correct there. =[ Thankfully, some of the bots to clean rebuilds and that caught this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171373 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Add proper support for -fsanitize-blacklist= flag for TSan and MSan. LLVM part.Alexey Samsonov2012-12-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171183 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Raise alignment of origin stores/loads when possible.Evgeniy Stepanov2012-12-26
| | | | | | | | | Origin alignment is as high as the alignment of the corresponding application location, but never less than 4. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171110 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Expand the file comment with track-origins info.Evgeniy Stepanov2012-12-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171109 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix handling of vectors of pointers.Evgeniy Stepanov2012-12-25
| | | | | | | | VectorType::getInteger() can not be used with them, because pointer size depends on the target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171070 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix handling of select with vector condition.Evgeniy Stepanov2012-12-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171069 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Remove unreachable blocks before instrumenting a function.Evgeniy Stepanov2012-12-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170883 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Add track-origins argument to the pass constructor.Evgeniy Stepanov2012-12-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170544 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Heuristically instrument unknown intrinsics.Evgeniy Stepanov2012-12-19
| | | | | | | | | | | | | This changes adds shadow and origin propagation for unknown intrinsics by examining the arguments and ModRef behaviour. For now, only 3 classes of intrinsics are handled: - those that look like simple SIMD store - those that look like simple SIMD load - those that don't have memory effects and look like arithmetic/logic/whatever operation on simple types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170530 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-19
| | | | | | single attribute in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix lint warning.Evgeniy Stepanov2012-12-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170347 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix lint warnings in MemorySanitizer.cpp.Evgeniy Stepanov2012-12-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170203 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Origin stores and loads do not need explicit alignment.Evgeniy Stepanov2012-12-14
| | | | | | | Origin address is always 4 byte aligned, and the access type is always i32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170199 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Refactor default shadow propagation and origin tracking.Evgeniy Stepanov2012-12-14
| | | | | | | | | This change moves the code for default shadow propagaition (handleShadowOr) and origin tracking (setOriginForNaryOp) into a new builder-like class. Also gets rid of handleShadowOrBinary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170192 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Use explicitely aligned stores and loads with function argument shadow.Evgeniy Stepanov2012-12-11
| | | | | | | | | | Use explicitely aligned store and load instructions to deal with argument and retval shadow. This matters when an argument's alignment is higher than __msan_param_tls alignment (which is the case with __m128i). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169859 91177308-0d34-0410-b5e6-96231b3b80d8
* s/AttrListPtr/AttributeSet/g to better label what this class is going to be ↵Bill Wendling2012-12-07
| | | | | | in the near future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Remove readonly/readnone attributes from all called functions.Evgeniy Stepanov2012-12-07
| | | | | | | | | | | MSan uses a TLS slot to pass shadow for function arguments and return values. This makes all instrumented functions not readonly, and at the same time requires that all callees of an instrumented function that may be MSan-instrumented do not have readonly attribute (otherwise some of the instrumentation may be optimized out). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169591 91177308-0d34-0410-b5e6-96231b3b80d8
* MemorySanitizer.cpp: Suppress a warning. [-Wunused-variable]NAKAMURA Takumi2012-12-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169504 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix a typo in a comment.Evgeniy Stepanov2012-12-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169491 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Do not store origin for clean values.Evgeniy Stepanov2012-12-06
| | | | | | | | | | | | | | | | | | | Instead of unconditionally storing origin with every application store, only do this when the shadow of the stored value is != 0. This change also delays instrumentation of stores until after the walk over function's instructions, because adding new basic blocks confuses InstVisitor. We only keep 1 origin value per 4 bytes of application memory. This change fixes the bug when a store of a single clean byte wiped the origin for the whole 4-byte area. Since stores of uninitialized values are relatively uncommon, this change improves performance of track-origins mode by 5% median and by up to 47% on specs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169490 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Instrument bswap intrinsic.Evgeniy Stepanov2012-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169383 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Initialize callbacks in runOnFunction as opposed to doInitialization.Evgeniy Stepanov2012-12-05
| | | | | | | This mirrors the change in ASan & TSan done in r168864. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169378 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Change linkage type of __msan_track_origins.Evgeniy Stepanov2012-12-05
| | | | | | | | LinkOnceODRLinkage globals may be removed in GlobalOpt if not used in the current module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169377 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the InstVisitor utility into VMCore where it belongs. It heavilyChandler Carruth2012-11-30
| | | | | | | | | | | | depends on the IR infrastructure, there is no sense in it being off in Support land. This is in preparation to start working to expand InstVisitor into more special-purpose visitors that are still generic and can be re-used across different passes. The expansion will go into the Analylis tree though as nothing in VMCore needs it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168972 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply Takumi's patch to suppress unused-variable warnings in -Asserts builds.Matt Beaumont-Gay2012-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168911 91177308-0d34-0410-b5e6-96231b3b80d8