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
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
Nick Lewycky
f60d8ae155
This fixme is resolved, fix the test.
...
llvm-svn: 191810
2013-10-02 05:05:28 +00:00
Nick Lewycky
b7aa592c19
Make the InvalidValueData take a SourceLocation.
...
llvm-svn: 191807
2013-10-02 02:29:47 +00:00
Alexey Samsonov
3b54a83d26
[LSan] Rework r191522 - treat allocations with short stack traces as live
...
llvm-svn: 191662
2013-09-30 10:57:56 +00:00
Alexey Samsonov
f56ddf7fd1
[LSan] Don't report leaks with single-frame stack traces
...
llvm-svn: 191522
2013-09-27 13:54:20 +00:00
Evgeniy Stepanov
01781722b6
[sanitizer] Intercept backtrace, backtrace_symbols.
...
llvm-svn: 191516
2013-09-27 12:40:23 +00:00
Kostya Serebryany
3c42ce1516
[asan] introduce run-time flag uar_stack_size_log to control the size of FakeStack; don't crash when the fake stack is exhausted, move some code to .cc file
...
llvm-svn: 191510
2013-09-27 11:37:23 +00:00
Evgeniy Stepanov
022235cf04
[msan] Unpoison argument shadow for C++ module destructors.
...
Fixes PR17377.
llvm-svn: 191508
2013-09-27 11:32:21 +00:00
Dmitry Vyukov
439a904515
tsan: support allocator_may_return_null flag
...
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=29
llvm-svn: 191482
2013-09-27 02:31:23 +00:00
Dmitry Vyukov
e435f94b69
tsan: fix scanf interceptor
...
llvm-svn: 191445
2013-09-26 18:38:54 +00:00
Evgeniy Stepanov
8f27f6b549
[sanitizer] A bunch of libc interceptors.
...
sigwait
sigwaitinfo
sigtimedwait
sigemptyset
sigfillset
sigpending
sigprocmask
llvm-svn: 191374
2013-09-25 14:47:43 +00:00
Alexey Samsonov
4fc53e4c06
[Sanitizer] Don't include wordexp.h on Android
...
llvm-svn: 191358
2013-09-25 07:41:46 +00:00
Evgeniy Stepanov
2761ee0409
[sanitizer] Intercept wordexp.
...
llvm-svn: 191305
2013-09-24 14:38:22 +00:00
Alexander Potapenko
ae49e8c34a
[ASan] Fix GCD tests by spinning forever in the main thread.
...
Since the error is always reported by one of the GCD workers, this will help avoid premature program termination with exit code 0.
llvm-svn: 191294
2013-09-24 12:42:25 +00:00
Evgeniy Stepanov
46901f613b
[msan] Test for atomic handling in MSan.
...
llvm-svn: 191288
2013-09-24 11:21:16 +00:00
Kostya Serebryany
01ff028814
[asan] remove -fsanitize=use-after-return from the tests (this flag now comes with asan by default)
...
llvm-svn: 191204
2013-09-23 14:34:06 +00:00
Evgeniy Stepanov
ce72b2c20b
[msan] Fix a WTF in r191196.
...
llvm-svn: 191197
2013-09-23 13:34:26 +00:00
Evgeniy Stepanov
f497bfee76
[msan] Allow nested symbolizer and loader scopes.
...
llvm-svn: 191196
2013-09-23 13:26:31 +00:00
Timur Iskhodzhanov
7f92aa687a
[ASan/Win] Slightly optimize the DLL thunk
...
llvm-svn: 191190
2013-09-23 11:40:58 +00:00
Timur Iskhodzhanov
e2b207cfd2
[ASan] Fix a compile-time warning
...
llvm-svn: 191189
2013-09-23 11:19:43 +00:00
Timur Iskhodzhanov
d6c93c7b4d
[ASan] Add DLL thunks for the new stack UAR interface
...
llvm-svn: 191188
2013-09-23 11:05:41 +00:00
Alexander Potapenko
92b566b0e4
[ASan] Fix the interface test on Darwin.
...
llvm-svn: 191187
2013-09-23 10:38:23 +00:00
Kostya Serebryany
b997c543fc
[asan] disable the detect_stack_use_after_return run-time flag by default and enable it explicitly in tests. This is done in preparation to enabling the -fsanitize=use-after-return compile-time flag by default when -fsanitize=address is present.
...
llvm-svn: 191184
2013-09-23 08:58:14 +00:00
Dmitry Vyukov
2ea2d9cb29
tsan: remove unneeded ___chkstk_ms function from Go runtime
...
llvm-svn: 191161
2013-09-22 02:49:56 +00:00
Dmitry Vyukov
a2c6e1e80f
tsan: allow symbolization of non-native PCs, e.g. coming from JIT/JAVA/etc
...
llvm-svn: 191157
2013-09-22 00:14:57 +00:00
Dmitry Vyukov
76ec1910ac
tsan: ignore malloc/free/strdup when called from libjvm
...
llvm-svn: 191153
2013-09-21 23:44:19 +00:00
Dmitry Vyukov
150406bbf3
tsan: ignore all interceptors coming directly from JVM
...
llvm-svn: 191152
2013-09-21 23:06:00 +00:00
Dmitry Vyukov
017015c9ed
tsan: improve diagnostics for incorrect usages of mutexes
...
llvm-svn: 191151
2013-09-21 22:43:27 +00:00
Dmitry Vyukov
4e9c091dd7
tsan: allow to obtain code range for a particular module
...
this is required to ignore interceptors when called from the module
llvm-svn: 191149
2013-09-21 21:41:08 +00:00
Dmitry Vyukov
1da6b4d5c8
tsan: intercept fork syscall
...
llvm-svn: 191144
2013-09-21 20:59:04 +00:00
Dmitry Vyukov
3d15bcca1d
tsan: do not try to use builtin atomic operations
...
see the comment in code
llvm-svn: 191132
2013-09-21 04:59:02 +00:00
Dmitry Vyukov
a182592aa0
tsan: intercept close syscall
...
llvm-svn: 191129
2013-09-21 03:47:35 +00:00
Alexander Potapenko
6c49695e7a
[ASan] Remove a complex multiline comment that baffles lint.
...
That comment is repeated in another function below.
llvm-svn: 191085
2013-09-20 11:33:14 +00:00
Alexander Potapenko
d1bae72e39
[libsanitizer] Pass an explicit template to mktemp. Running mktemp without a template doesn't work on Darwin.
...
llvm-svn: 191084
2013-09-20 11:29:44 +00:00
Alexander Potapenko
bff7e64a3f
[ASan] Fix compilation of asan_str_test.cc on non-Darwin.
...
llvm-svn: 191083
2013-09-20 11:03:27 +00:00
Alexander Potapenko
7be1a632b2
[ASan] Enforce the memmove semantics for both memcpy() and memmove() interceptors on Darwin.
...
Due to bugs in the interposition of resolver functions on 10.7 and 10.8 both memcpy() and memmove()
were previously intercepted by INTERCEPTOR(memcpy), which led to false positives and crashes (see http://llvm.org/bugs/show_bug.cgi?id=16362 )
We choose to use a memmove-like function in both cases. This effectively disables the overlap checks in memcpy(), but the overlaps
aren't possible in practice, because memcpy() and memmove() are the same function on Darwin.
Once the interposition is fixed in 10.9, we'll need to revisit this issue, see https://code.google.com/p/address-sanitizer/issues/detail?id=226
llvm-svn: 191081
2013-09-20 10:56:34 +00:00
Kostya Serebryany
2ab5a48dbe
[asan] nuke yet another async-signal-safety bug in UAR (oh, my)
...
llvm-svn: 191080
2013-09-20 09:16:21 +00:00
Alexey Samsonov
29d7be1f68
[Sanitizer] Add pthread_cond_init to the list of versioned functions
...
llvm-svn: 191078
2013-09-20 08:37:57 +00:00
Dmitry Vyukov
481d90c480
tsan: handle memory read/write in syscalls
...
llvm-svn: 191074
2013-09-20 06:54:14 +00:00
Dmitry Vyukov
c7547d0527
tsan: allow to ignore memory accesses in malloc and free
...
llvm-svn: 191072
2013-09-20 05:37:36 +00:00
Dmitry Vyukov
20f6ff1e66
tsan: do not crash when user intercepts fopen()
...
llvm-svn: 191066
2013-09-20 02:01:38 +00:00
Dmitry Vyukov
b523b9c8d4
tsan: fix linking of tsan runtime into dynamic libraries
...
versioned symbols can not be linked into dynamic library w/o linker script
also simplifies code as side effect
llvm-svn: 191056
2013-09-19 23:44:51 +00:00
Alexander Potapenko
8f5d907aea
[ASan] Fix init-order-dlopen.cc test to not depend on the -Wl,-undefined,dynamic_lookup being passed to the linker.
...
llvm-svn: 191012
2013-09-19 17:12:45 +00:00
Kostya Serebryany
f8bbdfaf95
[asan] fix one more async-signal-safety issue with use-after-return
...
llvm-svn: 191004
2013-09-19 14:59:52 +00:00
Alexey Samsonov
786ee9b1ad
[MSan] Fix -Wempty-body warning
...
llvm-svn: 190994
2013-09-19 08:35:16 +00:00
Alexey Samsonov
1c5cd7516f
[TSan] Fix -Wempty-body warning
...
llvm-svn: 190993
2013-09-19 07:59:18 +00:00
Dmitry Vyukov
d78bc3aa11
asan/tsan/msan: use builtin atomic operations when available
...
this should fix episodic crashes on ARM/PPC
x86_32 is still broken
llvm-svn: 190991
2013-09-19 06:02:56 +00:00
Dmitry Vyukov
f54631dcfe
tsan: prevent the following false positive due to __cxa_atexit
...
WARNING: ThreadSanitizer: data race (pid=29103)
Write of size 8 at 0x7d64003bbf00 by main thread:
#0 free tsan_interceptors.cc:477
#1 __run_exit_handlers <null>:0 (libc.so.6+0x000000050cb7)
Previous write of size 8 at 0x7d64003bbf00 by thread T78 (mutexes: write M9896):
#0 calloc tsan_interceptors.cc:449
#1 ...
llvm-svn: 190989
2013-09-19 04:48:59 +00:00
Dmitry Vyukov
c2437ffc23
tsan: consistently use thr instead of cur_thread() in annotations implementation
...
llvm-svn: 190988
2013-09-19 04:42:25 +00:00
Dmitry Vyukov
1a7ca92006
tsan: refactor internal IgnoreCtl interface
...
llvm-svn: 190987
2013-09-19 04:39:04 +00:00
Evgeniy Stepanov
91375fd66e
[tsan] No-op implementation of AnnotateMemoryIsInitialized.
...
llvm-svn: 190933
2013-09-18 11:20:31 +00:00
Kostya Serebryany
c3d43ca3ec
[asan] add a run-time option detect_stack_use_after_return, add verbosity output for fake stack
...
llvm-svn: 190932
2013-09-18 10:35:12 +00:00
Alexey Samsonov
c947eb08b5
[ASan] Don't add SANITIZER_INTERFACE_ATTRIBUTE for internal ASan functions
...
llvm-svn: 190860
2013-09-17 09:42:03 +00:00
Alexey Samsonov
a7f35c06dc
[ASan] Enable fake stack test on Mac and Android, as no-instrumentation tests are now fixed
...
llvm-svn: 190856
2013-09-17 08:40:32 +00:00
Alexey Samsonov
676c109c24
[ASan] Link tests with -pie if ASan runtime uses zero-base shadow
...
llvm-svn: 190853
2013-09-17 07:50:12 +00:00
Kostya Serebryany
2f5c2be6bd
[asan] further speedup use-after-return: simplify deallocation of fake frames. ~ 20% speedup.
...
llvm-svn: 190852
2013-09-17 07:42:54 +00:00
Nick Lewycky
885136d3b6
Check the function we just called for errors, not an incoming argument. Noticed
...
by inspection.
llvm-svn: 190828
2013-09-17 00:23:28 +00:00
Alexey Samsonov
f71c88910c
[ASan] Don't link with pthread on Android
...
llvm-svn: 190794
2013-09-16 16:51:49 +00:00
Alexey Samsonov
036a5bef2d
[ASan] Split ASan unit tests into two different binaries:
...
(1) instrumented, i.e. compiled and linked with -fsanitize=address
(2) not instrumented, compiled w/o -fsanitize=address and linked with ASan runtime statically.
llvm-svn: 190788
2013-09-16 15:50:53 +00:00
Alexey Samsonov
48e256466a
[ASan] Check that getSymbolizer() is defined. Turn magic mapping constants into named variables
...
llvm-svn: 190787
2013-09-16 15:45:06 +00:00
Alexey Samsonov
ad7925e0c1
Minor enhancements for sanitizer_common build rules
...
llvm-svn: 190786
2013-09-16 15:43:23 +00:00
Evgeniy Stepanov
08d649c024
[msan] Check return value of main: compiler-rt tests.
...
llvm-svn: 190783
2013-09-16 13:25:26 +00:00
Evgeniy Stepanov
65562f5281
[msan] Fix origin of deallocated memory.
...
MSan poisons deallocated memory but it used to give it an invalid origin value,
resulting in confusing reports. This change associates deallocation stack trace
with such memory.
Note that MSan does not have quarantine, and use-after-free detection is very
limited.
llvm-svn: 190781
2013-09-16 11:03:31 +00:00
Evgeniy Stepanov
0da35401ce
[msan] Add source file:line to stack origin reports.
...
Test.
llvm-svn: 190690
2013-09-13 12:55:07 +00:00
Evgeniy Stepanov
ac5ac34cf7
[msan] Add source file:line to stack origin reports.
...
Runtime library part.
llvm-svn: 190686
2013-09-13 12:49:13 +00:00
Evgeniy Stepanov
9be91e970e
[msan] Intercept tzset.
...
llvm-svn: 190682
2013-09-13 11:27:38 +00:00
Evgeniy Stepanov
8f0b7feb4c
[msandr] Add debugging instructions to README.txt.
...
llvm-svn: 190680
2013-09-13 11:00:50 +00:00
Kostya Serebryany
3bee8efc95
[asan] Android does not have TLS
...
llvm-svn: 190669
2013-09-13 08:58:22 +00:00
Alexey Samsonov
70c93d3b1c
[ASan] Temporary disable UAR unit test on Android due to https://code.google.com/p/address-sanitizer/issues/detail?id=222
...
llvm-svn: 190667
2013-09-13 08:07:21 +00:00
Kostya Serebryany
9583b87077
[asan] don't record the class_id in FakeFrame (scratching the last bits of performance)
...
llvm-svn: 190666
2013-09-13 07:50:44 +00:00
Kostya Serebryany
4117bdbbbc
[asan] more performance to FakeStack: a) don't used atomic exchange, instead rely on regular load and store and other signal-safe logic; b) remove allocated_from_size_class_mask_ which is not helping much anyway; Another 10% speedup
...
llvm-svn: 190664
2013-09-13 07:20:35 +00:00
Kostya Serebryany
43c4493b44
[asan] second attempt to use TLS with fake stack. This time it looks (more) async-signal safe.
...
llvm-svn: 190663
2013-09-13 06:32:26 +00:00
Kostya Serebryany
c19851ab6c
[asan] undo the previous commit since TLS hack breaks with signals... :(
...
llvm-svn: 190662
2013-09-13 06:15:02 +00:00
Kostya Serebryany
096413ba3b
[asan] use TLS on Linux to get the FakeStack. Saves 15% performance
...
llvm-svn: 190661
2013-09-13 06:04:18 +00:00
Kostya Serebryany
77caab4d7b
[asan] inline PoisonShadow in FakeStack to get ~10% speedup
...
llvm-svn: 190660
2013-09-13 05:57:58 +00:00
Peter Collingbourne
cdec0a8ad2
[dfsan] Add a few easy functions to the ABI list.
...
llvm-svn: 190653
2013-09-13 01:38:56 +00:00
Kostya Serebryany
7638aa135e
[asan] a bit of performance improvement in fake stack, generalized one test, fixed android build of another test
...
llvm-svn: 190606
2013-09-12 14:41:10 +00:00
Kostya Serebryany
627ea6391e
[asan] add a test for use-after-return and exceptions and fix it. Not 100% sure this is a complete fix, will keep looking for harder cases.
...
llvm-svn: 190603
2013-09-12 13:25:29 +00:00
Alexander Potapenko
9caa10d0c7
[ASan] Do not build asan_fake_stack_test.cc on OSX until https://code.google.com/p/address-sanitizer/issues/detail?id=222 is fixed.
...
llvm-svn: 190597
2013-09-12 09:46:56 +00:00
Kostya Serebryany
79d98a851b
[asan] limit the size of the fake stack with a reasonable constant. This fixes a failure when the main thread's stack is considered unlimited (very large).
...
llvm-svn: 190596
2013-09-12 09:08:13 +00:00
Kostya Serebryany
44441cc34b
[asan] (part 2) don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
...
llvm-svn: 190594
2013-09-12 08:47:00 +00:00
Kostya Serebryany
736bd08e05
[asan] don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
...
llvm-svn: 190593
2013-09-12 08:43:44 +00:00
Kostya Serebryany
628cda7367
[asan] hopefully make the FakeStack async-signal safe, enable the related test
...
llvm-svn: 190592
2013-09-12 08:34:50 +00:00
Evgeniy Stepanov
58dbe06230
[asan] Fix deadlock in stack unwinder on android/x86.
...
Fixes PR17116.
Patch by 林作健 (manjian2006 at gmail.com).
llvm-svn: 190590
2013-09-12 08:16:28 +00:00
Kostya Serebryany
e8f961e847
[asan] use xchg instead of CAS in FakeStack::Allocate (5% faster for this case)
...
llvm-svn: 190589
2013-09-12 07:28:42 +00:00
Kostya Serebryany
729c8dc65b
[asan] fully re-implement the FakeStack (use-after-return) to make it faster and async-signal-safe. The implementation is not yet complete (see FIXMEs) but the existing tests pass.
...
llvm-svn: 190588
2013-09-12 07:11:58 +00:00
Bill Wendling
a6ec07ce2d
Fix typo
...
llvm-svn: 190543
2013-09-11 19:35:32 +00:00
Daniel Jasper
333e0cb055
Revert r190520 as it wasn't the right fix.
...
llvm-svn: 190524
2013-09-11 12:53:04 +00:00
Daniel Jasper
2b3f143f23
Add empty virtual destructor...
...
... as this otherwise triggers -Wnon-virtual-dtor.
llvm-svn: 190520
2013-09-11 12:28:15 +00:00
Alexey Samsonov
4a2447fd81
[TSan] Use --whole-archive around TSan runtime in old TSan makefiles. Fix a Go build
...
llvm-svn: 190513
2013-09-11 11:06:06 +00:00
Alexey Samsonov
279283c064
[Sanitizer] build sanitizer_common library with -Wglobal-constructors
...
llvm-svn: 190504
2013-09-11 09:57:15 +00:00
Alexey Samsonov
e99a0b9b76
[TSan] Use Clang to compile and link TSan unit tests with TSan runtime
...
llvm-svn: 190503
2013-09-11 09:56:33 +00:00
Alexey Samsonov
d397a9ba1d
Fixup for r190410: use lazy initialization for symbolizer as some compilers emit global constructor to setup vptr
...
llvm-svn: 190414
2013-09-10 16:16:27 +00:00
Timur Iskhodzhanov
92702d8401
[ASan] Remove the explicit function prototypes for intercepted functions on Windows
...
llvm-svn: 190411
2013-09-10 14:42:15 +00:00
Alexey Samsonov
7a36e6126b
[Sanitizer] Refactor symbolization interface: use class instead of several functions. Move some code around to get rid of extra source files
...
llvm-svn: 190410
2013-09-10 14:36:16 +00:00
Kostya Serebryany
8fc35ca008
[asan] refactor the use-after-return API so that the size class is computed at compile time instead of at run-time. compiler-rt part
...
llvm-svn: 190406
2013-09-10 13:16:26 +00:00
Evgeniy Stepanov
df96e863de
[msan] bool -> int to make msan_interface.h C-compatible.
...
llvm-svn: 190402
2013-09-10 11:04:37 +00:00
Timur Iskhodzhanov
190784b21b
[ASan] Don't crash in DescribeHeapAddress if we don't know the current thread's ID
...
Also make DescribeThread easier to use.
This was firing on Dr.ASan runs, not sure how to repro InvalidTID in a simple test.
llvm-svn: 190392
2013-09-10 08:36:21 +00:00
Eli Friedman
abc1a5cb9b
Delete unused variables.
...
llvm-svn: 190383
2013-09-10 03:27:07 +00:00
Peter Collingbourne
0dca2e5ed1
[dfsan] Initial set of DFSAN_OPTIONS flags.
...
llvm-svn: 190379
2013-09-10 01:51:35 +00:00
Bill Wendling
97c22c3c92
Don't allow a NULL-length file. Try to revert to the buffered version.
...
llvm-svn: 190359
2013-09-09 22:25:46 +00:00
Evgeniy Stepanov
842fa3f80d
[msan] Intercept fstatat / fstatat64.
...
llvm-svn: 190306
2013-09-09 13:40:41 +00:00
Evgeniy Stepanov
cf02f171a9
[sanitizer] Fix PR17138.
...
strerror_r on OSX returns a positive error code when the errno value is
unknown. Buffer contents are initialized in any case.
llvm-svn: 190295
2013-09-09 08:58:54 +00:00
Evgeniy Stepanov
80cc27857b
[sanitizer] Delete extra whitespace.
...
llvm-svn: 190292
2013-09-09 06:18:07 +00:00
Alexey Samsonov
77029be19a
[ASan] fix one more memory leak in test case
...
llvm-svn: 190277
2013-09-08 14:01:07 +00:00
Alexey Samsonov
a302a1affc
[Sanitizer] Use generic configs for running sanitizer_common unit tests
...
llvm-svn: 190276
2013-09-08 13:52:07 +00:00
Alexey Samsonov
071cc9e89d
[ASan] turn on leak checking for ASan tests and fix a few discovered leaks
...
llvm-svn: 190274
2013-09-08 13:23:29 +00:00
Evgeniy Stepanov
73166796a3
[sanitizer] Avoid including any system headers in the system-header-free part of the runtime library.
...
llvm-svn: 190161
2013-09-06 15:34:17 +00:00
Evgeniy Stepanov
09d33c67e1
[sanitizer] Fix Android build.
...
Android actually has "__unused" macro defined in <cdefs.h>.
llvm-svn: 190160
2013-09-06 14:58:49 +00:00
Evgeniy Stepanov
5c1035e7fa
[sanitizer] A bunch of linux system call handlers.
...
llvm-svn: 190157
2013-09-06 14:20:01 +00:00
Alexander Potapenko
2a54274c25
[ASan] make the check for NULL more portable.
...
llvm-svn: 190139
2013-09-06 12:04:37 +00:00