Evgeniy Stepanov
f5c1f8ac84
[sanitizer] Intercept timerfd_settime, timerfd_gettime.
...
llvm-svn: 215112
2014-08-07 14:21:42 +00:00
Viktor Kutuzov
a37ad099e8
Segregate FreeBSD-specific parts from sanitizer_procmaps_linux.cc
...
Differential Revision: http://reviews.llvm.org/D4555
llvm-svn: 214955
2014-08-06 10:16:52 +00:00
Dmitry Vyukov
70db9d4d72
tsan: allocate vector clocks using slab allocator
...
Vector clocks is the most actively allocated object in tsan runtime.
Current internal allocator is not scalable enough to handle allocation
of clocks in scalable way (too small caches). This changes transforms
clocks to 2-level array with 512-byte blocks. Since all blocks are of
the same size, it's possible to cache them more efficiently in per-thread caches.
llvm-svn: 214912
2014-08-05 18:45:02 +00:00
Alexey Samsonov
ff24fd2516
[UBSan] Allow to suppress reports from vptr checker for specified types.
...
Based on http://reviews.llvm.org/D4702 by Byoungyoung Lee!
llvm-svn: 214833
2014-08-05 01:24:22 +00:00
Alexey Samsonov
ae1764854e
[Sanitizer] Turn SuppressionContext::Init() into InitIfNecessary().
...
Suppression context might be used in multiple sanitizers working
simultaneously (e.g. LSan and UBSan) and not knowing about each other.
llvm-svn: 214831
2014-08-05 00:43:23 +00:00
Viktor Kutuzov
62308221bc
Fix the waitid sanitizer interceptor to work on FreeBSD in 32-bit mode
...
Differential Revision: http://reviews.llvm.org/D4670
llvm-svn: 214543
2014-08-01 19:33:14 +00:00
Alexey Samsonov
19fc293782
[Sanitizer] Don't try to parse unspecified suppressions file
...
llvm-svn: 214421
2014-07-31 19:06:47 +00:00
Alexey Samsonov
89b17bb7bc
[Sanitizer] Hoist the code parsing suppressions file into sanitizer_common.
...
Remove corresponding bits from LSan and TSan runtimes. No functionality change.
llvm-svn: 214344
2014-07-30 21:53:30 +00:00
Alexey Samsonov
77f646c623
[Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
...
No functionality change.
llvm-svn: 214343
2014-07-30 21:33:04 +00:00
Alexey Samsonov
34a4c6e12f
[Sanitizer] Make SuppressionContext a singleton class, residing in sanitizer_common.
...
Convert TSan and LSan to the new interface. More changes will follow:
1) "suppressions" should become a common runtime flag.
2) Code for parsing suppressions file should be moved to SuppressionContext::Init().
llvm-svn: 214334
2014-07-30 20:54:37 +00:00
Alexey Samsonov
20c5c7b723
[UBSan] Get pc/bp for stack unwinding as early as possible.
...
This will ensure that stack frames in error reports will not
contain internal UBSan failures, and frame #0 will be the
actual place in the program where the error happens.
llvm-svn: 214245
2014-07-29 23:22:41 +00:00
Dmitry Vyukov
4baa65518b
tsan: reduce internal allocator region from 16M to 1M
...
16M regions can waste almost 1G for nothing.
Since region size is used only during initial heap growth,
it's unclear why we even need such huge regions.
llvm-svn: 214027
2014-07-26 10:17:26 +00:00
Dmitry Vyukov
07fdaf97e4
tsan: remove meta from internal allocator
...
I am puzzled why it is even there.
llvm-svn: 214026
2014-07-26 10:06:11 +00:00
Nick Lewycky
1f30f5aef7
Satisfy -Wparentheses.
...
llvm-svn: 214017
2014-07-26 05:07:41 +00:00
Alexey Samsonov
1440105338
[Sanitizer] Simplify Symbolizer creation interface.
...
Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.
No functionality change.
llvm-svn: 214005
2014-07-26 01:37:23 +00:00
Alexey Samsonov
2178054216
[Sanitizer] Introduce SANITIZER_CAN_USE_PREINIT_ARRAY definition and use it across sanitizers.
...
Get rid of ASAN_USE_PREINIT_ARRAY and LSAN_USE_PREINIT_ARRAY - just always
use .preinit_array if it's available. This mode seems stable enough, and
we've been relying on default values of these macro for a long time.
llvm-svn: 213980
2014-07-25 22:05:02 +00:00
Viktor Kutuzov
d712403b98
Allow initialization of Asan interceptors before the general Asan initialization takes place on FreeBSD
...
Differential Revision: http://reviews.llvm.org/D4496
llvm-svn: 213941
2014-07-25 12:45:36 +00:00
Viktor Kutuzov
2fde54f48c
Support traversing ELF objects for sanitizers needs on FreeBSD in 32-bit mode
...
Differential Revision: http://reviews.llvm.org/D4656
llvm-svn: 213940
2014-07-25 12:29:04 +00:00
Alexey Samsonov
ad63cfd7e5
[Sanitizer] Disable Wframe-larger-than on PowerPC hosts
...
llvm-svn: 213702
2014-07-22 23:10:13 +00:00
Alexey Samsonov
4532489752
Adjust gen_dynamic_list for PowerPC function descriptors
...
llvm-svn: 213577
2014-07-21 19:01:03 +00:00
Timur Iskhodzhanov
bdf23a51b1
[ASan/Win] Handle situations when the client app has used DbgHelp before
...
Reviewed at http://reviews.llvm.org/D4533
llvm-svn: 213151
2014-07-16 14:11:02 +00:00
Timur Iskhodzhanov
9e4580c8ee
[ASan] Only define macros in asan_init_version.h, move the __asan_init declaration back to asan_interface_internal.h
...
This fixes the issues we've uncovered after landing r212815.
Reviewed at http://reviews.llvm.org/D4500
llvm-svn: 213053
2014-07-15 08:16:04 +00:00
Evgeniy Stepanov
d73e7cc879
[sanitizer] Intercept getpass.
...
llvm-svn: 212937
2014-07-14 13:07:51 +00:00
Timur Iskhodzhanov
03f1e408de
[ASan/Win] Don't apply dllexport to __asan_init in the DLL thunk
...
This fixes '___asan_init_v4 already defined' errors when linking some of Chromium DLLs.
Looks like one of the DLL is using a .lib produced while linking another DLL and it exploded after r212699.
I'm trying to come up with a small testcase...
llvm-svn: 212815
2014-07-11 13:46:05 +00:00
Timur Iskhodzhanov
19853dd28c
[ASan/Win] Catch NULL derefs and page faults
...
Reviewed at http://reviews.llvm.org/D4471
llvm-svn: 212807
2014-07-11 11:57:41 +00:00
Viktor Kutuzov
794d4dde48
Only use fast stack unwinding for sanitizers failure reports on FreeBSD
...
Differential Revision: http://reviews.llvm.org/D4420
llvm-svn: 212691
2014-07-10 09:11:15 +00:00
Viktor Kutuzov
d0907ae222
Fix getting environment variables for sanitizers needs on FreeBSD
...
Differential Revision: http://reviews.llvm.org/D4229
llvm-svn: 212690
2014-07-10 08:53:29 +00:00
Alexey Samsonov
f723794da8
[Sanitizer] Remove SANITIZER_NEEDS_SEGV from shared sanitizer_common headers.
...
Otherwise, it can be accidentally redefined when we build specific sanitizer
runtime. This definition should be provided only once - when we build
sanitizer_common library.
llvm-svn: 212663
2014-07-09 23:59:40 +00:00
Alexey Samsonov
cd0a4aaba3
Don't check lint for SpecialCaseList.cpp
...
llvm-svn: 212642
2014-07-09 19:29:10 +00:00
Dmitry Vyukov
b0250948c6
tsan: remove unnecessary line split
...
llvm-svn: 212527
2014-07-08 13:07:23 +00:00
Alexey Samsonov
91bb8e0e3a
Generalize sanitizer allocator public interface.
...
Introduce new public header <sanitizer/allocator_interface.h> and a set
of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc.
that will eventually replace their tool-specific equivalents
(__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific
functions are now deprecated and implemented as stubs redirecting
to __sanitizer_ versions (which are implemented differently in each tool).
Replace all uses of __xsan_ versions with __sanitizer_ versions in unit
and lit tests.
llvm-svn: 212469
2014-07-07 17:39:31 +00:00
Timur Iskhodzhanov
575180dbd2
[ASan/Win] Unbreak the build after r211216
...
llvm-svn: 212465
2014-07-07 16:22:04 +00:00
Evgeniy Stepanov
f0831ee8d2
[msan] Increase hash table size for chained origins.
...
llvm-svn: 212448
2014-07-07 10:45:15 +00:00
Evgeniy Stepanov
4af9c0ea80
[asan] i686-linux-android support.
...
Large part of this change is required due to
https://code.google.com/p/android/issues/detail?id=61799
dlsym() crashes when symbol resolution fails, which means
we have to limit the interceptor list instead of relying on
runtime detection.
There are minor differencies in system headers, too.
llvm-svn: 212273
2014-07-03 14:20:56 +00:00
Evgeniy Stepanov
7c2d32bf87
[asan] Fix unused variable warning.
...
llvm-svn: 212272
2014-07-03 14:14:59 +00:00
Alexey Samsonov
cffaa1c298
Fix apparent thinko in r209744: allocator stats can be zero
...
llvm-svn: 212071
2014-06-30 22:40:58 +00:00
Alexander Potapenko
b1b8231c8b
[ASan] When iterating over segments on OSX, treat the segments' initial
...
protection level as their current protection level.
This fixes the UNIMPLEMENTED check that started to fire on OSX after r210649.
llvm-svn: 211713
2014-06-25 15:43:19 +00:00
Evgeniy Stepanov
0b2d93c4f0
[sanitizer] Fix build on platforms where dtls support is disabled.
...
llvm-svn: 211684
2014-06-25 11:43:46 +00:00
Evgeniy Stepanov
7ad0bde843
[msan] Fix false positive on dynamic tls.
...
Use existing DTLS code in sanitizer_tls_get_addr.{h,cc} to unpoison DTLS
blocks both on allocation and deallocation.
https://code.google.com/p/memory-sanitizer/issues/detail?id=44
llvm-svn: 211683
2014-06-25 11:30:35 +00:00
Daniel Sanders
4dc8a78b04
[asan] adding support of 32-bit address sanitizer for MIPS
...
Summary: The patch supports both the clang cross-compiler and native compiler
Patch by Kumar Sukhani <Kumar.Sukhani@imgtec.com>
Test Plan:
Kumar had the following asan test results when compiled on a MIPS board:
Expected Passes : 96
Expected Failures : 2
Unsupported Tests : 84
Unexpected Passes : 4
Unexpected Failures: 19
The list of unexpected failures can be found in the review.
Reviewers: kcc, petarj, dsanders
Reviewed By: kcc
Subscribers: farazs, kcc, llvm-commits
Differential Revision: http://reviews.llvm.org/D4208
llvm-svn: 211587
2014-06-24 12:08:18 +00:00
Dmitry Vyukov
f9c22916d5
tsan: fix freebsd build
...
freebsd does not have /proc/self/environ
llvm-svn: 211417
2014-06-20 22:49:41 +00:00
Dmitry Vyukov
3fc095e031
tsan: remove unused header include
...
llvm-svn: 211385
2014-06-20 18:28:34 +00:00
Evgeniy Stepanov
a2327c3a65
[sanitizer] Intercept pthread_*attr_get*.
...
This is a resubmit of r211166 reverted due to osx breakage.
llvm-svn: 211264
2014-06-19 10:19:57 +00:00
Arnold Schwaighofer
868050a667
Revert "[sanitizer] Intercept pthread_*attr_get*."
...
This reverts commit r211166. It broke public mac os x bots.
llvm-svn: 211206
2014-06-18 19:04:47 +00:00
Evgeniy Stepanov
b87f1efc5f
[sanitizer] Intercept pthread_*attr_get*.
...
llvm-svn: 211166
2014-06-18 14:16:41 +00:00
Evgeniy Stepanov
2c27df9a33
[msan] Intercept __getdelim.
...
llvm-svn: 211162
2014-06-18 13:35:13 +00:00
Alexander Potapenko
853a232e66
[ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time() and frexp()
...
Add a test for the frexp() interceptor.
Annotate the interceptors that may potentially corrupt stack IDs of freed buffers with FIXME comments.
llvm-svn: 211153
2014-06-18 09:27:40 +00:00
Dan Albert
1236ac388d
Swap getdtablesize() for sysconf(_SC_OPEN_MAX).
...
Bionic is no removing this as it was removed from POSIX 2004.
llvm-svn: 211027
2014-06-16 14:51:11 +00:00
Sergey Matveev
998d991b2d
[sanitizer] Support PTRACE_GETEVENTMSG in the ptrace() interceptor.
...
llvm-svn: 211022
2014-06-16 13:49:13 +00:00
Kostya Serebryany
9f5d48c0a0
[asan] initialze varaibles to avoid a (false positive) report from gcc's -Wmaybe-uninitialized
...
llvm-svn: 211008
2014-06-16 08:32:02 +00:00
Viktor Kutuzov
1f386f0f36
Fix getting IP, BP and SP for address sanitizer's needs on FreeBSD in 32-bit mode
...
llvm-svn: 210988
2014-06-15 13:56:28 +00:00
Dan Albert
1c71fde161
Exclude Android from the tests for valloc/pvalloc.
...
These functions are being removed from Android because they were removed
from POSIX 2004.
llvm-svn: 210962
2014-06-14 00:50:03 +00:00
Alexey Samsonov
e287ef847a
[Sanitizer] Merge AnsiColorDecorator and SanitizerCommonDecorator, use the latter in UBSan
...
llvm-svn: 210959
2014-06-13 23:46:37 +00:00
Evgeniy Stepanov
dfa5439652
[asan] Fix mmap-ed coverage with coverage=0.
...
llvm-svn: 210655
2014-06-11 15:11:26 +00:00
Evgeniy Stepanov
b2b4c3ab32
[asan] Exclude non-executable mappings from coverage.
...
llvm-svn: 210649
2014-06-11 10:11:51 +00:00
Evgeniy Stepanov
9cc3ebdd3b
[sanitizer] Relax sanity checks in ioctl decoding.
...
Standard KVM ioctls don't pass currect ioctl_decode().
llvm-svn: 210533
2014-06-10 13:54:15 +00:00
Dmitry Vyukov
909b7490a3
sanitizer: document missing macro
...
llvm-svn: 210329
2014-06-06 12:16:26 +00:00
Evgeniy Stepanov
38c228a842
[asancov] Faster coverage in memory-mapped mode.
...
Use caller pc of __sanitizer_cov_module_init to figure out
when 2 sequential calls are from the same module; skip
.sancov.map file update in this case.
llvm-svn: 210267
2014-06-05 14:38:53 +00:00
Evgeniy Stepanov
3641cd43b2
[asan] Use -pthread instead of -lpthread in tests.
...
llvm-svn: 210255
2014-06-05 12:22:37 +00:00
Dan Albert
f4239c7707
Remove's uses of sys/timeb.h for Android.
...
Android is removing sys/timeb.h because it was removed in POSIX 2008.
llvm-svn: 210235
2014-06-05 02:00:24 +00:00
Evgeniy Stepanov
fe18102649
[sancov] Handle fork.
...
Reset coverage data on fork().
For memory-mapped mode (coverage_direct=1) this helps avoid loss of data
(before this change two processes would write to the same file simultaneously).
For normal mode, this reduces coverage dump size, because PCs from the parent
process are no longer inherited by the child.
llvm-svn: 210180
2014-06-04 12:13:54 +00:00
Evgeniy Stepanov
ce98452516
[sancov] Delay opening dump file until the first module constructor.
...
llvm-svn: 210109
2014-06-03 15:27:15 +00:00
Evgeniy Stepanov
937afa1fbb
[sancov] Handle spaces in module name.
...
llvm-svn: 210108
2014-06-03 15:25:43 +00:00
Evgeniy Stepanov
bb2fc7e4bb
[sancov] Fix map update logic on Android.
...
dlopen()/dlclose() are not interceptable on Android,
so we update .sancov.map in module constructor callbacks.
llvm-svn: 210098
2014-06-03 12:15:43 +00:00
Evgeniy Stepanov
96f8edc720
[asan] Default to memory-mapped coverage on Android.
...
The alternative (writing coverage at process exit) is nearly useless there.
llvm-svn: 210024
2014-06-02 13:06:33 +00:00
Evgeniy Stepanov
2fcc427741
[sancov] Remove debug leftovers and update usage text.
...
llvm-svn: 210009
2014-06-02 09:04:45 +00:00
Dmitry Vyukov
afdcc96d9f
tsan: optimize memory access functions
...
The optimization is two-fold:
First, the algorithm now uses SSE instructions to
handle all 4 shadow slots at once. This makes processing
faster.
Second, if shadow contains the same access, we do not
store the event into trace. This increases effective
trace size, that is, tsan can remember up to 10x more
previous memory accesses.
Perofrmance impact:
Before:
[ OK ] DISABLED_BENCH.Mop8Read (2461 ms)
[ OK ] DISABLED_BENCH.Mop8Write (1836 ms)
After:
[ OK ] DISABLED_BENCH.Mop8Read (1204 ms)
[ OK ] DISABLED_BENCH.Mop8Write (976 ms)
But this measures only fast-path.
On large real applications the speedup is ~20%.
Trace size impact:
On app1:
Memory accesses : 1163265870
Including same : 791312905 (68%)
on app2:
Memory accesses : 166875345
Including same : 150449689 (90%)
90% of filtered events means that trace size is effectively 10x larger.
llvm-svn: 209897
2014-05-30 13:36:29 +00:00
Timur Iskhodzhanov
1b42b81549
[Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable
...
Reviewed at http://reviews.llvm.org/D3952
llvm-svn: 209889
2014-05-30 12:42:57 +00:00
Evgeniy Stepanov
3a0486b1e9
[sanitizer] Fix build on ARM.
...
llvm-svn: 209884
2014-05-30 10:50:17 +00:00
Evgeniy Stepanov
dd7cb28572
[asan] Enable ASan on PowerPC.
...
Patch by Peter Bergner.
llvm-svn: 209879
2014-05-30 08:52:03 +00:00
Evgeniy Stepanov
50c1532a1a
[sanitizer] Update flags test.
...
llvm-svn: 209818
2014-05-29 14:55:12 +00:00
Evgeniy Stepanov
fa5c0750f0
[sanitizer] Add coverage_dir flag.
...
llvm-svn: 209815
2014-05-29 14:33:16 +00:00
Evgeniy Stepanov
a0aa0f41d1
[sanitizer] Require that options end with '='.
...
llvm-svn: 209814
2014-05-29 14:32:32 +00:00
Viktor Kutuzov
9cd9b4ce0c
Support getting executable's name for sanitizers needs on FreeBSD
...
llvm-svn: 209805
2014-05-29 12:12:42 +00:00
Viktor Kutuzov
76d35f47d3
Fix building 32-bit common sanitizer tests on FreeBSD 9.2
...
llvm-svn: 209804
2014-05-29 11:35:05 +00:00
Alexey Samsonov
5bcd1d8a8f
[Sanitizer] Always prefer cached contents of /proc/self/exe if it's available
...
llvm-svn: 209773
2014-05-28 21:23:53 +00:00
Dmitry Vyukov
5864ac39ee
tsan: do not use 64-bit atomics in allocator code
...
64-bit atomics make porting of asan to 32-bits platforms problematic.
llvm-svn: 209744
2014-05-28 15:22:12 +00:00
Timur Iskhodzhanov
82ee0433da
[ASan/Win] Use clang rather than clang-cl by default for lit tests. Make Windows-only tests explicitly use clang-cl.
...
Reviewed at http://reviews.llvm.org/D3893
llvm-svn: 209719
2014-05-28 08:38:13 +00:00
Evgeniy Stepanov
a00ff194b7
[asan] Add a few stubs to fix windows build.
...
llvm-svn: 209717
2014-05-28 08:26:24 +00:00
Evgeniy Stepanov
360c911872
[asan] Disable dlopen interceptor on Android.
...
It can not work, as libdl is always first in the lookup order,
even ahead of LD_PRELOAD-ed libraries.
llvm-svn: 209657
2014-05-27 14:14:03 +00:00
Evgeniy Stepanov
567e516015
[asancov] Write coverage directly to a memory-mapped file.
...
This way does not require a __sanitizer_cov_dump() call. That's
important on Android, where apps can be killed at arbitrary time.
We write raw PCs to disk instead of module offsets; we also write
memory layout to a separate file. This increases dump size by the
factor of 2 on 64-bit systems.
llvm-svn: 209653
2014-05-27 12:37:52 +00:00
Greg Fitzgerald
7b15cf8884
On AArch64, use clone() instead of fork()
...
Patch by Gideon Billings.
Differential Revision: http://reviews.llvm.org/D3903
llvm-svn: 209641
2014-05-26 23:44:55 +00:00
Sergey Matveev
2be4a28297
[sanitizer] Make stack traces from dlclose()'d modules more meaningful.
...
Previously, they silently omitted PCs belonging to unknown modules. Now we print
(<unknown module>) instead.
llvm-svn: 209522
2014-05-23 16:04:41 +00:00
Kostya Serebryany
a72efdff9e
[ubsan] handle long double in 32-bit mode; part of the patch by Marek Polacek
...
llvm-svn: 209516
2014-05-23 14:45:13 +00:00
Sergey Matveev
83f91e786c
[sanitizer] Add __sanitizer_maybe_open_cov_file().
...
Summary: Add a new interface function required for coverage sandboxing support.
llvm-svn: 209298
2014-05-21 13:43:52 +00:00
Evgeniy Stepanov
f77f2ece71
[tsan] Fix gotsan build.
...
llvm-svn: 209286
2014-05-21 09:42:56 +00:00
Evgeniy Stepanov
208aae8ee0
[msan] Chained origins re-design.
...
Generalize StackDepot and create a new specialized instance of it to
efficiently (i.e. without duplicating stack trace data) store the
origin history tree.
This reduces memory usage for chained origins roughly by an order of
magnitude.
Most importantly, this new design allows us to put two limits on
stored history data (exposed in MSAN_OPTIONS) that help avoid
exponential growth in used memory on certain workloads.
See comments in lib/msan/msan_origin.h for more details.
llvm-svn: 209284
2014-05-21 09:02:13 +00:00
Kostya Serebryany
b9aa538db1
[sanitizer] fix linux_dirent for SANITIZER_X32; based on patch by H.J. Lu
...
llvm-svn: 209281
2014-05-21 08:21:13 +00:00
Kostya Serebryany
b4e24fccd1
[sanitizer] define SANITIZER_X32 and use it in ThreadDescriptorSize; partially based on patch by H.J. Lu
...
llvm-svn: 209279
2014-05-21 08:01:44 +00:00
Kostya Serebryany
84019ff7e5
Cast pointers to uptr when calling internal_syscall
...
For Linux/x86-64, pointers passed to internal_syscall should be casted
to uptr first. Otherwise, they won't be properly extended to 64-bit for
x32.
Patch by H.J. Lu
llvm-svn: 209278
2014-05-21 07:49:03 +00:00
Kostya Serebryany
6c9eacb384
Use 64-bit pointer to unwind stack for x86-64
...
X32 uses ILP32 data model in 64-bit hardware mode. This patch always
uses 64-bit pointer to unwind stack for x86-64.
Patch by H.J. Lu
llvm-svn: 209277
2014-05-21 07:34:03 +00:00
Sergey Matveev
6d8b9a747c
[sanitizer] Fix go build following r209121.
...
llvm-svn: 209136
2014-05-19 16:08:53 +00:00
Sergey Matveev
6cb47a083b
[sanitizer] Support sandboxing in sanitizer coverage.
...
Summary:
Sandboxed code may now pass additional arguments to
__sanitizer_sandbox_on_notify() to force all coverage data to be dumped to a
single file (the default is one file per module). The user may supply a file or
socket to write to. The latter option can be used to broker out the file writing
functionality. If -1 is passed, we pre-open a file.
llvm-svn: 209121
2014-05-19 12:53:03 +00:00
Timur Iskhodzhanov
930ffe94aa
[Sanitizer tests] Don't need to use -lstdc++ thanks to --driver-mode=g++
...
Reviewed at http://reviews.llvm.org/D3796
llvm-svn: 209115
2014-05-19 08:19:38 +00:00
Greg Fitzgerald
f42b49787b
cleanup and test litlint
...
llvm-svn: 208907
2014-05-15 18:52:11 +00:00
Evgeniy Stepanov
f532c5bfd5
[sanitizer] Remove the definition of xdr_ops.
...
User-visible instances of xdr_ops always seem to be allocated statically, and
don't need unpoisoning. Also, it's size differs between platforms.
llvm-svn: 208851
2014-05-15 07:18:34 +00:00
Alp Toker
1ee7fc7a1a
Fix typos
...
llvm-svn: 208841
2014-05-15 02:22:34 +00:00
Greg Fitzgerald
ceae1fbafd
migrate litlint from argparse to optparse. reenabled
...
llvm-svn: 208826
2014-05-14 23:31:20 +00:00
Greg Fitzgerald
73bd03cee9
Disabled litlint. It requires Python 2.7 or later
...
llvm-svn: 208823
2014-05-14 23:20:30 +00:00
Greg Fitzgerald
a310d98ff1
add script to ensure lit test contains %run
...
llvm-svn: 208819
2014-05-14 22:49:46 +00:00
Kostya Serebryany
b9e31d7fcd
[asan] use some LIKELY/UNLIKELY
...
llvm-svn: 208776
2014-05-14 14:03:31 +00:00
Timur Iskhodzhanov
86e2470a5b
[ASan/Win] Enable demangling of global variable names
...
llvm-svn: 208775
2014-05-14 13:55:59 +00:00
Evgeniy Stepanov
99d3791a88
[sanitizer] Fix crash in getgrnam_r and similar interceptors.
...
When no matching record is found, getgrnam_r return 0 but sets result to NULL.
Should fix PR19734.
llvm-svn: 208773
2014-05-14 12:32:40 +00:00
Alexander Potapenko
04e2f43756
[libsanitizer] Notify the runtime about file being closed before the actual call to fclose().
...
This shall fix spurious false positive race reports between fclose() and fopen64().
llvm-svn: 208772
2014-05-14 11:48:37 +00:00
Kostya Serebryany
d5e1091c73
[asan] tyring to fix the Android build
...
llvm-svn: 208763
2014-05-14 09:21:22 +00:00
Kostya Serebryany
7534a60753
[asan] Respect personality in kernel area detector, patch by Yuri Gribov
...
llvm-svn: 208760
2014-05-14 08:13:11 +00:00
Alexander Potapenko
291b827890
[libsanitizer] Fix the return type of internal_fork
...
llvm-svn: 208714
2014-05-13 17:31:09 +00:00
Alexander Potapenko
4a6cac4382
[libsanitizer] Use internal_fork() to spawn the symbolizer process.
...
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=61
llvm-svn: 208707
2014-05-13 16:17:54 +00:00
Timur Iskhodzhanov
5ce3937ed4
[Sanitizer tests] Define 16- and 64-bit versions of atomic_compare_exchange_strong on Windows
...
Reviewed at http://reviews.llvm.org/D3745
llvm-svn: 208700
2014-05-13 14:23:25 +00:00
Timur Iskhodzhanov
5812350591
[Sanitizer tests] Exclude three tests that fail on Windows
...
llvm-svn: 208698
2014-05-13 13:34:00 +00:00
Timur Iskhodzhanov
e33158bcd1
[Sanitizer tests] Land the sanitizer twin of the asan-only change r208682
...
llvm-svn: 208697
2014-05-13 13:29:11 +00:00
Timur Iskhodzhanov
339e8c98f8
[Sanitizer tests] Add sanitizer_test_config.h to make the inclusion of gtest.h conditional
...
Reviewed at http://reviews.llvm.org/D3744
llvm-svn: 208696
2014-05-13 13:25:12 +00:00
Timur Iskhodzhanov
2e9136c2da
[Sanitizer/ASan tests] Automatically detect the presence of libstdc++
...
llvm-svn: 208695
2014-05-13 12:57:50 +00:00
Evgeniy Stepanov
68d7f43e38
[sanitizer] Disable fopen64 interceptor on osx.
...
llvm-svn: 208693
2014-05-13 12:05:38 +00:00
Timur Iskhodzhanov
e5e92fac4a
[Sanitizer tests] Fix most of the build problems on Windows
...
E.g. use the pthread helpers introduced in r208674
llvm-svn: 208692
2014-05-13 12:02:53 +00:00
Evgeniy Stepanov
7bd7063db0
[sanitizer] Mark several functions as possibly unused.
...
llvm-svn: 208686
2014-05-13 11:18:22 +00:00
Evgeniy Stepanov
4d16c1df0c
[sanitizer] Delete an unused function.
...
llvm-svn: 208678
2014-05-13 09:03:45 +00:00
Evgeniy Stepanov
6b21d560c9
[sanitizer] Fix windows build.
...
llvm-svn: 208677
2014-05-13 08:47:40 +00:00
Evgeniy Stepanov
5680a26b0b
[msan] Better open_memstream support.
...
Move fflush and fclose interceptors to sanitizer_common.
Use a metadata map to keep information about the external locations
that must be updated when the file is written to.
llvm-svn: 208676
2014-05-13 08:36:31 +00:00
Timur Iskhodzhanov
711269966c
[Sanitizer tests] Make simple pthread tests compile and pass on Windows
...
Reviewed at http://reviews.llvm.org/D3725
llvm-svn: 208674
2014-05-13 08:07:09 +00:00
Kostya Serebryany
0d00675df2
[sanitizer] fix for ARM Linux, patch by Maxim Ostapenko
...
llvm-svn: 208673
2014-05-13 08:01:59 +00:00
Kostya Serebryany
b7a7e55dc5
[sanitizer] define __sanitizer_time_t
...
llvm-svn: 208671
2014-05-13 07:49:39 +00:00
Timur Iskhodzhanov
1ac44dd087
[Sanitizer tests] Fix a comment that got out of sync with the #if
...
llvm-svn: 208602
2014-05-12 17:33:00 +00:00
Timur Iskhodzhanov
36fc9b18b7
[ASan tests] Also define USED/UNUSED in lib/sanitizer_common/sanitizer_internal_defs.h if Clang is used on Windows
...
Otherwise we end up with macro redefinition warnings
llvm-svn: 208571
2014-05-12 14:44:29 +00:00
Timur Iskhodzhanov
9a205ed8ee
[ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings
...
llvm-svn: 208568
2014-05-12 14:31:57 +00:00
Sergey Matveev
f37bd92c3a
[asan] Move the "coverage" flag to common flags.
...
The implementation lives in sanitizer_common and will need to access that flag.
llvm-svn: 208566
2014-05-12 14:27:36 +00:00
Alexey Samsonov
35744c4753
Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET.
...
llvm-svn: 208363
2014-05-08 22:11:20 +00:00
Sergey Matveev
76e02e90c5
[ASan] Fix coverage behavior when a PC belongs to an unknown address range.
...
This happens, e.g., when coverage data is collected for a module which is then
dlclose()'d. Currently this causes CovDump() to ignore all PCs that are greater
than the unrecognized PC. In other words, unloading a module causes ASan to
silently ignore any coverage data for modules loaded at higher addresses.
Instead we should just skip the unrecognized PCs.
llvm-svn: 208333
2014-05-08 16:09:54 +00:00
Timur Iskhodzhanov
76f43eecb0
[ASan] Update sanitizer_common and asan test_util headers to support building on Windows
...
llvm-svn: 208306
2014-05-08 12:43:33 +00:00
Evgeniy Stepanov
d31ac26230
[sanitizer] Unconditionally write to target buffer in *sprintf interceptors.
...
This does not change the default behavior (check_printf in on by default in all tools).
With this change, check_printf flag only affects format string parsing.
llvm-svn: 208290
2014-05-08 09:18:22 +00:00
Evgeniy Stepanov
7d46040ff2
[sanitizer] Replace a macro with a function.
...
llvm-svn: 208207
2014-05-07 13:24:28 +00:00
Evgeniy Stepanov
55590227f8
[sanitizer] Intercept obstack.
...
llvm-svn: 208196
2014-05-07 11:50:56 +00:00
Kostya Serebryany
7a733480c8
[asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
...
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Evgeniy Stepanov
aa44aaee90
[sanitizer] Print addresses in hexadecimal.
...
llvm-svn: 208089
2014-05-06 14:01:13 +00:00
Timur Iskhodzhanov
7d5c81db0a
[ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1
...
Reviewed at http://reviews.llvm.org/D3610
llvm-svn: 208070
2014-05-06 08:21:50 +00:00
Kostya Serebryany
98e55ef41a
[sanitizer] fix build with glibc 2.4, patch by Sandra Loosemore
...
llvm-svn: 208066
2014-05-06 07:36:51 +00:00
Kostya Serebryany
12963b54a8
[asan] disable GetKernelStartAddress as it misbehaves in schroot
...
llvm-svn: 207768
2014-05-01 16:20:23 +00:00
Kostya Serebryany
8b530e10a1
[asan] make AsanCoverage lock-free (and AS-safe)
...
llvm-svn: 207630
2014-04-30 10:40:48 +00:00
Alexey Samsonov
d94e87db3f
[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interceptors
...
llvm-svn: 207443
2014-04-28 20:40:25 +00:00
Viktor Kutuzov
f9eba2f51d
Fix building Asan and common sanitizers tests on FreeBSD 9.2
...
llvm-svn: 207408
2014-04-28 10:33:01 +00:00
Evgeniy Stepanov
c435fb07dd
[sanitizer] Limit fopen interceptor to linux.
...
llvm-svn: 207227
2014-04-25 13:55:29 +00:00
Evgeniy Stepanov
f3d5d119a8
[sanitizer] Intercept a bunch of stdio calls.
...
Add move fopen/freopen interceptors from TSan to common.
llvm-svn: 207224
2014-04-25 13:26:21 +00:00
Alexander Potapenko
623c989eea
[ASan] Use a non-null altstack.ss_size when disabling sigaltstack on Darwin.
...
llvm-svn: 207220
2014-04-25 10:39:41 +00:00
Justin Bogner
b83dd55eb6
[sanitizer] wordexp isn't available on iOS
...
llvm-svn: 207140
2014-04-24 20:10:31 +00:00
Dmitry Vyukov
b7ebc53772
tsan: stop background thread when sandbox is enabled
...
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=56
llvm-svn: 207114
2014-04-24 13:09:17 +00:00
Kostya Serebryany
7afc6b2c72
[asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
...
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Kostya Serebryany
c9db838267
[asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
...
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Kostya Serebryany
26c4e96455
[sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
...
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Evgeniy Stepanov
a7f9071f25
[sanitizer] Intercept tsearch.
...
llvm-svn: 206755
2014-04-21 14:21:51 +00:00
Alexey Samsonov
aefbec9dfd
Move pthread_cond_* interceptors from sanitizer_common with all the ugly hacks to TSan
...
llvm-svn: 206423
2014-04-16 23:06:46 +00:00
Kostya Serebryany
498b18a01e
[asan] try to harden __tls_get_addr interceptor against signals (no good test still); update the comment in a test.
...
llvm-svn: 206367
2014-04-16 09:07:27 +00:00
Alexander Potapenko
65a6c57013
[ASan] Replace a CHECK for mmap_limit_mb with a RAW_CHECK.
...
In the case of a CHECK failure the program tries to fork and launch llvm-symbolizer,
but hangs in mz_force_lock because one of the allocator locks is already acquired.
llvm-svn: 206274
2014-04-15 11:36:18 +00:00
Kostya Serebryany
b1232474b2
[asan] try fixing the mmap_limit_mb failure on buildbot (tests pass locally)
...
llvm-svn: 206262
2014-04-15 08:35:43 +00:00
Hans Wennborg
8f80ccc635
sanitizer_atomic_msvc.h: add atomic_fetch_{add,sub} overloads for uintptr_t
...
This should hopefully unbreak the MSVC build after r206178.
llvm-svn: 206200
2014-04-14 17:43:49 +00:00
Hans Wennborg
ec77f619bb
sanitizer_deadlock_detector.h: MSVC 2012 doesn't like compound literals
...
llvm-svn: 206199
2014-04-14 17:43:45 +00:00
Kostya Serebryany
bcfbea6d4e
[asan] added internal flag mmap_limit_mb
...
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany
f694ab1f18
[asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
...
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Dmitry Vyukov
b5eb8f0212
tsan: fix vector clocks
...
the new optimizations break when thread ids gets reused (clocks go backwards)
add the necessary tests as well
llvm-svn: 206035
2014-04-11 15:38:03 +00:00
Evgeniy Stepanov
652cbd7c15
[tsan] Fix false positive on xdr*_create.
...
llvm-svn: 206030
2014-04-11 12:29:24 +00:00
Evgeniy Stepanov
24c8d92fec
[sanitizer] Intercept a subset of sunrpc interface (xdr_*).
...
llvm-svn: 205627
2014-04-04 14:51:23 +00:00
Kostya Serebryany
9f20c9b17c
[asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
...
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Viktor Kutuzov
7fedc179d2
Add FreeBSD support to sanitizers' procmaps facilities
...
llvm-svn: 205291
2014-04-01 10:34:21 +00:00
Viktor Kutuzov
3ece65b894
Fix definition of the __sanitizer_passwd structure on FreeBSD
...
llvm-svn: 205290
2014-04-01 10:29:42 +00:00
Alexey Samsonov
78a8435fd6
[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
...
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.
llvm-svn: 205183
2014-03-31 13:45:36 +00:00
Kostya Serebryany
683d55f50e
[sanitizer] speed up the bitvector-based deadlock detector by ~15% (iterate over the currently held locks using the array, not the bitvector. Bitvector is not the best data structure to iterate over)
...
llvm-svn: 205168
2014-03-31 07:23:50 +00:00
Evgeniy Stepanov
6f34082590
[sanitizer] Fix Mac build.
...
llvm-svn: 205006
2014-03-28 14:01:40 +00:00
Evgeniy Stepanov
86a4d2c32b
[sanitizer] Intercept fgetpwent / fgetgrent.
...
These interceptors require deep unpoisoning of return values.
While at it, we do the same for all other pw/gr interceptors to
reduce dependency on libc implementation details.
llvm-svn: 205004
2014-03-28 13:03:55 +00:00
Evgeniy Stepanov
163ee4efb5
[sanitizer] Intercept setpwent/endpwent.
...
It's hard to write a reliable test for this code because they
work with unpredictable memory locations. But this change should
fix current failures in getpwent() tests on the sanitizer bots.
llvm-svn: 205002
2014-03-28 11:46:35 +00:00
Evgeniy Stepanov
92bee36b3e
[sanitizer] Intercept rand_r.
...
llvm-svn: 205001
2014-03-28 11:21:45 +00:00
Evgeniy Stepanov
74e77756ef
[sanitizer] Intercept getpwent/getgrent.
...
llvm-svn: 205000
2014-03-28 10:56:07 +00:00
Evgeniy Stepanov
2e972f63b5
[sanitizer] Intercept mktime.
...
llvm-svn: 204994
2014-03-28 09:02:57 +00:00
Evgeniy Stepanov
7b44e1ad42
[sanitizer] Intercept ftime.
...
llvm-svn: 204991
2014-03-28 08:33:32 +00:00
Evgeniy Stepanov
a6eb1bb59e
[sanitizer] Intercept __bzero on Mac.
...
This should make memset_test pass on Mac.
llvm-svn: 204929
2014-03-27 14:20:34 +00:00
Evgeniy Stepanov
1189734413
[sanitizer] Fix Android build.
...
llvm-svn: 204927
2014-03-27 14:06:15 +00:00
Evgeniy Stepanov
9dcd5a353a
[msan] Intercept several malloc-related functions.
...
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Kostya Serebryany
88d0eac412
[asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri Gribov
...
llvm-svn: 204897
2014-03-27 07:36:26 +00:00
Evgeniy Stepanov
16d89fc356
[sanitizer] Intercept __aeabi_mem(set|cpy|move).
...
llvm-svn: 204800
2014-03-26 12:14:34 +00:00
Alexey Samsonov
c41ca6d31a
[CMake] Rename the variable
...
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Timur Iskhodzhanov
59ce9e07a4
Fix a VS compile-time warning
...
warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
llvm-svn: 204597
2014-03-24 10:47:37 +00:00
Viktor Kutuzov
276fefb8d9
A fix for sanitizers' TLS support on FreeBSD
...
llvm-svn: 204595
2014-03-24 10:01:54 +00:00
Alexey Samsonov
1847401332
[CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
...
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Alexander Potapenko
25e204e194
[libsanitizer] Add descriptions for the common flags.
...
Use new(allocator_for_flags) instead of allocator_for_flags.Allocate()
Fix the description output format a bit.
llvm-svn: 204484
2014-03-21 17:28:12 +00:00
Kostya Serebryany
3df5d87da4
[sanitizer] print threads in deadlock report
...
llvm-svn: 204461
2014-03-21 13:00:18 +00:00
Greg Fitzgerald
8288afb5fe
fixed check_lint.sh in standalone build
...
Change-Id: I30d340bbe6b2028cc0f831399b62521912dcac60
llvm-svn: 204419
2014-03-21 00:45:21 +00:00
Alexander Potapenko
d23359c3e3
[libsanitizer] Implement IntrusiveList<T>::Iterator, use IntrusiveList in sanitizer_flags.cc
...
llvm-svn: 204342
2014-03-20 13:49:21 +00:00
Alexander Potapenko
1296436cbf
[libsanitizer] Introduce flag descriptions.
...
Extend ParseFlag to accept the |description| parameter, add dummy values for all existing flags.
As the flags are parsed their descriptions are stored in a global linked list.
The tool can later call __sanitizer::PrintFlagDescriptions() to dump all the flag names and their descriptions.
Add the 'help' flag and make ASan, TSan and MSan print the flags if 'help' is set to 1.
llvm-svn: 204339
2014-03-20 12:52:52 +00:00
Dmitry Vyukov
1af191e1f4
tsan: add test for second_deadlock_stack flag
...
llvm-svn: 204240
2014-03-19 15:00:38 +00:00
Kostya Serebryany
78f2e7bd62
[sanitizer] use some c++11 to simplify the code (we can now). Fix one place where a mutex acquisition stack trace was not properly remembered
...
llvm-svn: 204237
2014-03-19 14:19:31 +00:00
Alexey Samsonov
17703c1092
[CMake] Build sanitizer unit tests with -std=c++11
...
llvm-svn: 204234
2014-03-19 13:57:33 +00:00
Kostya Serebryany
2483acce21
[sanitizer] when recycling deadlock graph nodes, properly recycle edges
...
llvm-svn: 204233
2014-03-19 13:53:37 +00:00
Dmitry Vyukov
ecc3456fd6
tsan: fix copy-pasted comment
...
llvm-svn: 204231
2014-03-19 13:19:39 +00:00
Dmitry Vyukov
17efa197bf
tsan: fix large stack frame in deadlock detector
...
In member function 'virtual void __sanitizer::DD::MutexBeforeLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool)':
error: the frame size of 544 bytes is larger than 512 bytes [-Werror=frame-larger-than=]
The code is now [arguably] better as well.
llvm-svn: 204227
2014-03-19 12:49:46 +00:00
Kostya Serebryany
2ea796e05f
[sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
...
llvm-svn: 204225
2014-03-19 12:26:33 +00:00
Timur Iskhodzhanov
364b8b8fe5
[ASan] Print mmap errno/GetLastError in a readable and consistent way
...
Reviewed at http://llvm-reviews.chandlerc.com/D3107
llvm-svn: 204218
2014-03-19 08:23:00 +00:00
Sergey Matveev
34b26458cb
[sanitizer] Fix a bug in AdjustStackSize().
...
If the user requests OS default stack size, do not adjust it to our minimum
stack size (which is usually much less than the OS default).
llvm-svn: 204173
2014-03-18 19:48:48 +00:00
Dmitry Vyukov
c5b7c66bc3
tsan: fix malloc/munmap mismatch
...
llvm-svn: 204154
2014-03-18 14:28:17 +00:00
Dmitry Vyukov
3cd028c0b2
tsan: deadlock detector: add deadlock detector flags
...
the first flags is to enable printing of the second stack per edge
llvm-svn: 204150
2014-03-18 13:13:47 +00:00
Dmitry Vyukov
b72bc2ec9c
tsan: deadlock detector: print 2 stacks per deadlock edge
...
llvm-svn: 204149
2014-03-18 12:53:05 +00:00
Dmitry Vyukov
7fbceb2a3f
tsan: addrhashmap: fix bug with initialization of addresses in add array
...
llvm-svn: 204148
2014-03-18 12:52:11 +00:00
Alexey Samsonov
f88f317d35
Fix -Werror build
...
llvm-svn: 204139
2014-03-18 11:17:01 +00:00
Dmitry Vyukov
3458425d81
tsan: support up to 1<<20 mutexes in standalone deadlock detector
...
llvm-svn: 204127
2014-03-18 08:31:11 +00:00
Dmitry Vyukov
a3b21b1d14
tsan: better addr->object hashmap
...
still experimental
llvm-svn: 204126
2014-03-18 08:30:14 +00:00
Kostya Serebryany
e7846206e8
[sanitizer] fix the deadlock detector build
...
llvm-svn: 204044
2014-03-17 15:16:25 +00:00
Kostya Serebryany
f01c094cdd
[sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph)
...
llvm-svn: 204043
2014-03-17 14:56:04 +00:00
Kostya Serebryany
8976539627
[sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
...
llvm-svn: 204042
2014-03-17 14:41:36 +00:00
Kostya Serebryany
a0eb97a50b
[sanitizer] allow to store the lock context (stack trace id) with all currently held locks in a thread. This will allow the deadlock detector to provide better warnings (more changes to go)
...
llvm-svn: 204039
2014-03-17 12:27:42 +00:00
Kostya Serebryany
b9cb473fb8
[sanitizer] fix build warnings; add an output test for the deadlock detecor
...
llvm-svn: 204035
2014-03-17 09:21:41 +00:00
Kostya Serebryany
d674e6bdde
[sanitizer] print more stack traces when reporting a deadlock (even more to come)
...
llvm-svn: 204034
2014-03-17 09:07:24 +00:00
Dmitry Vyukov
3b37e8bf18
tsan: yet another attempt to fix pthread_cond interceptors
...
Make behavior introduced in r202820 conditional (under legacy_pthread_cond flag).
The new issue that we've hit with the satellite pthread_cond_t struct is
that pthread_condattr_getpshared does not work (satellite data is not shared between processes).
The idea is that most processes do not use pthread 2.2.5.
The rare ones that use (2.2.5 is dated by 2002) must specify legacy_pthread_cond=1
on their own risk.
llvm-svn: 204032
2014-03-17 07:51:53 +00:00
Kostya Serebryany
c98564c3aa
[sanitizer] make real_pthread_attr_getstack extern "C"
...
llvm-svn: 204029
2014-03-17 05:00:35 +00:00
Kostya Serebryany
8ecd7a2171
[sanitizer] fully implement racy fast path in bitset-based deadlock detector
...
llvm-svn: 203910
2014-03-14 09:22:01 +00:00
Kostya Serebryany
61a0f1c564
[sanitizer] partially implement racy fast path in bitset-based deadlock detector
...
llvm-svn: 203904
2014-03-14 08:06:15 +00:00
Kostya Serebryany
c067864b6f
[sanitizer] in bitset-based deadlock detector collect edge's stack trace when an edge is added to the graph (in following CLs these stack traces will be added to the report)
...
llvm-svn: 203902
2014-03-14 07:09:01 +00:00
Kostya Serebryany
65dbf46950
[sanitizer] in bitvector-based deadlock detector split onLock into onLockBefore and onLockAfter hooks
...
llvm-svn: 203796
2014-03-13 13:21:30 +00:00
Kostya Serebryany
de3f20cf4b
[sanitizer] support recursive rwlocks in bitset-based deadlock detector
...
llvm-svn: 203779
2014-03-13 10:26:03 +00:00
Alexey Samsonov
32956d651a
[CMake] Make append_if semantics similar to those used in LLVM
...
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Dmitry Vyukov
22196e777c
tsan: fix deadlock in deadlock detector
...
forget to unlock a mutex on one of the paths
llvm-svn: 203663
2014-03-12 14:55:20 +00:00
Timur Iskhodzhanov
c3687e7bf3
Fix MSVS warnings in the sanitizers RTL
...
llvm-svn: 203661
2014-03-12 14:09:25 +00:00
Dmitry Vyukov
8c0f86e307
tsan: fix handling of pthread_cond_wait in presence of pthread_cancel
...
if the thread is cancelled in pthread_cond_wait, it locks the mutex before
processing pthread_cleanup stack
but tsan was missing that, thus reporting false double-lock/wrong-unlock errors
see the test for details
llvm-svn: 203648
2014-03-12 09:48:14 +00:00
Hans Wennborg
9f74f15682
Revert "[asan] Make __cxa_demangle non-weak symbol on Android."
...
stlport doesn't include __cxa_demangle.
This reverts r201545.
llvm-svn: 203601
2014-03-11 20:23:59 +00:00
Evgeniy Stepanov
14cd8e900f
[sanitizer] Fix a typo.
...
llvm-svn: 203568
2014-03-11 13:35:41 +00:00
Alexey Samsonov
18adbc361a
Remove sanitizer_linux_libcdep.cc from TSan-Go build
...
llvm-svn: 203238
2014-03-07 13:17:32 +00:00
Alexey Samsonov
f3f3b9e5b6
[FreeBSD] Add support for sanitizer_linux_libcdep.cc
...
Patch by Viktor Kutuzov!
llvm-svn: 203235
2014-03-07 11:47:32 +00:00
Alexey Samsonov
78a6d2073f
[FreeBSD] Port sanitizers' syscalls.
...
Patch by Viktor Kutuzov!
llvm-svn: 203227
2014-03-07 10:03:54 +00:00
Dmitry Vyukov
f852f08fb1
tsan: fix pthread_cond_destroy interceptor on android
...
llvm-svn: 203226
2014-03-07 10:01:16 +00:00
Alexey Samsonov
fefeecc7b0
[ASan] Better way to disable tests for functions unavailable on certain platforms
...
llvm-svn: 203224
2014-03-07 09:39:01 +00:00
Evgeniy Stepanov
72a9d25060
[sanitizer] Simplify interceptors with user callbacks.
...
Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE.
Get rid of all the thread-local contexts in interceptors.
llvm-svn: 203119
2014-03-06 13:26:09 +00:00
Dmitry Vyukov
2516974e83
tsan: weaken concurrency guarantees in deadlock detector mutex hashmap
...
read locking on every access is too expensive
llvm-svn: 203112
2014-03-06 12:04:26 +00:00
Alexey Samsonov
d52b9ba38d
[FreeBSD] Enable procmaps on FreeBSD.
...
This is not the final patch for procmaps, but it's enough for building
sanitizers and tests on FreeBSD.
Patch by Viktor Kutuzov!
llvm-svn: 203099
2014-03-06 08:58:24 +00:00
Alexey Samsonov
e062e4c7eb
Enable memrchr interceptor only on Linux
...
llvm-svn: 202981
2014-03-05 14:07:19 +00:00
Dmitry Vyukov
792d4b1559
tsan: add missing header file to sanitizer_common cmake file
...
llvm-svn: 202979
2014-03-05 13:55:32 +00:00
Dmitry Vyukov
e73e0a04d7
tsan: fix deadlock detector build for SANITIZER_DEADLOCK_DETECTOR_VERSION=2
...
llvm-svn: 202977
2014-03-05 13:53:29 +00:00
Dmitry Vyukov
9b410fb627
tsan: implement new version of standalong deadlock detector
...
intercept pthread_cond (it is required to properly track state of mutexes)
detect cycles in mutex graph
llvm-svn: 202975
2014-03-05 13:41:21 +00:00
Dmitry Vyukov
cd3583a4c7
tsan: include what you use
...
VPrintf uses common_flags()
llvm-svn: 202974
2014-03-05 13:40:05 +00:00
Alexey Samsonov
6dece3c99f
Add common interceptors for memchr/memrchr
...
llvm-svn: 202972
2014-03-05 13:25:32 +00:00
Alexey Samsonov
c8c38dbb18
Increase threshold in StackTrace::LocatePcInTrace
...
llvm-svn: 202950
2014-03-05 08:29:56 +00:00
Dmitry Vyukov
30076b0244
tsan: add another missing windows atomic operation
...
llvm-svn: 202852
2014-03-04 14:21:42 +00:00
Dmitry Vyukov
0a650fe711
tsan: attempt to fix darwin build
...
everything except linux does not need this hackery with pthread_cond
llvm-svn: 202850
2014-03-04 14:16:28 +00:00
Alexey Samsonov
359c105c92
Fix StackTrace::LocatePcInTrace, add more unit tests for generic StackTrace
...
llvm-svn: 202849
2014-03-04 14:06:11 +00:00
Alexey Samsonov
d964e7cd81
[CMake] Test for libdl and libpthread presence
...
llvm-svn: 202847
2014-03-04 13:28:21 +00:00
Dmitry Vyukov
d1d8653742
tsan: add dynamic library target for standalone deadlock detector
...
it's LD_PRELOAD-able
llvm-svn: 202843
2014-03-04 12:52:20 +00:00
Alexey Samsonov
3e8467b8b9
Avoid doing any work when unwinding stack traces with 0 or 1 frame
...
llvm-svn: 202837
2014-03-04 12:21:28 +00:00
Dmitry Vyukov
9e3a217adb
tsan: fix windows build
...
llvm-svn: 202831
2014-03-04 11:57:25 +00:00
Dmitry Vyukov
54a0303fa8
tsan: add concurrent hashmap for standalone deadlock detector
...
llvm-svn: 202826
2014-03-04 11:39:56 +00:00
Dmitry Vyukov
e69df1f928
tsan: fix pthread_cond interceptors
...
currently tsan hangs when linked with a shared library linked against an old version of pthread
this change is another attempt to fix pthread_cond interceptors in different scenarios
see the comment for implementation details
llvm-svn: 202820
2014-03-04 11:11:40 +00:00
Dmitry Vyukov
975b02ad71
tsan: move all pthread_cond interceptors into sanitizer_common
...
llvm-svn: 202813
2014-03-04 10:17:40 +00:00
Alexey Samsonov
a7c602ac29
A set of trivial changes to support sanitizers on FreeBSD.
...
Patch by Viktor Kutuzov!
llvm-svn: 202801
2014-03-04 08:55:41 +00:00
Dmitry Vyukov
9cffc9550b
tsan: allow to force use of __libc_malloc in sanitizer_common
...
llvm-svn: 202504
2014-02-28 14:46:53 +00:00
Dmitry Vyukov
7210cdd473
tsan: add include guards
...
llvm-svn: 202503
2014-02-28 14:46:05 +00:00
Kostya Serebryany
eae464f911
[sanitizer] speedup deadlock detector for the case when we acquire the first lock in a thread
...
llvm-svn: 202492
2014-02-28 11:56:14 +00:00
Kostya Serebryany
afc4f2af76
[sanitizer] speedup deadlock detector for the case when we destroy a mutex that has never been locked
...
llvm-svn: 202487
2014-02-28 10:59:33 +00:00
Dmitry Vyukov
6cfab724ec
tsan: refactor deadlock detector
...
Introduce DDetector interface between the tool and the DD itself.
It will help to experiment with other DD implementation,
as well as reuse DD in other tools.
llvm-svn: 202485
2014-02-28 10:48:13 +00:00
Dmitry Vyukov
6403c34c2a
tsan: add new line at the end of error message
...
llvm-svn: 202470
2014-02-28 06:29:42 +00:00
Alexander Potapenko
e8c311a40c
[ASan] Make sure IOC_DIRMASK is undefined before redefining it.
...
llvm-svn: 202410
2014-02-27 16:46:06 +00:00
Dmitry Vyukov
d8c2fbd57f
tsan: another attempt to fix the tls_get_addr crash
...
llvm-svn: 202405
2014-02-27 15:07:45 +00:00
Dmitry Vyukov
46ebecc1fe
tsan: work around known bug in libstdc++
...
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
llvm-svn: 202403
2014-02-27 14:43:31 +00:00
Kostya Serebryany
2ff42d98fa
[sanitizer] do not acquire a global mutex in deadlock detector when dealing with Unlock (it is essentially a thread-local operation)
...
llvm-svn: 202401
2014-02-27 14:38:42 +00:00
Evgeniy Stepanov
037c271f41
[sanitizer] Fix iOS build.
...
llvm-svn: 202374
2014-02-27 10:09:21 +00:00
Evgeniy Stepanov
a16f327c27
[sanitizer] Sizes and layouts for sanitizers on FreeBSD.
...
Patch by Viktor Kutuzov.
llvm-svn: 202364
2014-02-27 09:02:08 +00:00
Evgeniy Stepanov
6edfad4811
[asan] Don't disable SEGV handler on Android by default.
...
This is done mostly for consistency, because this setting is normally overridden in cmake.
llvm-svn: 202359
2014-02-27 08:23:00 +00:00
Joerg Sonnenberger
9d09e2fe90
Reapply r201910. MSVC gets __func__ defined explicitly, even though it
...
can't build anything here.
llvm-svn: 202297
2014-02-26 20:33:22 +00:00
Alexey Samsonov
14e061d7cc
Support 'q' length modifier in scanf/printf interceptors
...
llvm-svn: 202268
2014-02-26 14:42:38 +00:00
Evgeniy Stepanov
f4dcf77623
[asan] Fix printing of long reports to logcat on Android.
...
__android_log_write has an implicit message length limit.
Print one line at a time.
llvm-svn: 202250
2014-02-26 09:39:55 +00:00
Evgeniy Stepanov
e23add20ae
[sanitizer] Add a flag to enable/disable report colorization.
...
llvm-svn: 202249
2014-02-26 09:06:59 +00:00
Richard Trieu
a170f08109
Remove 'tctx->name' from a logical statement since it is a pointer and always
...
is converted to a true value. Detected by Clang's improved -Wbool-conversion
llvm-svn: 202223
2014-02-26 03:12:51 +00:00
Alexey Samsonov
98aa08c0e9
Update sanitizers' bash scripts.
...
* Fix bash scripts to work on FreeBSD (patch by Viktor Kutuzov)
* Update locations of lit tests in check_lint script.
llvm-svn: 202145
2014-02-25 12:09:25 +00:00
Kostya Serebryany
11f4f30fa7
[sanitizer] add support for try_lock in deadlock detector
...
llvm-svn: 202120
2014-02-25 08:24:15 +00:00
Kostya Serebryany
6d54611fd4
[sanitizer] fix epoch handling in deadlock detector (before the fix, we could have had edges from locks in the previous epoch to locks in the current epoch)
...
llvm-svn: 202118
2014-02-25 07:34:41 +00:00
Kostya Serebryany
cf5d8e4f29
AdjustStackSizeLinux() is used in Lsan, Tsan and Msan non-Linux-specific code so it seems it should have more generic name and moved to a common scope.
...
Renamed to AdjustStackSize.
Patch by Viktor Kutuzov.
llvm-svn: 202011
2014-02-24 08:53:26 +00:00
Kostya Serebryany
04f2bf0f07
[sanitizer] Interception macros for sanitizers on FreeBSD; patch by Viktor Kutuzov
...
llvm-svn: 202009
2014-02-24 08:37:41 +00:00
Reid Kleckner
324eee45a7
Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."
...
This reverts commit r201910.
While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012. __FUNCTION__ may not be
standard, but it's *very* portable.
llvm-svn: 201916
2014-02-22 00:37:45 +00:00
Joerg Sonnenberger
b15779f307
Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
...
llvm-svn: 201910
2014-02-21 23:55:15 +00:00
Alexey Samsonov
35a66d15d4
Move config for sanitizer_common tests under test/ for consistency
...
llvm-svn: 201779
2014-02-20 12:18:08 +00:00
Alexey Samsonov
11705b2f10
[CMake] break dependency between unit tests and runtimes in standalone build
...
llvm-svn: 201778
2014-02-20 12:03:56 +00:00
Evgeniy Stepanov
cba008e9c5
[asan] A different way of detectinb stack overflow.
...
Instead of checking stack limits that are not well defined for the main thread,
we rely on siginfo::si_code and distance from SP.
llvm-svn: 201673
2014-02-19 13:40:41 +00:00
Alexey Samsonov
cd8535a96d
[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
...
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Kostya Serebryany
37ce26cb16
[sanitizer] when reporting a deadlock also report the lock cycle
...
llvm-svn: 201576
2014-02-18 14:56:19 +00:00
Kostya Serebryany
bd86a29a2a
[sanitizer] make sure the deadlock detector survives the change of epochs; add a test and a comment
...
llvm-svn: 201572
2014-02-18 13:41:49 +00:00
Evgeniy Stepanov
50bef914a6
[asan] Override default sigaltstack setting on Android.
...
Android libc always sets altstack on non-main threads, but it is too small for
our unwinder. With use_sigaltstack=1, override this setting with a larger one.
llvm-svn: 201557
2014-02-18 11:14:30 +00:00
Alexey Samsonov
63a4af7346
[CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.
...
llvm-svn: 201556
2014-02-18 09:33:45 +00:00
Alexey Samsonov
b73db72a17
[CMake] Simplify setting compile flag disabling RTTI
...
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Evgeniy Stepanov
2eea2850a4
[asan] Make __cxa_demangle non-weak symbol on Android.
...
This fixes global-demangle.cc test on Android.
https://code.google.com/p/address-sanitizer/issues/detail?id=264
llvm-svn: 201545
2014-02-18 07:34:52 +00:00
Alexey Samsonov
9a1ffce25a
[CMake] Simplify code for detecting/setting compiler flags
...
llvm-svn: 201543
2014-02-18 07:26:58 +00:00
Kostya Serebryany
6774f2241d
[sanitizer] add tests for DeadlockDetector, minor fix in onLock
...
llvm-svn: 201514
2014-02-17 14:57:49 +00:00
Kostya Serebryany
73325589dc
[sanitizer] implement node removal in Deadlock graph
...
llvm-svn: 201509
2014-02-17 11:21:52 +00:00
Kostya Serebryany
ec68429c5d
[sanitizer] simplify DeadlockDetectorTLS
...
llvm-svn: 201505
2014-02-17 08:47:48 +00:00
Kostya Serebryany
46177baddb
[sanitizer] add one more test for deadlock detection stuff
...
llvm-svn: 201503
2014-02-17 07:39:44 +00:00
Evgeniy Stepanov
a21280307f
[sanitizer] Fix getpwuid_r (and similar) interceptors missing one of the arguments.
...
llvm-svn: 201410
2014-02-14 12:32:15 +00:00
Kostya Serebryany
e233d8618d
[sanitizer] add iterators to bit vectors; make bit vector operations use little stack; add common flag 'detect_deadlocks'
...
llvm-svn: 201405
2014-02-14 12:08:23 +00:00
Evgeniy Stepanov
05938a23f5
[sanitizer] Use mmap to zero-fill large shadow regions.
...
This is covered by existing ASan test.
This does not change anything for TSan by default (but provides a flag to
change the threshold size).
Based on a patch by florent.bruneau here:
https://code.google.com/p/address-sanitizer/issues/detail?id=256
llvm-svn: 201400
2014-02-14 11:41:26 +00:00
Alexey Samsonov
81a2b466e9
Move shared configs for lit test suites to test/ and unittests/ directories
...
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Alexander Potapenko
0b28ea9c47
[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods
...
(needed for SEGV handling in sanitizer_common)
llvm-svn: 201392
2014-02-14 08:59:42 +00:00
Kostya Serebryany
efe2f7e2c8
[sanitizer] replace MostSignificantSetBitIndex with LeastSignificantSetBitIndex in bit vector (to iterate bits in increasing order)
...
llvm-svn: 201339
2014-02-13 15:59:00 +00:00
Kostya Serebryany
67d419736a
[sanitizer] optimize TwoLevelBitVector::intersectsWith, extend tests, fix a check
...
llvm-svn: 201338
2014-02-13 15:45:20 +00:00
Evgeniy Stepanov
8978389a32
[asan] Enable SEGV handler on Android by default.
...
Seems stable enough.
Fixes null_deref.cc test.
llvm-svn: 201326
2014-02-13 13:43:47 +00:00
Evgeniy Stepanov
3bec7a9c77
[sanitizer] Fix off-by-one-line in SEGV reports on Android.
...
This will be covered by null_deref.cc test (requires one more fix to pass).
llvm-svn: 201325
2014-02-13 13:32:24 +00:00
Kostya Serebryany
07526fb4a0
[sanitizer] address some of the dvyukov's comments on previous commits
...
llvm-svn: 201322
2014-02-13 12:39:21 +00:00
Kostya Serebryany
f6cb35abb4
[sanitizer] findPath for deadlock detector
...
llvm-svn: 201306
2014-02-13 09:52:15 +00:00
Evgeniy Stepanov
14ca0627d5
[asan] Avoid deadlock in CovDump.
...
llvm-svn: 201304
2014-02-13 08:50:36 +00:00
Kostya Serebryany
c98ce28533
[sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan Roux
...
llvm-svn: 201303
2014-02-13 07:50:20 +00:00