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
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
20abdf69ec
Add top-level CMake 'compiler-rt' target to build all compiler-rt libraries
...
llvm-svn: 191747
2013-10-01 12:52:15 +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