Yuchen Wu
a5de343c79
compiler-rt: Added support for function checksums.
...
llvm-svn: 196357
2013-12-04 06:00:04 +00:00
Sergey Matveev
12d2143dbc
[asan] Fix build error.
...
llvm-svn: 196303
2013-12-03 18:44:50 +00:00
Sergey Matveev
d8fb4d8f91
[sanitizer] Expose __sanitizer_print_stack_trace().
...
Expose a new interface function for debugging code built with sanitizer tools.
Add an ASan implementation.
llvm-svn: 196302
2013-12-03 18:24:28 +00:00
Joerg Sonnenberger
24f4a7dbec
For libkern and libsa on NetBSD, the normal system headers can't be
...
used. Adjust.
llvm-svn: 196292
2013-12-03 16:19:14 +00:00
Alexey Samsonov
907eb5b630
[Sanitizer] Use more appropriate InternalScopedString in GetCodeRangeForFile
...
llvm-svn: 196264
2013-12-03 09:29:23 +00:00
Alexey Samsonov
8dd33a27c3
[Sanitizer] Fix a bug introduced in r196112. Add a test.
...
llvm-svn: 196263
2013-12-03 09:21:08 +00:00
Sergey Matveev
b748d46019
[sanitizer] Allow InternalMmapVector construction with zero capacity.
...
llvm-svn: 196112
2013-12-02 15:41:04 +00:00
Evgeniy Stepanov
c0378e72d1
[sanitizer] Intercept textdomain.
...
Patch by Alexander Taran.
llvm-svn: 196098
2013-12-02 13:43:26 +00:00
Kostya Serebryany
5236c79932
[asan] disable AddressSanitizer.HugeMallocTest if ASAN_AVOID_EXPENSIVE_TESTS is set
...
llvm-svn: 196097
2013-12-02 13:22:27 +00:00
Kostya Serebryany
dc58090213
[asan] dump coverage even if asan has reported an error
...
llvm-svn: 195959
2013-11-29 14:49:32 +00:00
Kostya Serebryany
5774faf5b0
[sanitizer] disable shmctl intercetor in 32-bit -- it is rotten (bug filed)
...
llvm-svn: 195958
2013-11-29 14:09:13 +00:00
Timur Iskhodzhanov
5ca41e3800
Increase the LocatePcInTrace PC threshold now that GET_STACK_TRACE_WITH_PC_AND_BP has grown
...
llvm-svn: 195957
2013-11-29 13:15:25 +00:00
Timur Iskhodzhanov
a10c46f2ae
Fix current stack unwinding when using DRASan
...
llvm-svn: 195956
2013-11-29 12:53:30 +00:00
Timur Iskhodzhanov
bbf2ff8193
[ASan] Also print <empty stack> when size==0
...
llvm-svn: 195955
2013-11-29 12:08:59 +00:00
Evgeniy Stepanov
f2cddc3e64
[sanitizer] Disable iconv interceptor in OSX.
...
iconv is defined in an optional DSO, and our interception logic on OSX does not
support that.
llvm-svn: 195919
2013-11-28 14:42:59 +00:00
Evgeniy Stepanov
b56c5cd95e
[sanitizer] Intercept times.
...
llvm-svn: 195918
2013-11-28 14:41:22 +00:00
Evgeniy Stepanov
9c1f8323ae
[sanitizer] Intercept iconv.
...
llvm-svn: 195917
2013-11-28 14:14:48 +00:00
Dmitry Vyukov
25ecfcf00c
tsan: deflake more tests
...
llvm-svn: 195916
2013-11-28 10:12:16 +00:00
Dmitry Vyukov
8d1eb705c7
tsan: add support for passing file descriptors over UNIX domain sockets
...
tsan was missing new fd's arrived from recvmsg(),
and thus was reporting false positives due to missed synchronization on the fd's
llvm-svn: 195914
2013-11-28 09:09:42 +00:00
Dmitry Vyukov
0fea3ad0c7
tsan: deflake more tests
...
llvm-svn: 195913
2013-11-28 09:06:55 +00:00
Dmitry Vyukov
c03868615b
tsan: clarify "thread ended with ignores enabled" message
...
llvm-svn: 195858
2013-11-27 18:23:52 +00:00
Timur Iskhodzhanov
c085e99385
Add a DLL thunk for __asan_handle_no_return
...
llvm-svn: 195845
2013-11-27 14:36:44 +00:00
Alexey Samsonov
e0e31c4a30
[ASan] Clarify that AsanThread objects are allocated only via mmap(). No functionality change.
...
llvm-svn: 195840
2013-11-27 13:22:21 +00:00
Evgeniy Stepanov
b76b687628
[sanitizer] Intercept __xpg_strerror_r.
...
llvm-svn: 195839
2013-11-27 12:29:10 +00:00
Lorenzo Martignoni
085bf66e60
Added missing lib/dfsan/scripts/check_custom_wrappers.sh
...
llvm-svn: 195838
2013-11-27 11:50:44 +00:00
Alexey Samsonov
1c256cbcc4
[Sanitizer] Add rudimentary support for using libbacktrace in symbolizer.
...
More steps are needed to actually make it usable:
* sanitizer runtimes should be compiled with -DSANITIZER_LIBBACKTRACE.
* libbacktrace headers should be installed.
* user has to manually link in libbacktrace.a into the executable.
We can easily solve the first two problems in the build system, but
detecting/linking libbacktrace to all the tests we have and end-user programs
is more challenging (and will unlikely work w/o Driver support).
Based on the patch by Jakub Jelinek!
llvm-svn: 195837
2013-11-27 11:46:58 +00:00
Dmitry Vyukov
3238e1c913
tsan: better diagnostics if thread finishes with ignores enabled
...
print thread creation stack
and stacks where ignores were enabled.
llvm-svn: 195836
2013-11-27 11:30:28 +00:00
Dmitry Vyukov
44be414d69
asan: fix android build
...
android does not seem to have IOCB_CMD_PREADV
llvm-svn: 195835
2013-11-27 11:20:55 +00:00
Dmitry Vyukov
89117e1fcc
tsan: do not leave verbosity>0 in tests
...
llvm-svn: 195833
2013-11-27 10:05:22 +00:00
Dmitry Vyukov
51b35901fd
tsan: minor refactoring
...
use common helper macro
llvm-svn: 195832
2013-11-27 09:59:11 +00:00
Dmitry Vyukov
7bd319cc08
tsan: fix flags parsing
...
- running_on_valgrind was not parsed in some contexts
- refactor code a bit
- add comprehensive tests for flags parsing
llvm-svn: 195831
2013-11-27 09:54:10 +00:00
Dmitry Vyukov
ee882ba4a1
tsan: support synchronization by means of linux aio
...
http://llvm-reviews.chandlerc.com/D2269
llvm-svn: 195830
2013-11-27 09:10:47 +00:00
Alexey Samsonov
d5144879f9
[Sanitizer] Improve external symbolizer behavior.
...
1) Don't start external symbolizer subprocess until we actually try to
symbolize anything.
2) Allow to turn off external symbolizer by providing empty ?SAN_SYMBOLIZER_PATH
environment variable.
llvm-svn: 195771
2013-11-26 16:24:53 +00:00
Lorenzo Martignoni
895454e1e4
Implement a bunch of custom glibc wrappers & corresponding tests
...
llvm-svn: 195749
2013-11-26 11:45:58 +00:00
Timur Iskhodzhanov
895392d03f
[ASan] Use ExitProcess rather than _exit on Windows to avoid calling global dtors etc
...
llvm-svn: 195723
2013-11-26 09:40:39 +00:00
Peter Collingbourne
4184a471f2
build-libc-list.py: Replace --{,usr,gcc}lib with flags for specific libraries.
...
This should allow us to cope with newer versions of GCC (and more esoteric
directory layouts).
llvm-svn: 195695
2013-11-25 23:50:05 +00:00
Sergey Matveev
5170bca73c
[lsan] Unbreak lsan_testlib.cc.
...
Also, add missing logging output.
llvm-svn: 195652
2013-11-25 15:54:31 +00:00
Alexey Samsonov
c700e76278
[UBSan] Fix warning by specifying __extension__ before __int128
...
llvm-svn: 195648
2013-11-25 15:12:40 +00:00
Dmitry Vyukov
8cb7d46d98
tsan: filter out more bogus fd values
...
people do close(sysconf(_SC_OPEN_MAX)) after fork, where _SC_OPEN_MAX=1200000.
llvm-svn: 195645
2013-11-25 14:53:29 +00:00
Sergey Matveev
6b0f6af374
[lsan] Add a missing file.
...
llvm-svn: 195643
2013-11-25 14:30:37 +00:00
Sergey Matveev
2d3f8d7840
[lsan] Unbreak standalone LSan's initialization by making it more like ASan's.
...
No longer allow interceptors to be called during initialization, use the preinit
array (instead of initializing at the first call to an intercepted function) and
adopt the calloc() hack from ASan.
llvm-svn: 195642
2013-11-25 14:25:36 +00:00
Kostya Serebryany
ccfc0481f1
[sanitizer] Implement TwoLevelByteMap and use it for the internal allocator on 64-bit.
...
Summary:
Implement TwoLevelByteMap and use it for the internal allocator on 64-bit.
This reduces bss on 64-bit by ~8Mb because we don't use FlatByteMap on 64-bits any more.
Dmitry, please check my understanding of atomics.
Reviewers: dvyukov
Reviewed By: dvyukov
CC: samsonov, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2259
llvm-svn: 195637
2013-11-25 11:33:41 +00:00
Timur Iskhodzhanov
0d419293e2
[ASan] Follow-up fix: use #if SANITIZER_WINDOWS, not #ifdef
...
llvm-svn: 195625
2013-11-25 07:56:05 +00:00
Timur Iskhodzhanov
25cc3c55cc
[ASan] Un-break the Windows build
...
llvm-svn: 195624
2013-11-25 07:54:55 +00:00
Sergey Matveev
634a75b63e
[sanitizer] Do not clear memory which comes from secondary allocator.
...
Secondary allocator is mmap-based, so the memory is already zeroed.
llvm-svn: 195571
2013-11-24 14:45:38 +00:00
Sergey Matveev
10548681c0
[lsan] Use real memset to clear memory in standalone LSan.
...
Performance improvement. Also, the allocator was using CompactSizeClassMap for
no good reason, so I switched it to DefaultSizeClassMap.
llvm-svn: 195570
2013-11-24 14:28:18 +00:00
Kostya Serebryany
a2fde9484f
[sanitizer] use 16-byte aligned bzero in performance critical place (mostly for lsan)
...
llvm-svn: 195549
2013-11-23 12:49:19 +00:00
Alexander Potapenko
32474d6226
[ASan] Fix large_allocator_unpoisons_on_free.cc to pass correct parameters to mmap() on OSX.
...
llvm-svn: 195443
2013-11-22 11:19:28 +00:00
Evgeniy Stepanov
8f944b6672
[sanitizer] Fix kernel headers compatibility on powerpc64.
...
llvm-svn: 195442
2013-11-22 11:01:43 +00:00
Kostya Serebryany
b1118e5952
Call real pthread_attr_getstack instead of the interceptor
...
Summary:
Call real pthread_attr_getstack instead of the interceptor
when we do intercept pthread_attr_getstack.
Reviewers: samsonov, eugenis
Reviewed By: samsonov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2237
llvm-svn: 195441
2013-11-22 10:44:31 +00:00
Evgeniy Stepanov
db643d7678
[sanitizer] Add kernel_stat definitions for arm.
...
llvm-svn: 195436
2013-11-22 10:09:34 +00:00
Evgeniy Stepanov
f3aa5b5257
[sanitizer] Restore perf_event_attr handling.
...
This time in a forward/backward compatible way.
llvm-svn: 195434
2013-11-22 09:32:39 +00:00
Evgeniy Stepanov
c53407de3c
[sanitizer] Fix build.
...
llvm-svn: 195433
2013-11-22 09:26:10 +00:00
Evgeniy Stepanov
39cc337e20
[sanitizer] Change the way we use certain linux kernel headers.
...
Some linux headers are broken on older kernels.
Instead of depending on the constants and types from such headers directly,
we provide our own definitions and then verify them with compile-time
assertions. This makes the dependency on the headers test-only and would allow
switching to some other way of testing on older kernels, or even disable the
tests as the last resort (after all, kernel interfaces are supposed to be
stable).
llvm-svn: 195427
2013-11-22 09:01:50 +00:00
Evgeniy Stepanov
fe8ed4a591
[sanitizer] Add missing header dependencies.
...
llvm-svn: 195425
2013-11-22 08:55:33 +00:00
Peter Collingbourne
f09d5d03fd
Revert r195381, "Implement a bunch of custom glibc wrappers & corresponding tests."
...
It broke a buildbot.
llvm-svn: 195392
2013-11-21 23:48:19 +00:00
Peter Collingbourne
0a14a71061
Implement a bunch of custom glibc wrappers & corresponding tests.
...
- Introduce several new custom glibc wrappers
- Implement some of the not yet implemented wrappers
- Refactor and extend the tests
- Add script to make sure all declare custom glibc wrappers are implemented & tested.
Patch by Lorenzo Martignoni!
Differential Revision: http://llvm-reviews.chandlerc.com/D2234
llvm-svn: 195381
2013-11-21 23:18:03 +00:00
Kostya Serebryany
67968632ba
[asan] rename contiguous-container-buffer-overflow (too long) to container-overflow
...
llvm-svn: 195352
2013-11-21 12:23:52 +00:00
Dmitry Vyukov
5f1a783914
tsan: deflake tests
...
the tests produce episodic flakes
the hypothesis is that it's due to our "racy" race detection algorithm
sleeps should remove the flakes
llvm-svn: 195351
2013-11-21 12:23:17 +00:00
Evgeniy Stepanov
1bdf5c93e1
[msan] Test for r195349.
...
llvm-svn: 195350
2013-11-21 12:01:07 +00:00
Dmitry Vyukov
70fcec46e9
tsan: remove debug output from test
...
llvm-svn: 195347
2013-11-21 11:50:45 +00:00
Dmitry Vyukov
5fa72d4c3f
tsan: add -lm to output test build script
...
as common sanitizer interceptors now require it
llvm-svn: 195346
2013-11-21 11:49:08 +00:00
Dmitry Vyukov
4ca8ee692e
tsan: fix handling of setjmp
...
It's incorrect to take address of setjmp,
because it may not (ligally) present in libc.
Fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59188
llvm-svn: 195345
2013-11-21 11:48:29 +00:00
Kostya Serebryany
53c51a1675
[tsan] use FileCheck in race_on_speculative_load.cc
...
llvm-svn: 195331
2013-11-21 09:09:47 +00:00
Kostya Serebryany
95f3e54066
[tsan] add a run-time-side regression test for https://code.google.com/p/thread-sanitizer/issues/detail?id=40 (tsan-hostile load speculation)
...
llvm-svn: 195325
2013-11-21 07:31:12 +00:00
Evgeniy Stepanov
3e29c6bf22
[asan] Fix OSX tests.
...
llvm-svn: 195250
2013-11-20 14:21:56 +00:00
Evgeniy Stepanov
0958ecca7e
[msan] Tweak io_submit syscall hook.
...
llvm-svn: 195246
2013-11-20 13:04:23 +00:00
Evgeniy Stepanov
584fd96e9e
[msan] Unpoison memory that is returned to the OS and flush its shadow.
...
llvm-svn: 195244
2013-11-20 12:51:14 +00:00
Evgeniy Stepanov
115ef14548
[asan] Test that LargeAllocator unpoisons memory before releasing it to the OS.
...
llvm-svn: 195243
2013-11-20 12:49:53 +00:00
Duncan P. N. Exon Smith
2f234f4908
Fixing ordering of definition of IOSSIM_SDK_PATH
...
llvm-svn: 195216
2013-11-20 05:36:52 +00:00
Yuchen Wu
ea7611c53c
compiler-rt: Support for file checksum in GCDAProfiling.cpp.
...
Takes file checksum as an argument to write to .gcda file.
llvm-svn: 195190
2013-11-20 04:14:48 +00:00
Dmitry Vyukov
2918b67029
tsan: fix WTFAnnotateBenignRaceSized annotation
...
actually use the passed size
llvm-svn: 195133
2013-11-19 16:03:15 +00:00
Alexander Potapenko
2b00289bd6
[ASan] Use -isysroot instead of -Wl,-syslibroot to link the ASan iossim runtime
...
(-Wl,-syslibroot was accidentally overridden by -isysroot from Clang on OSX 10.9)
-isysroot is a Clang/LLVM-GCC-specific option, but hosting libsanitizer for LLVM
with GCC on Darwin shouldn't work anyway, because of the missing blocks support.
llvm-svn: 195132
2013-11-19 14:58:42 +00:00
Kostya Serebryany
3771a3dd73
[asan] remove a fixed FIXME; extend the comment around __sanitizer_annotate_contiguous_container
...
llvm-svn: 195131
2013-11-19 14:54:14 +00:00
Evgeniy Stepanov
bfb2016c83
[msan] Fix origin tracking in unaligned load/store.
...
llvm-svn: 195130
2013-11-19 14:47:56 +00:00
Alexander Potapenko
9ff321d18d
[ASan] Don't put asan_iossim_dynamic in the list of configurations to build
...
if the iOS Simulator SDK is missing on the machine.
llvm-svn: 195125
2013-11-19 13:24:29 +00:00
Kostya Serebryany
7b664299f0
[asan] new shadow poison magic for contiguous-container-buffer-overflow, addressed Alexey Samsonov's comments for r195011
...
llvm-svn: 195117
2013-11-19 08:40:07 +00:00
Peter Collingbourne
01b337dc2d
[dfsan] Tweaks for the ABI list
...
- Add a bunch of glibc functions to the ABI list
- Group similar functions in the ABI
Patch by Lorenzo Martignoni!
Differential Revision: http://llvm-reviews.chandlerc.com/D2185
llvm-svn: 195110
2013-11-19 06:33:13 +00:00
Alexey Samsonov
59243333de
[ASan] Run one of UAS tests in UAR mode as well
...
llvm-svn: 195015
2013-11-18 14:54:50 +00:00
Kostya Serebryany
60ecf38133
[asan] fix Windows build
...
llvm-svn: 195012
2013-11-18 14:26:13 +00:00
Kostya Serebryany
3d97c2040d
[asan] introduce __sanitizer_annotate_contiguous_container
...
llvm-svn: 195011
2013-11-18 14:02:05 +00:00
Alexey Samsonov
1011fe6a6e
CMake: make sure compiler-rt headers are copied to build tree if 'compilrer-rt' target is built
...
llvm-svn: 195002
2013-11-18 10:57:36 +00:00
Kostya Serebryany
a92b07d684
[asan] support __hppa__ (by John David Anglin)
...
llvm-svn: 194995
2013-11-18 08:20:13 +00:00
Alexey Samsonov
be9d20b7a9
[ASan] Build ASan on Windows only if MSVC is used
...
llvm-svn: 194963
2013-11-17 12:18:35 +00:00
Alexey Samsonov
5d3fda728d
CMake: don't build sanitizer runtimes on 64-bit Windows (it's unsupported for now)
...
llvm-svn: 194958
2013-11-17 10:12:23 +00:00
Alexey Samsonov
4985d5274a
[DFSan] Don't include public headers in dfsan runtime code
...
Summary:
Definitions we use in public sanitizer headers may
slightly conflict with the ones we use in private sanitizer runtimes.
Moreover, we generally forbid to include any system headers (like <stdint.h>)
in sanitizer runtime headers. This leads to inevitable duplication of selected
interface function declarations, but we decided to live with it.
Reviewers: pcc
Reviewed By: pcc
CC: kcc, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2179
llvm-svn: 194955
2013-11-17 09:41:47 +00:00
Tim Northover
3ae5a369d8
Revert premature instructions to build __sync_fetch_*
...
My commits got a bit twisted when I was working on both embedded support and
__sync stuff on the same branch. Sorry about that.
llvm-svn: 194886
2013-11-15 23:26:29 +00:00
Tim Northover
084647d4c0
Add clang_darwin_embedded platform for embedded projects
...
This should build a separate set of embedded runtime libraries, supporting the
option product:
{PIC, static} x { Hard-float, soft-float }
The emphasis is on ARM platforms (Cortex-M4F, Cortex-M3, Cortex-M0) but X86
variants are also built where possible.
rdar://problem/10817205
llvm-svn: 194873
2013-11-15 23:00:42 +00:00
Bob Wilson
99d8fa92c3
Remove #include of net/ip_mroute.h for SANITIZER_MAC.
...
This header has not been supported at all for the last 2 major OS X releases.
Removed its include and the capture of related symbols.
<rdar://problem/15303348>
llvm-svn: 194841
2013-11-15 19:13:08 +00:00
Dmitry Vyukov
4bbe6dc8a9
tsan: add support for robust mutexes
...
llvm-svn: 194823
2013-11-15 16:58:12 +00:00
Alexander Potapenko
bf50fbfc21
[ASan] Add the configure+make rules for building the ASan runtime for iOS simulator.
...
llvm-svn: 194813
2013-11-15 13:13:01 +00:00
Kostya Serebryany
b41503253b
[asan] helper script to dump/merge coverage data
...
llvm-svn: 194809
2013-11-15 11:51:08 +00:00
Alexey Samsonov
a6e8322fb1
[Sanitizer] Make slow unwinder on Linux more robust
...
llvm-svn: 194805
2013-11-15 10:57:56 +00:00
Dmitry Vyukov
0b76e408b4
tsan: add proper cfi directives to assembly code
...
this allows gdb to unwind through our hacky call
llvm-svn: 194803
2013-11-15 10:25:53 +00:00
Chandler Carruth
65fd238772
LLVM's GoogleTest copy has moved its source code back to the default
...
location, update this reference to reflect that.
llvm-svn: 194802
2013-11-15 10:21:15 +00:00
Alexey Samsonov
352d0e52f5
Don't build unsupported compiler-rt pieces on Windows
...
llvm-svn: 194796
2013-11-15 09:09:23 +00:00
Bob Wilson
a08e9ac927
Reapply asan coverage changes 194702-194704.
...
I still don't know what is causing our bootstrapped LTO buildbots to fail,
but llvm r194701 seems to be OK and I can't imagine that these changes could
cause the problem.
llvm-svn: 194790
2013-11-15 07:18:15 +00:00
Bob Wilson
abc91eacac
Speculatively revert asan coverage changes 194702-194704.
...
Apple's bootstrapped LTO builds have been failing, and these changes (along
with llvm 194701) are the only things on the blamelist. I will either reapply
these changes or help debug the problem, depending on whether this fixes the
buildbots.
llvm-svn: 194779
2013-11-15 03:26:28 +00:00
Dmitry Vyukov
2e7e5801a7
asan: disable pthread_setname_np interceptor
...
it does not work anyway and can cause significant slowdown
llvm-svn: 194711
2013-11-14 16:48:22 +00:00
Kostya Serebryany
c46f281f83
[asan] unbreak dfsan, which includes sanitizer/common_interface_defs.h into internal sources (although it shoudn't)
...
llvm-svn: 194704
2013-11-14 13:44:43 +00:00
Kostya Serebryany
599f0c1309
[asan] disable CovDump on Windows for now (fails to compile)
...
llvm-svn: 194703
2013-11-14 13:37:54 +00:00
Kostya Serebryany
91c52d9552
[asan] Poor man's coverage that works with ASan (compiler-rt part)
...
llvm-svn: 194702
2013-11-14 13:28:17 +00:00
Evgeniy Stepanov
5912fa4c4b
[msan] A test for r194697.
...
llvm-svn: 194699
2013-11-14 12:31:18 +00:00
Alexey Samsonov
164841036d
[UBSan] Make sure ASan and UBSan interact properly by running each test from UBSan test suite with and without ASan
...
llvm-svn: 194698
2013-11-14 12:30:09 +00:00
Alexey Samsonov
003c4bfc42
[ASan] Introduce a top-level target to collect all ASan runtimes and deps
...
llvm-svn: 194696
2013-11-14 12:24:12 +00:00
Alexey Samsonov
84dbdc0d8e
[UBSan] Update UBSan location rendering to match r194686
...
llvm-svn: 194687
2013-11-14 09:54:10 +00:00
Alexey Samsonov
4d369187ec
[Sanitizer] Print symbolized stack frame using a single Printf() call.
...
This reduces the number of "write" syscalls performed to print a single
stack frame description, and makes sanitizer output less intermixed with
program output. Also, add a number of unit tests.
llvm-svn: 194686
2013-11-14 09:41:24 +00:00
Alexey Samsonov
498e5906ad
[Sanitizer] Add print_summary runtime flag to disable error summaries (UBSan doesn't need them)
...
llvm-svn: 194685
2013-11-14 08:56:59 +00:00
Alexander Potapenko
0706e5dd36
[ASan] Remove the stale dependency on the Foundation framework from the dynamic ASan runtime.
...
llvm-svn: 194583
2013-11-13 15:52:39 +00:00
Alexey Samsonov
cf6ac12e23
[Sanitizer] Use same PC threshold in slow unwinder on all platforms
...
llvm-svn: 194580
2013-11-13 15:20:10 +00:00
Alexey Samsonov
9ff4598225
[ASan] Do not rely on malloc context in allocator reports.
...
Invoke a fatal stack trace unwinder when ASan prints allocator-relevant
error reports (double-free, alloc-dealloc-mismatch, invalid-free).
Thus we'll be able to print complete stack trace even if allocation/free
stacks are not stored (malloc_context_size=0).
Based on the patch by Yuri Gribov!
llvm-svn: 194579
2013-11-13 14:46:58 +00:00
Alexey Samsonov
41f7c404c9
[ASan] Use new feature of FileCheck: provide multiple --check-prefix args
...
llvm-svn: 194578
2013-11-13 14:16:40 +00:00
Alexander Potapenko
fa82ba91f9
[ASan] Don't call __asan_init() from certain interceptors on Darwin.
...
Fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58994 , which hadn't
manifested in LLVM because libclang_rt.asan_osx_dynamic.dylib used to depend on
the Foundation framework.
Without that dependency some interceptors may be called from the system
libraries before libSystem_initializer() is called, which lead to assertion
failures in sanitizer_mac.cc (_NSGetEnviron() returns NULL).
To fix the problem we fall back to the original functions in the common
libsanitizer interceptors and the __cxa_atexit() interceptor on Darwin.
This patch also prints a better error message in the case _NSGetEnviron()
returns NULL.
llvm-svn: 194573
2013-11-13 13:34:53 +00:00
Kostya Serebryany
04a1767a2e
[asan] fix a leak in tds ( https://code.google.com/p/address-sanitizer/issues/detail?id=233 )
...
llvm-svn: 194572
2013-11-13 13:27:44 +00:00
Yuchen Wu
61a1bfcd61
Added summary info to GCDAProfiling.
...
This function will be called by GCOVProfiling to write and update object
and program summaries to be read in by llvm-cov.
llvm-svn: 194499
2013-11-12 18:45:50 +00:00
Alexey Samsonov
6345150992
[Sanitizer] Specify a default value for each common runtime flag
...
llvm-svn: 194479
2013-11-12 13:59:08 +00:00
Evgeniy Stepanov
90e12a6cb2
[sanitizer] Avoid needless use of stringification (#symver) in INTERCEPT_FUNCTION_VER.
...
This is a workaround for clang-format bug (PR17874).
llvm-svn: 194468
2013-11-12 10:21:52 +00:00
Tim Northover
38a0cb5201
ARM: make assembly files compile Thumb2 with nop IT block.
...
ARM's UAL syntax allows the same assembly file to be compiled in both ARM and
Thumb mode. Conditional execution is handled by requiring the Thumb IT blocks,
but essentially ignoring them when compiling for ARM.
llvm-svn: 194429
2013-11-11 22:50:13 +00:00
Evgeniy Stepanov
5a29068b97
[msan] One more test for r194374.
...
llvm-svn: 194375
2013-11-11 13:38:24 +00:00
Evgeniy Stepanov
b69699eb58
[sanitizer] Warn if interception fails.
...
This includes a clang-format pass over common interceptors.
llvm-svn: 194372
2013-11-11 11:28:30 +00:00
Evgeniy Stepanov
bfdb9b2ec6
[msan] Sanity check for non-PIE.
...
llvm-svn: 194370
2013-11-11 09:27:20 +00:00
Evgeniy Stepanov
987f59b5c3
[asan] Bypass pthread_attr_getdetachstate interceptor in compiler_rt code.
...
llvm-svn: 194369
2013-11-11 08:56:49 +00:00
Timur Iskhodzhanov
e87f5701bb
Remove a FIXME now that I can't reproduce the problem
...
llvm-svn: 194331
2013-11-09 15:01:23 +00:00
Timur Iskhodzhanov
1f1c7ec400
[Sanitizers] Share some stack walking code between Windows and Linux
...
Reviewed at http://llvm-reviews.chandlerc.com/D2126
llvm-svn: 194326
2013-11-09 13:59:12 +00:00
Alexander Potapenko
49034e3c33
[ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
...
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib
The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.
The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.
llvm-svn: 194199
2013-11-07 10:08:19 +00:00
Alexey Samsonov
b3d939902a
[Sanitizer] Make StackTrace::Unwind the only public way to unwind a stack trace.
...
llvm-svn: 194196
2013-11-07 07:28:33 +00:00
Alexey Samsonov
5d350b2ab6
[Sanitizer] Presumable fix stack trace unwinding on Windows
...
llvm-svn: 194195
2013-11-07 06:53:41 +00:00
Alexey Samsonov
e13f775a63
[Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
...
llvm-svn: 194193
2013-11-07 06:33:06 +00:00
Kostya Serebryany
82d0679e92
[asan] attempting to fix x32 build (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59018 )
...
llvm-svn: 194155
2013-11-06 17:47:39 +00:00
Alexander Potapenko
10e316a68e
[ASan] Use OS-specific matches in the malloc_context_size.cc lit test.
...
The top stack frames for operator new and operator delete are different on Linux and Darwin.
llvm-svn: 194150
2013-11-06 14:00:37 +00:00
Alexey Samsonov
fead612a02
[ASan] Disable back init-order checker. Make strict_init_order imply check_initialization_order
...
llvm-svn: 194125
2013-11-06 04:27:09 +00:00
Alexey Samsonov
b0bad7b3b8
[ASan] Make sure slow stack unwinder doesn't return empty stacks.
...
llvm-svn: 194107
2013-11-05 23:29:12 +00:00
Evgeniy Stepanov
1c8c3fe4b4
[msan] Fix a very unfortunate typo in origin copying.
...
It was causing randomly missing origins.
llvm-svn: 194036
2013-11-05 01:24:38 +00:00
Bob Wilson
64b4abd07b
Push back various changes for building Apple's compiler-rt dylib.
...
These changes had accumulated internally at Apple for no good reason.
llvm-svn: 193944
2013-11-03 07:06:29 +00:00
Evgeniy Stepanov
a6b5eec757
[sanitizer] Intercept strptime.
...
llvm-svn: 193903
2013-11-02 01:01:35 +00:00
Evgeniy Stepanov
365bd0c88c
[msan] Intercept memccpy.
...
llvm-svn: 193897
2013-11-01 23:49:48 +00:00
Dmitry Vyukov
a131bff475
tsna: do not call user code from within runtime (from fflush)
...
llvm-svn: 193880
2013-11-01 19:15:32 +00:00
Alexey Samsonov
31d4c34433
[Sanitizer] Fix Go build
...
llvm-svn: 193873
2013-11-01 18:00:22 +00:00
Evgeniy Stepanov
7342857825
[sanitizer] Switch to an older version of struct iocb that is found in the latest Android NDK.
...
They are binary compatible, and we don't use any of the new fields anyway.
llvm-svn: 193870
2013-11-01 17:48:35 +00:00
Alexey Samsonov
c5e1b16d0c
[ASan] Kill use_stack_depot runtime flag and stack trace compression routines.
...
llvm-svn: 193868
2013-11-01 17:23:22 +00:00
Alexey Samsonov
5dc6cff06a
[Sanitizer] Unify summary reporting across all sanitizers.
...
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".
llvm-svn: 193864
2013-11-01 17:02:14 +00:00
Evgeniy Stepanov
170d70be68
[msan] Check that address is an app region before printing shadow.
...
llvm-svn: 193863
2013-11-01 15:53:25 +00:00
Evgeniy Stepanov
2335879ff1
[sanitizer] Enhance io_submti syscall handler.
...
llvm-svn: 193848
2013-11-01 01:20:39 +00:00
Alexey Samsonov
4708c5912b
Consistently use StackTrace::PrintStack in ASan, LSan and MSan
...
llvm-svn: 193834
2013-11-01 00:19:46 +00:00
Alexey Samsonov
627e2c0dd7
[Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.
...
Summary:
TSan and MSan need to know if interceptor was called by the
user code or by the symbolizer and use pre- and post-symbolization hooks
for that. Make Symbolizer class responsible for calling these hooks instead.
This would ensure the hooks are only called when necessary (during
in-process symbolization, they are not needed for out-of-process) and
save specific sanitizers from tracing all places in the code where symbolization
will be performed.
Reviewers: eugenis, dvyukov
Reviewed By: eugenis
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2067
llvm-svn: 193807
2013-10-31 21:44:07 +00:00
Alexander Potapenko
ac501f0250
[libsanitizer] Define SANITIZER_IOS when building for iOS or iOS simulator.
...
Do not use struct stat64 and struct statfs64 when building for iOS, where __DARWIN_ONLY_64_BIT_INO_T is set to 1.
llvm-svn: 193775
2013-10-31 17:38:18 +00:00
Evgeniy Stepanov
13322c6eda
[msan] Intercept dlerror.
...
llvm-svn: 193760
2013-10-31 16:58:44 +00:00
Alexander Potapenko
d29853564d
[ASan] Make asan_symbolize.py fall back to ASAN_SYMBOLIZER_PATH (which is used when ASAN_OPTIONS=symbolize=1) if LLVM_SYMBOLIZER_PATH is empty.
...
llvm-svn: 193758
2013-10-31 16:08:09 +00:00
Evgeniy Stepanov
a7add488ae
[msan] Disable mlock/mlockall to work around a linux kernel bug.
...
The same logic is present in ASan and TSan.
llvm-svn: 193755
2013-10-31 15:51:22 +00:00
Evgeniy Stepanov
1cb37c4ee5
[sanitizer] Intercept getline, getdelim.
...
llvm-svn: 193730
2013-10-31 01:17:41 +00:00
Alexey Samsonov
85cee41633
[ASan] Turn on (non-strict) initialization order checker by default for all ASan users
...
llvm-svn: 193729
2013-10-31 00:40:15 +00:00
Evgeniy Stepanov
82509b6675
[msandr] Add check-before-write optimization.
...
Replace blind store with check-before-store to avoid unnecessary memory stores.
Patch by Qin Zhao.
llvm-svn: 193703
2013-10-30 17:44:22 +00:00
Alexey Samsonov
3c845b6f1b
[Sanitizer] Update comment in sanitizer_symbolizer.h
...
llvm-svn: 193700
2013-10-30 17:17:35 +00:00
Alexey Samsonov
78928c1d2a
[Sanitizer] Use SpinMutex for Symbolizer initialization (per dvyukov's suggestion)
...
llvm-svn: 193697
2013-10-30 17:05:37 +00:00
Evgeniy Stepanov
60db142d86
[asan] Fix syscall hooks build on Android.
...
llvm-svn: 193670
2013-10-30 00:58:17 +00:00
Evgeniy Stepanov
cbe83ea141
[santiizer] Disable sincos interceptor in OSX.
...
llvm-svn: 193667
2013-10-30 00:32:50 +00:00
Evgeniy Stepanov
0bd1f00ec6
[sanitizer] Intercept drand48_r, lrand48_r.
...
llvm-svn: 193655
2013-10-29 22:25:27 +00:00
Evgeniy Stepanov
867dd7488a
[msandr] Remove use of std::set in msandr client to avoid reentrancy issues.
...
Patch by Qin Zhao.
llvm-svn: 193654
2013-10-29 22:19:25 +00:00
Evgeniy Stepanov
e8cd2fad0e
[asan] Maybe fix test failures on lld bots.
...
llvm-svn: 193647
2013-10-29 20:06:12 +00:00
Evgeniy Stepanov
bf60342d47
[sanitizer] Intercept sincos, remquo, lgamma, lgamma_r.
...
llvm-svn: 193645
2013-10-29 19:49:35 +00:00
Evgeniy Stepanov
ae2f76fb78
[msandr] Add support for standalone test.
...
Add macro MSANDR_STANDALONE_TEST for standalone test without msan executables.
Patch by Qin Zhao.
llvm-svn: 193643
2013-10-29 19:44:47 +00:00
Evgeniy Stepanov
596d108feb
[tsan] Fix unused variable warnings.
...
llvm-svn: 193639
2013-10-29 18:44:52 +00:00
Evgeniy Stepanov
7d24620b6d
[asan] Fix build.
...
llvm-svn: 193635
2013-10-29 18:29:39 +00:00
Evgeniy Stepanov
02839ced75
[sanitizer] Fix build warnings.
...
llvm-svn: 193634
2013-10-29 18:24:06 +00:00
Evgeniy Stepanov
477f8b73a5
[sanitizer] Ptrace syscall handler.
...
llvm-svn: 193633
2013-10-29 17:59:45 +00:00
Kostya Serebryany
2a9b70cb4c
[asan] increase the max malloc size from 8Gb to 64Gb
...
llvm-svn: 193615
2013-10-29 15:16:54 +00:00
Dmitry Vyukov
3e8432ee6c
tsan/asan: support pthread_setname_np to set thread names
...
llvm-svn: 193602
2013-10-29 10:30:39 +00:00
Alexey Samsonov
a687d2593f
[Sanitizer] Simplify StackTrace::PrintStack interface: prefer common flags to turn on/off the symbolization
...
llvm-svn: 193587
2013-10-29 05:31:25 +00:00
Evgeniy Stepanov
451c8de2d8
[msan] Intercept shmat.
...
llvm-svn: 193581
2013-10-29 02:48:49 +00:00
Evgeniy Stepanov
d828208713
[msan] Fix a typo and enable poison_in_free flag.
...
llvm-svn: 193529
2013-10-28 18:53:37 +00:00
Alexey Samsonov
590fe110f9
[Sanitizer] Revert r193501 and properly fix r193448
...
llvm-svn: 193522
2013-10-28 16:31:39 +00:00
Dmitry Vyukov
cf7259c094
asan/msan: separate different report blocks with new lines
...
this makes the reports consistent with tsan, and much more readable.
llvm-svn: 193520
2013-10-28 13:05:32 +00:00
Dmitry Vyukov
33dd200ba9
tsan: start the background thread with signals blocked, otherwise it can steal users signals
...
llvm-svn: 193519
2013-10-28 12:29:32 +00:00
Timur Iskhodzhanov
a1d048acb7
Work around ASan/Win breakage by r193448
...
llvm-svn: 193501
2013-10-27 13:37:23 +00:00
Alexey Samsonov
4cc939e6a6
[Sanitizer] Add pthread_attr_getaffinity_np to the list of versioned functions
...
llvm-svn: 193470
2013-10-26 12:54:03 +00:00
Peter Collingbourne
cbdea323ac
Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D1984
llvm-svn: 193449
2013-10-25 23:03:34 +00:00
Peter Collingbourne
791e65dcfb
Overhaul the symbolizer interface.
...
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps. Those steps now always take place
together.
Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer. Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.
The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.
Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.
Differential Revision: http://llvm-reviews.chandlerc.com/D1985
llvm-svn: 193448
2013-10-25 23:03:29 +00:00
Peter Collingbourne
8d27910d7d
Rename SpinMutex::AssertHeld to CheckLocked, for consistency with BlockingMutex.
...
llvm-svn: 193447
2013-10-25 23:03:21 +00:00
Evgeniy Stepanov
c0fdb3941c
[sanitizer] Disable tmpnam_r interceptor on Mac.
...
llvm-svn: 193417
2013-10-25 16:22:50 +00:00
Evgeniy Stepanov
94042e1ff2
[sanitizer] Intercept tmpnam, tmpnam_r, tempnam.
...
llvm-svn: 193415
2013-10-25 15:51:48 +00:00
Evgeniy Stepanov
a59daaef3e
[msandr] Add NATIVE_EXEC macro for building client for running in DynamoRIO hybrid mode only.
...
When running application in DynamoRIO hybrid mode only, only uninstrumented
modules will run in DynamoRIO and be instrumented by the client, so we do not
need module table in MSanDR.
Patch by Qin Zhao.
llvm-svn: 193411
2013-10-25 14:57:02 +00:00
Evgeniy Stepanov
2acb2470f9
[sanitizer] Remove pthread_attr_getstackaddr interceptor.
...
The function is deprecated.
llvm-svn: 193409
2013-10-25 14:27:00 +00:00
Evgeniy Stepanov
7f42c6e007
[sanitizer] Fix Android build.
...
llvm-svn: 193408
2013-10-25 14:24:31 +00:00
Evgeniy Stepanov
07507ffab4
[msan] Zerofill initstate_r buffer in random_r test.
...
llvm-svn: 193406
2013-10-25 13:03:20 +00:00
Evgeniy Stepanov
c2b6cb0747
[sanitizer] Intercept pthread_attr_get*.
...
llvm-svn: 193405
2013-10-25 13:01:31 +00:00
Evgeniy Stepanov
ced9fede02
[msan] Separate access and origin blocks in msan reports with an extra whiteline.
...
llvm-svn: 193401
2013-10-25 11:17:54 +00:00
Dmitry Vyukov
53491113f0
tsan: do not crash when apparently bogus fd is passed to e.g. close
...
some tests test libc/filesystem error handling paths (e.g. close(INT_MAX)),
currently such tests fail
with this change they work as expected
llvm-svn: 193400
2013-10-25 09:45:44 +00:00
Evgeniy Stepanov
be9cdbb58c
[sanitizer] Intercept random_r.
...
llvm-svn: 193396
2013-10-25 08:58:13 +00:00
Stephen Hines
7633afc960
Switch __ARM_ARCH_7S__ to __ARM_ARCH_EXT_IDIV__ for use of sdiv/udiv assembly.
...
__ARM_ARCH_EXT_IDIV__ is the define that ARM is using to indicate the presence
of hardware integer divide (sdiv/udiv). Previously, this code was only being
invoked for processors marked 7S. We now can correctly generate hardware
divides on cortex-a15 devices.
llvm-svn: 193392
2013-10-25 06:26:44 +00:00
Evgeniy Stepanov
f312b480e2
[sanitizer] Intercept shmctl.
...
llvm-svn: 193348
2013-10-24 14:47:34 +00:00
Evgeniy Stepanov
7edb87a92c
[msan] Unpoison errno in common interceptors.
...
llvm-svn: 193343
2013-10-24 13:20:34 +00:00
Evgeniy Stepanov
d280ee48e8
[msan] Fix invalid origin copying.
...
Origin copying may destroy valid origin info. This is caused by
__msan_copy_origin widening the address range to the nearest 4-byte aligned
addresses both on the left and on the right. If the target buffer is
uninitialized and the source is fully initialized, this will result in
overriding valid origin of target buffer with stale (possibly 0) origin of the
source buffer.
With this change the widened origin is copied only if corresponding shadow
values are non zero.
llvm-svn: 193338
2013-10-24 11:56:03 +00:00
Evgeniy Stepanov
f2fd459a5b
[msan] Change wording in the invalid origin message.
...
llvm-svn: 193335
2013-10-24 11:52:48 +00:00
Peter Collingbourne
50cb32e614
Introduce an operator new for LowLevelAllocator, and convert most users to it.
...
llvm-svn: 193308
2013-10-24 06:23:39 +00:00
Alexey Samsonov
857e3ece9b
[ASan] ASan can be combined with LSan and UBSan, so export symbol from them as well.
...
llvm-svn: 193245
2013-10-23 15:36:22 +00:00
Evgeniy Stepanov
55a3ba2281
[sanitizer] Fix OSX build.
...
llvm-svn: 193244
2013-10-23 15:21:10 +00:00
Evgeniy Stepanov
3e6064f9d2
[sanitizer] Intercept ether_* functions.
...
llvm-svn: 193241
2013-10-23 13:57:47 +00:00
Dmitry Vyukov
1ec0fd4071
tsan: parse symbolize/external_symbolizer_path common flags
...
llvm-svn: 193236
2013-10-23 09:00:49 +00:00
Dmitry Vyukov
2346c7a511
tsan: fix linux syscall hooks
...
the file references non-existent arguments and breaks build
llvm-svn: 193234
2013-10-23 08:40:19 +00:00
Nick Lewycky
993f1f38fd
Continue to keep 'SUMMARY: ' prefix in lsan. Whoops!
...
llvm-svn: 193232
2013-10-23 07:58:11 +00:00
Nick Lewycky
622348e693
Hoist the addition of the prefix "SUMMARY: " from
...
__sanitizer_report_error_summary to ReportErrorSummary.
llvm-svn: 193231
2013-10-23 07:45:53 +00:00
Nick Lewycky
d27d668342
Make sure ASan always emits an error summary if it reports an error.
...
llvm-svn: 193229
2013-10-23 06:19:04 +00:00
Evgeniy Stepanov
2794c47243
[msan] Drain allocator cache when leaving thread.
...
llvm-svn: 193163
2013-10-22 14:31:30 +00:00
Evgeniy Stepanov
0229c09d43
[sanitizer] Intercept initgroups.
...
llvm-svn: 193158
2013-10-22 12:24:48 +00:00
Sergey Matveev
fd10073aeb
[lsan] When detect_leaks=false, be completely silent.
...
In particular, don't make a fuss if we're passed a malformed suppressions file,
or if we have trouble identifying ld.so. Also, make LSan interface functions
no-ops in this case.
llvm-svn: 193108
2013-10-21 19:35:00 +00:00
Peter Collingbourne
b745eec4e4
Use internal_memset to initialize this variable.
...
Otherwise, the compiler may use memset in non-optimized builds, which is
forbidden in the nolibc part of the runtime.
llvm-svn: 193098
2013-10-21 18:11:57 +00:00
Kostya Serebryany
b773785a59
[asan] count the size of QuarantineBatch in the total Quarantine size; make QuarantineBatch fit into 8K, fix a MSVC compile warning
...
llvm-svn: 193072
2013-10-21 08:36:10 +00:00
Dmitry Vyukov
1e995d4f3e
tsan: fix strerror interceptor (eliminate false positives)
...
llvm-svn: 193070
2013-10-21 07:40:19 +00:00
Peter Collingbourne
90a0876ae7
Runtime support for the indirect function call checker.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D1339
llvm-svn: 193060
2013-10-20 21:29:46 +00:00
Peter Collingbourne
b714e7e12a
[ubsan] Introduce %clangxx substitution for all C++ tests.
...
llvm-svn: 193059
2013-10-20 21:29:32 +00:00
Kostya Serebryany
8bb5d60235
[asan] fix stack trace printing on Mac
...
llvm-svn: 192990
2013-10-18 17:46:43 +00:00
Kostya Serebryany
f11e485d60
[asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space
...
llvm-svn: 192980
2013-10-18 15:07:07 +00:00
Kostya Serebryany
9628839869
[asan] reduce the size of AsanThreadContext by storing the stack trace in the stack depot
...
llvm-svn: 192979
2013-10-18 14:50:44 +00:00
Alexander Potapenko
e45ca59fd9
[ASan] fix compilation of sanitizer_platform_limits_posix.cc on OSX.
...
llvm-svn: 192975
2013-10-18 14:16:54 +00:00
Alexander Potapenko
2fe16d720c
[ASan] fix compilation of atexit_stats.cc on OSX
...
llvm-svn: 192973
2013-10-18 14:12:15 +00:00
Evgeniy Stepanov
78c5730bec
[sanitizer] Fix OSX build some more.
...
llvm-svn: 192967
2013-10-18 12:19:23 +00:00
Evgeniy Stepanov
b4e501c6ec
[sanitizer] Fix OSX build.
...
llvm-svn: 192966
2013-10-18 11:26:02 +00:00
Evgeniy Stepanov
3cb9df042e
[sanitizer] Move statfs/fstatfs to common interceptors and add statvfs/fstatvfs.
...
llvm-svn: 192965
2013-10-18 11:14:16 +00:00
Kostya Serebryany
e2007b706e
[asan] fix a test on Mac
...
llvm-svn: 192960
2013-10-18 09:42:24 +00:00
Evgeniy Stepanov
70d5abfba2
[sanitizer] Intercept getmntent, getmntent_r.
...
llvm-svn: 192959
2013-10-18 09:41:43 +00:00
Kostya Serebryany
4bf67d99f4
[asan] fix atexit stats
...
llvm-svn: 192956
2013-10-18 07:57:59 +00:00
Richard Smith
c1d5471291
Make the big array in the UBSan C++ runtime be zero-initialized to dramatically
...
shrink the binary size of the ubsan runtime.
Also fix a bug where long-running processes could eventually trigger a crash in
the runtime by filling up the cache. I've not found a nice way to add a test for
this crasher; ideas welcome.
llvm-svn: 192931
2013-10-17 22:51:04 +00:00
Alexander Potapenko
1f5573cca2
[ASan] fix assign_large_valloc_to_global.cc to use the correct header for valloc() on OSX.
...
llvm-svn: 192901
2013-10-17 15:48:24 +00:00
Kostya Serebryany
8e2881d0c2
[asan] fix a failure with ASAN_OPTIONS=verbosity=1:use_sigaltstack=1
...
llvm-svn: 192892
2013-10-17 13:18:21 +00:00
Evgeniy Stepanov
4bbf273173
[sanitizer] Fix unpoisoning of msghdr::msg_name in recvmsg interceptor.
...
llvm-svn: 192886
2013-10-17 11:32:30 +00:00
Kostya Serebryany
f04ae33106
[asan] Fix a deadlock between asan's allocator and lsan
...
Summary:
This fixes a deadlock which happens in lsan
on a large memalign-allocated chunk that resides in lsan's root set.
Reviewers: samsonov, earthdok
Reviewed By: earthdok
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1957
llvm-svn: 192885
2013-10-17 11:18:11 +00:00
Alexey Samsonov
bc7c87a8cb
[Sanitizer] Move pthread_cond_signal and pthread_cond_broadcast to common interceptors
...
llvm-svn: 192876
2013-10-17 09:24:03 +00:00
Dmitry Vyukov
333112a439
tsan: merge 2 similar tests into 1
...
llvm-svn: 192874
2013-10-17 08:27:24 +00:00
Dmitry Vyukov
e88dbe5774
tsan: add a test for __tsan_default_options()
...
llvm-svn: 192873
2013-10-17 08:13:38 +00:00
Will Dietz
ece9ede240
Use configured PYTHON in asan lit tests.
...
llvm-svn: 192870
2013-10-17 05:33:22 +00:00
Dmitry Vyukov
cdc971c03c
tsan: revert variable name change in test
...
It works as is with new llvm-symbolizer.
llvm-svn: 192798
2013-10-16 15:57:23 +00:00
Dmitry Vyukov
464ebbd67b
tsan: move shadow stack from thread descriptors to fixed addresses
...
This allows to increase max shadow stack size to 64K,
and reliably catch shadow stack overflows instead of silently
corrupting memory.
llvm-svn: 192797
2013-10-16 15:35:12 +00:00
Kostya Serebryany
442c4e4b1a
[asan] introduce run-time flag 'poison_partial'
...
llvm-svn: 192793
2013-10-16 13:49:01 +00:00
Alexey Samsonov
fa103da867
[Sanitizer] Fix lint checker script on Mac
...
llvm-svn: 192791
2013-10-16 13:38:23 +00:00
Dmitry Vyukov
d8f595edf1
tsan: refactor libignore implementation
...
llvm-svn: 192785
2013-10-16 11:28:12 +00:00
Alexey Samsonov
1fe87e031c
[TSan] Extend test for reporting globals with races on them
...
llvm-svn: 192782
2013-10-16 09:56:17 +00:00
Evgeniy Stepanov
ec8ec333f0
[asan] Remove CallocOverflow32 test from asan_test.
...
The same as with MSan, this test behavior depends on ASAN_OPTIONS, and we've
got a lit_test that covers this.
llvm-svn: 192777
2013-10-16 08:34:31 +00:00
Evgeniy Stepanov
8df08225e5
[msan] Handle origins in __sanitizer_unaligned_(load|store)*.
...
llvm-svn: 192776
2013-10-16 08:25:13 +00:00
Alexey Samsonov
edecc38395
Make some pthread_mutex_* and pthread_cond_* interceptors common.
...
Reviewers: eugenis, dvyukov
Reviewed By: dvyukov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1937
llvm-svn: 192774
2013-10-16 08:20:31 +00:00
Sergey Matveev
27ef175ef0
[lsan] Fix bug when discovering indirectly leaked objects.
...
If an object contains pointers to itself, that doesn't make it indirectly
leaked. D'oh!
llvm-svn: 192716
2013-10-15 16:00:11 +00:00
Dmitry Vyukov
81f76f6ff7
tsan: introduce __tsan_default_options() function
...
The function allows to statically setup default values for flags.
The interafece matches what asan/msan provide.
llvm-svn: 192715
2013-10-15 15:58:11 +00:00
Dmitry Vyukov
21e99319f4
tsan: be silent if verbosity=0
...
Currently tests fail with:
Check failed: 'AAA' == 'AAA ==26017==Could not detach from thread 361395 (errno 3).'
llvm-svn: 192711
2013-10-15 15:35:56 +00:00
Dmitry Vyukov
67a1eef05b
tsan: remove __sanitizer_set_report_fd function from public interface
...
__sanitizer_set_report_path now accepts two special values - stderr and stdout
logging to other file descriptors is not supported anymore,
it's fragile in presence of multiple processes, fork, etc
llvm-svn: 192706
2013-10-15 14:14:34 +00:00
Dmitry Vyukov
7502a3a90c
tsan: use verbosity flag in sanitizer_common code directly
...
now it's available from common_flags()
llvm-svn: 192705
2013-10-15 14:12:26 +00:00
Dmitry Vyukov
45baa00dcb
tsan: actually parse verbofity flag
...
llvm-svn: 192704
2013-10-15 14:00:28 +00:00
Dmitry Vyukov
52ca74ec61
tsan: move verbosity flag to CommonFlags
...
llvm-svn: 192701
2013-10-15 13:28:51 +00:00
Dmitry Vyukov
a55db0a90f
tsan: do not leave trash source files in source dir
...
llvm-svn: 192700
2013-10-15 13:23:29 +00:00
Dmitry Vyukov
347f1a5ee0
tsan: refactor overly-complex logical condition
...
llvm-svn: 192698
2013-10-15 13:04:42 +00:00
Dmitry Vyukov
a72f6a57e9
tsan: fix Go build
...
llvm-svn: 192696
2013-10-15 13:03:06 +00:00
Dmitry Vyukov
f54835f768
tsan: move kernel struct definition from sanitizer_linux.h to sanitizer_platform_limits_posix.h
...
llvm-svn: 192695
2013-10-15 12:57:59 +00:00
Dmitry Vyukov
d534fff6af
tsan: do not build llvm from scratch on each presubmit
...
llvm-svn: 192694
2013-10-15 12:54:50 +00:00
Dmitry Vyukov
7ac0b2b0e1
tsan: use sanitizer::CommonFlags in tsan
...
llvm-svn: 192692
2013-10-15 12:25:29 +00:00
Evgeniy Stepanov
7a2bbc30a2
[msan] Remove CallocOverflow test.
...
This behaviour depends on MSAN_OPTIONS.
All interesting combinations are covered by lit_tests/allocator_returns_null.cc.
llvm-svn: 192691
2013-10-15 12:20:16 +00:00
Sergey Matveev
14b9924c7b
Clean up StopTheWorld code after r192686.
...
Remove outdated comments. Also remove code that handled an issue in libc's
sigaction(), which we don't use anymore.
llvm-svn: 192689
2013-10-15 11:54:38 +00:00
Dmitry Vyukov
6f61206f55
tsan: resolve symlinks for called_from_lib suppressions
...
llvm-svn: 192688
2013-10-15 11:34:59 +00:00
Evgeniy Stepanov
113c646c56
[msan] Implement allocator_may_return_null=1 in MemorySanitizer.
...
llvm-svn: 192687
2013-10-15 11:33:48 +00:00
Dmitry Vyukov
59c850de6d
tsan: implement internal syscall-based versions of sigaction/sigprocmask
...
use them in stoptheworld
fixes applications that intercept sigaction/sigprocmask
llvm-svn: 192686
2013-10-15 11:31:51 +00:00
Evgeniy Stepanov
3feb458a56
Fix a typo.
...
llvm-svn: 192685
2013-10-15 11:22:33 +00:00
Alexey Samsonov
d2ddcf575d
[ASan] Make test from r192581 Linux-only, as wild memory contents is less predictable on Mac
...
llvm-svn: 192677
2013-10-15 07:54:27 +00:00
Evgeniy Stepanov
251d1e5d21
[msan] Test for r192599.
...
llvm-svn: 192600
2013-10-14 15:17:05 +00:00
Sergey Matveev
43d90cbd86
[lsan] Support ASan's stack-use-after-return mode in LSan.
...
Treat the fake stack as live memory.
llvm-svn: 192593
2013-10-14 14:04:50 +00:00
Evgeniy Stepanov
7d7768e032
[msan] Remove a long-outdated comment.
...
llvm-svn: 192592
2013-10-14 13:30:40 +00:00
Sergey Matveev
da9f5e7e7f
[asan] Improve thread lifetime tracking on POSIX systems.
...
Call AsanThread::Destroy() from a late-running TSD destructor.
Previously we called it before any user-registered TSD destructors, which caused
false positives in LeakSanitizer.
llvm-svn: 192585
2013-10-14 12:01:05 +00:00
Evgeniy Stepanov
7aacd9c172
[msan] Intercept strto(d|f|ld)_l and glibc-specific __strto(d|f|ld)_l.
...
llvm-svn: 192583
2013-10-14 11:52:40 +00:00
Alexey Samsonov
df6e6569c0
[ASan] Don't die with internal ASan error on large buffer overflows
...
Summary:
Out-of-bound access may touch not-yet allocated or already freed
and recycled from quarantine chunks. We should treat this situation as
a "free-range memory access" and avoid printing any data about that
irrelevant chunk (which may be inconsistent).
This should fix https://code.google.com/p/address-sanitizer/issues/detail?id=183
Reviewers: kcc
Reviewed By: kcc
CC: timurrrr, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1893
llvm-svn: 192581
2013-10-14 11:13:54 +00:00
Evgeniy Stepanov
054d533d8d
[msan] Regression test for r192575.
...
llvm-svn: 192577
2013-10-14 09:53:39 +00:00
Dmitry Vyukov
4314e319ab
tsan: allow to override OnPrint() callback in Go runtime
...
llvm-svn: 192576
2013-10-14 09:52:40 +00:00
Alexey Samsonov
c7ae7529e7
[Sanitizer] Return implementation of StackTrace::CopyFrom to header
...
llvm-svn: 192574
2013-10-14 07:36:10 +00:00
Dmitry Vyukov
abc416f326
tsan: allow to override OnFinalize() in front-ends that does not support weak functions (Go)
...
llvm-svn: 192569
2013-10-14 06:31:03 +00:00
Alexey Samsonov
7f5823844a
[Sanitizer] Remove StackTrace::max_depth field
...
llvm-svn: 192534
2013-10-12 12:40:47 +00:00
Alexey Samsonov
c129e65661
[Sanitizer] Turn GetStackTrace() into StackTrace::Unwind()
...
llvm-svn: 192533
2013-10-12 12:23:00 +00:00
Sergey Matveev
53e61b1acf
[sanitizer] Define kPthreadDestructorIterations on POSIX systems.
...
llvm-svn: 192453
2013-10-11 14:19:14 +00:00
Dmitry Vyukov
6dc0775f1f
tsan: catch more races on file descriptors
...
llvm-svn: 192452
2013-10-11 14:13:11 +00:00
Dmitry Vyukov
c9f9ada48d
tsan: fix epoll_ctl interceptor
...
Currently data-race-test unittests fail with the following false positive:
WARNING: ThreadSanitizer: data race (pid=20365)
Write of size 8 at 0x7da000008050 by thread T54:
#0 close tsan_interceptors.cc:1483 (racecheck_unittest-linux-amd64-O0+0x0000000eb34a)
#1 NegativeTests_epoll::Worker2() unittest/posix_tests.cc:1148 (racecheck_unittest-linux-amd64-O0+0x0000000cc6b1)
#2 MyThread::ThreadBody(MyThread*) unittest/./thread_wrappers_pthread.h:367 (racecheck_unittest-linux-amd64-O0+0x000000097500)
Previous read of size 8 at 0x7da000008050 by thread T49:
#0 epoll_ctl tsan_interceptors.cc:1646 (racecheck_unittest-linux-amd64-O0+0x0000000e9fee)
#1 NegativeTests_epoll::Worker1() unittest/posix_tests.cc:1140 (racecheck_unittest-linux-amd64-O0+0x0000000cc5b5)
#2 MyThread::ThreadBody(MyThread*) unittest/./thread_wrappers_pthread.h:367 (racecheck_unittest-linux-amd64-O0+0x000000097500)
llvm-svn: 192448
2013-10-11 13:33:22 +00:00
Sergey Matveev
6c5e943953
[sanitizer] Ninja style fix to r192442.
...
llvm-svn: 192443
2013-10-11 12:15:45 +00:00
Sergey Matveev
dc75cf3368
[sanitizer] Move the PTHREAD_DESTRUCTOR_ITERATIONS constant to sanitizer_linux.h.
...
Add a test.
llvm-svn: 192442
2013-10-11 12:09:49 +00:00
Alexey Samsonov
0cd96165f1
[Sanitizer] StackTrace: kill CopyTo and reimplement CopyFrom
...
llvm-svn: 192441
2013-10-11 11:14:20 +00:00
Alexey Samsonov
9d8385453b
[Sanitizer] Simplify StackTrace::FastUnwindStack interface and fix a bug with one-frame stack traces
...
llvm-svn: 192428
2013-10-11 09:58:30 +00:00
Dmitry Vyukov
3431b38067
tsan: minor refactoring
...
Replace duplicate code snippet with function.
llvm-svn: 192357
2013-10-10 16:03:24 +00:00
Dmitry Vyukov
fbb194ff34
tsan: add annotations to ignore synchronization operations
...
The annotations are AnnotateIgnoreSyncBegin/End,
may be useful to ignore some infrastructure synchronization
that introduces lots of false negatives.
llvm-svn: 192355
2013-10-10 15:58:12 +00:00
Sergey Matveev
6f7fb43ad3
[sanitizer] Fix the parent liveness check in StopTheWorld.
...
Comparing the parent PID with 1 isn't sufficient to ensure the parent is alive,
because of prctl(PR_SET_CHILD_SUBREAPER, ...). Compare with the real parent's
recorded PID instead.
llvm-svn: 192295
2013-10-09 13:36:20 +00:00
Sergey Matveev
adef754297
[sanitizer] Fix deadlock in StopTheWorld.
...
The tracer thread in StopTheWorld could wait on a mutex forever if the parent
process died before unlocking it. Use PR_SET_PDEATHSIG so that the parent would
kill the child in this scenario.
llvm-svn: 192210
2013-10-08 18:01:03 +00:00
Sergey Matveev
398fb700a2
[sanitizer] Do not break the CFI unwind chain in clone().
...
Fixes build on clang 3.2, which doesn't support cfi_undefined. This change
doesn't seem to break the slow unwinder. Even if it does, the worst thing that
could happen is that we would not see a backtrace when a fatal error happens
under StopTheWorld.
llvm-svn: 192196
2013-10-08 16:38:39 +00:00
Alexey Samsonov
50ec07c196
[TSan] Automatically pick up llvm-symbolizer from PATH, as we do in another sanitizers
...
llvm-svn: 191954
2013-10-04 13:38:35 +00:00
Alexey Samsonov
12f5e639d6
[TSan] Add ValgrindSlowdown to the list of exported symbols
...
llvm-svn: 191952
2013-10-04 13:12:05 +00:00
Dmitry Vyukov
513a3a6c0b
tsan: fix a bug in pthread_once when called from an ignored library
...
It must set thr->in_rtl = 0 before executing user callback.
llvm-svn: 191946
2013-10-04 10:27:21 +00:00
Alexey Samsonov
f2b811a618
Refactor the usage of strip_path_prefix option and make it more consistent across sanitizers
...
llvm-svn: 191943
2013-10-04 08:55:03 +00:00
Dmitry Vyukov
302ec7b9bc
tsan: add memory_limit_mb flag
...
The flag allows to bound maximum process memory consumption (best effort).
If RSS reaches memory_limit_mb, tsan flushes all shadow memory.
llvm-svn: 191913
2013-10-03 17:14:35 +00:00
Dmitry Vyukov
c967d2f49c
asan/msan/tsan: fix broken linux syscalls
...
Currently the following source code:
u64 NanoTime() {
kernel_timeval tv = {};
internal_syscall(__NR_gettimeofday, &tv, 0);
return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;
}
generates the following assembly:
Dump of assembler code for function __sanitizer::NanoTime():
=> 0x00007ff30657d380 <+0>: lea -0x10(%rsp),%rdi
0x00007ff30657d385 <+5>: xor %esi,%esi
0x00007ff30657d387 <+7>: mov $0x60,%eax
0x00007ff30657d38c <+12>: syscall
0x00007ff30657d38e <+14>: mov $0,%eax
0x00007ff30657d393 <+19>: retq
with this change:
Dump of assembler code for function __sanitizer::NanoTime():
=> 0x00007faab834f380 <+0>: movq $0x0,-0x10(%rsp)
0x00007faab834f389 <+9>: movq $0x0,-0x8(%rsp)
0x00007faab834f392 <+18>: lea -0x10(%rsp),%rdi
0x00007faab834f397 <+23>: xor %esi,%esi
0x00007faab834f399 <+25>: mov $0x60,%eax
0x00007faab834f39e <+30>: syscall
0x00007faab834f3a0 <+32>: mov -0x8(%rsp),%rax
0x00007faab834f3a5 <+37>: mov -0x10(%rsp),%rcx
0x00007faab834f3aa <+42>: imul $0x3e8,%rax,%rdx
0x00007faab834f3b1 <+49>: imul $0x3b9aca00,%rcx,%rax
0x00007faab834f3b8 <+56>: add %rdx,%rax
0x00007faab834f3bb <+59>: retq
llvm-svn: 191908
2013-10-03 16:53:50 +00:00
Dmitry Vyukov
19a1302046
asan/msan: fix "unused function 'OnExit'" warning
...
llvm-svn: 191904
2013-10-03 15:43:59 +00:00
Dmitry Vyukov
fdfb2ade8f
asan/msan/tsan: move _exit interceptor to common interceptors
...
llvm-svn: 191903
2013-10-03 15:22:29 +00:00
Dmitry Vyukov
bfe7bb7034
tsan: include lsan into presubmit check
...
llvm-svn: 191902
2013-10-03 14:56:08 +00:00
Dmitry Vyukov
83ebd022d7
tsan: fix false positive in localtime()
...
llvm-svn: 191899
2013-10-03 14:12:09 +00:00
Dmitry Vyukov
e07dc7d1fe
tsan: intercept _exit so that we can override exit status
...
llvm-svn: 191898
2013-10-03 14:00:46 +00:00
Dmitry Vyukov
5ba736457c
tsan: ignore interceptors coming from specified libraries
...
LibIgnore allows to ignore all interceptors called from a particular set
of dynamic libraries. LibIgnore remembers all "called_from_lib" suppressions
from the provided SuppressionContext; finds code ranges for the libraries;
and checks whether the provided PC value belongs to the code ranges.
Also make malloc and friends interceptors use SCOPED_INTERCEPTOR_RAW instead of
SCOPED_TSAN_INTERCEPTOR, because if they are called from an ignored lib,
then must call our internal allocator instead of libc malloc.
llvm-svn: 191897
2013-10-03 13:37:17 +00:00
Evgeniy Stepanov
364f70c728
[asan] Don't require X86 to build Android runtime.
...
Patch by Greg Fitzgerald.
llvm-svn: 191883
2013-10-03 08:31:14 +00:00
Evgeniy Stepanov
c907a60ffb
[sanitizer] Fix localtime and gmtime interceptors to clean tm->tm_zone.
...
llvm-svn: 191827
2013-10-02 14:30:03 +00:00
Dmitry Vyukov
945397157b
tsan: fix the following compiler warning
...
sanitizer_common_interceptors.inc:1142:53: warning: invoking macro INTERCEPTOR argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]
llvm-svn: 191822
2013-10-02 14:04:23 +00:00
Dmitry Vyukov
af335eddfe
msan: fix compiler warnings about unused variables
...
llvm-svn: 191821
2013-10-02 14:02:08 +00:00
Dmitry Vyukov
8358c41477
tsan: use ninja instead of make (faster and less output)
...
llvm-svn: 191819
2013-10-02 12:57:43 +00:00