Kostya Serebryany
699ac28aa5
[asan] instrument invoke insns with noreturn attribute (as well as call insns)
...
llvm-svn: 175617
2013-02-20 12:35:15 +00:00
Kostya Serebryany
3ece9beaf1
[asan] instrument memory accesses with unusual sizes
...
This patch makes asan instrument memory accesses with unusual sizes (e.g. 5 bytes or 10 bytes), e.g. long double or
packed structures.
Instrumentation is done with two 1-byte checks
(first and last bytes) and if the error is found
__asan_report_load_n(addr, real_size) or
__asan_report_store_n(addr, real_size)
is called.
Also, call these two new functions in memset/memcpy
instrumentation.
asan-rt part will follow.
llvm-svn: 175507
2013-02-19 11:29:21 +00:00
Kostya Serebryany
7ca384bc1a
[asan] revert r175266 as it breaks code with packed structures. supporting long double will require a more general solution
...
llvm-svn: 175442
2013-02-18 13:47:02 +00:00
Kostya Serebryany
a968568165
[asan] support long double on 64-bit. See https://code.google.com/p/address-sanitizer/issues/detail?id=151
...
llvm-svn: 175266
2013-02-15 12:46:06 +00:00
Kostya Serebryany
3838f27905
[tsan] disable load widening in ThreadSanitizer mode
...
llvm-svn: 175034
2013-02-13 05:59:45 +00:00
Kostya Serebryany
e2e32b32e8
[asan] fix tests for the new ABI
...
llvm-svn: 174959
2013-02-12 11:14:24 +00:00
Evgeniy Stepanov
6f85ef300d
[msan] Mostly disable msan-handle-icmp-exact.
...
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.
llvm-svn: 173682
2013-01-28 11:42:28 +00:00
Evgeniy Stepanov
fac8403249
[msan] Implement exact shadow propagation for relational ICmp.
...
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.
llvm-svn: 173452
2013-01-25 15:31:10 +00:00
Kostya Serebryany
87191f6221
[asan] adaptive redzones for globals (the larger the global the larger is the redzone)
...
llvm-svn: 173335
2013-01-24 10:35:40 +00:00
Evgeniy Stepanov
c4415591ed
[msan] Do not insert check on volatile store.
...
Volatile bitfields can cause valid stores of uninitialized bits.
llvm-svn: 173153
2013-01-22 12:30:52 +00:00
Alexey Samsonov
1345d35e40
ASan: wrap mapping scale and offset in a struct and make it a member of ASan passes. Add test for non-default mapping scale and offset. No functionality change
...
llvm-svn: 172610
2013-01-16 13:23:28 +00:00
Evgeniy Stepanov
701d2b861e
[msan] Temporarily remove ICmpEQ tests.
...
They are failing on the bots.
llvm-svn: 172540
2013-01-15 17:12:04 +00:00
Evgeniy Stepanov
d14e47b146
[msan] Fix handling of equality comparison of pointer vectors.
...
Also improve test coveration of the handling of relational comparisons.
llvm-svn: 172539
2013-01-15 16:44:52 +00:00
Peter Collingbourne
f7d65c43d0
[msan] Change va_start/va_copy shadow memset alignment to 8.
...
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
llvm-svn: 172128
2013-01-10 22:36:33 +00:00
Alexey Samsonov
29dd7f2090
[ASan] Fix lifetime intrinsics handling. Now for each intrinsic we check if it describes one of 'interesting' allocas. Assume that allocas can go through casts and phi-nodes before apperaring as llvm.lifetime arguments
...
llvm-svn: 171153
2012-12-27 08:50:58 +00:00
Evgeniy Stepanov
5eb5bf8b46
[msan] Raise alignment of origin stores/loads when possible.
...
Origin alignment is as high as the alignment of the corresponding application
location, but never less than 4.
llvm-svn: 171110
2012-12-26 11:55:09 +00:00
Evgeniy Stepanov
f19c086d1e
[msan] Fix handling of vectors of pointers.
...
VectorType::getInteger() can not be used with them, because pointer size
depends on the target.
llvm-svn: 171070
2012-12-25 16:04:38 +00:00
Evgeniy Stepanov
ec8371283b
[msan] Fix handling of select with vector condition.
...
llvm-svn: 171069
2012-12-25 14:56:21 +00:00
Evgeniy Stepanov
4fbc0d08bf
[msan] Remove unreachable blocks before instrumenting a function.
...
llvm-svn: 170883
2012-12-21 11:18:49 +00:00
Evgeniy Stepanov
d7571cd4bc
[msan] Heuristically instrument unknown intrinsics.
...
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.
llvm-svn: 170530
2012-12-19 11:22:04 +00:00
Evgeniy Stepanov
49175b237d
[msan] Origin stores and loads do not need explicit alignment.
...
Origin address is always 4 byte aligned, and the access type is always i32.
llvm-svn: 170199
2012-12-14 13:43:11 +00:00
Alexey Samsonov
3d43b63a6e
Improve debug info generated with enabled AddressSanitizer.
...
When ASan replaces <alloca instruction> with
<offset into a common large alloca>, it should also patch
llvm.dbg.declare calls and replace debug info descriptors to mark
that we've replaced alloca with a value that stores an address
of the user variable, not the user variable itself.
See PR11818 for more context.
llvm-svn: 169984
2012-12-12 14:31:53 +00:00
Evgeniy Stepanov
4f220d96c5
[msan] Do not store origin for clean values.
...
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.
llvm-svn: 169490
2012-12-06 11:41:03 +00:00
Evgeniy Stepanov
8b51bab495
[msan] Instrument bswap intrinsic.
...
llvm-svn: 169383
2012-12-05 14:39:55 +00:00
Evgeniy Stepanov
474cb3b3b5
[msan] Change linkage type of __msan_track_origins.
...
LinkOnceODRLinkage globals may be removed in GlobalOpt if not used in the
current module.
llvm-svn: 169377
2012-12-05 12:49:41 +00:00
Evgeniy Stepanov
64bc1ab349
Improve MSan tests.
...
llvm-svn: 169256
2012-12-04 11:42:05 +00:00
Alexey Samsonov
261177a1e1
ASan: add initial support for handling llvm.lifetime intrinsics in ASan - emit calls into runtime library that poison memory for local variables when their lifetime is over and unpoison memory when their lifetime begins.
...
llvm-svn: 169200
2012-12-04 01:34:23 +00:00
Evgeniy Stepanov
5a16af8638
[msan] Tests for vector manipulation instructions.
...
llvm-svn: 168997
2012-11-30 12:12:20 +00:00
Evgeniy Stepanov
857d9d2a59
[msan] Propagate shadow through (x<0) and (x>=0) comparisons.
...
This is a special case of signed relational comparison where result
only depends on the sign of x.
llvm-svn: 168881
2012-11-29 14:25:47 +00:00
Evgeniy Stepanov
eeb8b7c391
[msan] Fix shadow & origin store & load alignment.
...
This change ensures that shadow memory accesses have the same alignment
as corresponding app memory accesses.
llvm-svn: 168880
2012-11-29 14:05:53 +00:00
Evgeniy Stepanov
c3b579e5ac
[msan] Add a test for r168873.
...
llvm-svn: 168877
2012-11-29 13:11:09 +00:00
Evgeniy Stepanov
4f9240d7e3
[msan] Update tests (broken in r168873).
...
llvm-svn: 168874
2012-11-29 12:43:56 +00:00
Evgeniy Stepanov
d4bd7b73e3
Initial commit of MemorySanitizer.
...
Compiler pass only.
llvm-svn: 168866
2012-11-29 09:57:20 +00:00
Kostya Serebryany
633bf93fb8
[asan] when checking the noreturn attribute on the call, also check it on the callee
...
llvm-svn: 168861
2012-11-29 08:57:20 +00:00
Kostya Serebryany
dfe9e7933e
[asan] Split AddressSanitizer into two passes (FunctionPass, ModulePass), LLVM part. This requires a clang part which will follow.
...
llvm-svn: 168781
2012-11-28 10:31:36 +00:00
Dmitry Vyukov
a878e74351
tsan: instrument atomic nand operation
...
llvm-svn: 168684
2012-11-27 08:09:25 +00:00
Dmitry Vyukov
12b5cb9a0a
[tsan] add fail order to compare_exchange
...
llvm-svn: 168586
2012-11-26 11:36:19 +00:00
Kostya Serebryany
dc4cb2b736
[asan] don't instrument linker-initialized globals even with external linkage in -asan-initialization-order mode
...
llvm-svn: 168367
2012-11-20 13:11:32 +00:00
Kostya Serebryany
b3bd605ffa
[asan] make sure that linker-initialized globals (non-extern) are not instrumented even in -asan-initialization-order mode. This time with a test
...
llvm-svn: 168366
2012-11-20 13:00:01 +00:00
Dmitry Vyukov
0044e386e9
tsan: switch to new memory_order constants (ABI compatible)
...
llvm-svn: 167615
2012-11-09 14:12:16 +00:00
Dmitry Vyukov
92b9e1dbfd
tsan: instrument all atomics (including fetch_add, exchange, cas, etc)
...
llvm-svn: 167612
2012-11-09 12:55:36 +00:00
Kostya Serebryany
28d0694c27
[asan] don't instrument globals that we've created ourselves (reduces the binary size a bit)
...
llvm-svn: 167230
2012-11-01 13:42:40 +00:00
Kostya Serebryany
0995994989
[asan] make sure asan erases old unused allocas after it created a new one. This became important after the recent move from ModulePass to FunctionPass because no cleanup is happening after asan pass any more.
...
llvm-svn: 166267
2012-10-19 06:20:53 +00:00
Kostya Serebryany
19ab3d1f6a
[asan] fix a test
...
llvm-svn: 165938
2012-10-15 14:30:30 +00:00
Dmitry Vyukov
84d75cdffd
tsan: update the test for new atomic enums
...
llvm-svn: 165109
2012-10-03 13:19:20 +00:00
Dmitry Vyukov
68845093dd
tsan: update the test for new atomic enums
...
llvm-svn: 165108
2012-10-03 13:13:54 +00:00
Sylvestre Ledru
91ce36c986
Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767
...
llvm-svn: 164768
2012-09-27 10:14:43 +00:00
Sylvestre Ledru
721cffd53a
Fix a typo 'iff' => 'if'
...
llvm-svn: 164767
2012-09-27 09:59:43 +00:00
Kostya Serebryany
f4be019fba
[asan] add code to detect global initialization fiasco in C/C++. The sub-pass is off by default for now. Patch by Reid Watson. Note: this patch changes the interface between LLVM and compiler-rt parts of asan. The corresponding patch to compiler-rt will follow.
...
llvm-svn: 162268
2012-08-21 08:24:25 +00:00
Kostya Serebryany
bf479714f9
[asan] insert crash basic blocks inline as opposed to inserting them at the end of the function. This doesn't seem to fix or break anything, but is considered to be more friendly to downstream passes (test change)
...
llvm-svn: 161871
2012-08-14 14:05:50 +00:00