Hans Wennborg
a2d4b09a55
Revert "[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore" (r215708)
...
This is still needed for VS2012.
llvm-svn: 215930
2014-08-18 19:55:35 +00:00
Timur Iskhodzhanov
cc01fad1d9
[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore
...
llvm-svn: 215708
2014-08-15 13:45:23 +00:00
Alexey Samsonov
34e2b280da
[TSan] Share the code the setup code calling getrlim/setrlim with sanitizer_common
...
llvm-svn: 215481
2014-08-12 22:31:19 +00:00
Alexey Samsonov
d2d2457823
[Sanitizer] Make disable_coredump a common flag and use it in TSan
...
llvm-svn: 215479
2014-08-12 22:07:48 +00:00
Alexey Samsonov
408d2152c4
Fixup Android tests build rules
...
llvm-svn: 215264
2014-08-09 00:23:11 +00:00
Timur Iskhodzhanov
255958391d
[ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails
...
llvm-svn: 215203
2014-08-08 13:25:55 +00:00
Viktor Kutuzov
7a27160780
Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
...
Differential Revision: http://reviews.llvm.org/D4807
llvm-svn: 215185
2014-08-08 06:21:09 +00:00
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
Kostya Serebryany
5e52d48e3a
[sanitizer] more code for deadlock detector, nothing really works yet (except for small unit tests).
...
llvm-svn: 201302
2014-02-13 07:44:51 +00:00
Sergey Matveev
2a01b2f86f
[sanitizer] Intercept capget()/capset().
...
Also, fix incorrect syscall hooks for the corresponding syscalls.
llvm-svn: 201252
2014-02-12 19:29:49 +00:00
Evgeniy Stepanov
8ab205fb74
[asan] Handle OpenFile errors in CovDump.
...
llvm-svn: 201240
2014-02-12 15:29:22 +00:00
Evgeniy Stepanov
254c7636cf
[sanitizer] Fix wait4 interceptor on Android.
...
It's called __wait4 there.
llvm-svn: 201235
2014-02-12 13:05:17 +00:00
Kostya Serebryany
be1d22b631
[sanitizer] added class BVGraph, to be used in a deadlock detector; added more methods to the bit vectors
...
llvm-svn: 201226
2014-02-12 11:28:09 +00:00
Alexey Samsonov
7304b4201f
[Sanitizer] Teach external symbolizer to work with addr2line if llvm-symbolizer is unavailable. Allow this mode in TSan.
...
llvm-svn: 201218
2014-02-12 08:29:42 +00:00
Alexey Samsonov
167c15a98f
[Sanitizer] Build sanitizer_common with -Wframe-larger-than=512 flag
...
llvm-svn: 201213
2014-02-12 07:26:40 +00:00
Alexey Samsonov
7e97768f2f
[Sanitizer] Reduce stack frame size of SlowUnwindStackWithContext
...
llvm-svn: 201212
2014-02-12 07:24:11 +00:00
Kostya Serebryany
083d657845
[sanitizer] added a bit vector class to be used in a deadlock detector
...
llvm-svn: 201210
2014-02-12 07:05:24 +00:00
Evgeniy Stepanov
e5a447d947
[asan] Fix Windows build.
...
llvm-svn: 201154
2014-02-11 13:57:17 +00:00
Evgeniy Stepanov
2629e575db
[sanitizer] Fix build.
...
llvm-svn: 201152
2014-02-11 13:45:01 +00:00
Evgeniy Stepanov
769d46f373
[sanitizer] Use system unwinder in signal handlers on Android.
...
Because of the way Bionic sets up signal stack frames, libc unwinder is unable
to step through it, resulting in broken SEGV stack traces.
Luckily, libcorkscrew.so on Android implements an unwinder that can start with
a signal context, thus sidestepping the issue.
llvm-svn: 201151
2014-02-11 13:38:57 +00:00
Alexey Samsonov
ca183eed55
[Sanitizer] External symbolizer refactoring: split protocol for communicating with
...
llvm-symbolizer binary and external process handling into separate classes.
No functionality change.
llvm-svn: 201150
2014-02-11 13:03:09 +00:00
Evgeniy Stepanov
791a7e1603
[msan] Return EINVAL instead of crashing from mmap of an invalid address.
...
llvm-svn: 201074
2014-02-10 09:37:03 +00:00
Alexey Samsonov
adcf48fa35
[Sanitizer] Don't #include the same system header twice.
...
llvm-svn: 201071
2014-02-10 08:57:28 +00:00
Evgeniy Stepanov
d1e68a5ce1
[sanitizer] Disable 3 more syscall hooks on Android.
...
llvm-svn: 201070
2014-02-10 08:35:58 +00:00
Evgeniy Stepanov
c75ef739a1
[sanitizer] struct ustat and a bunch of other definitions are missing on Android.
...
llvm-svn: 201068
2014-02-10 08:00:24 +00:00
Nick Lewycky
af2064f7ab
Add throw() specifiers to more redeclarations of operator delete and operator delete[].
...
llvm-svn: 201016
2014-02-08 01:42:08 +00:00
Sergey Matveev
4a03fa4f60
[sanitizer] Intercept if_indextoname() and if_nametoindex().
...
llvm-svn: 200945
2014-02-06 20:39:33 +00:00
Sergey Matveev
f3a8acf38a
[sanitizer] Fix build.
...
llvm-svn: 200942
2014-02-06 19:36:10 +00:00
Sergey Matveev
544d07f861
[sanitizer] One does not simply intercept getifaddrs().
...
Upgrade the interceptor, and attempt to fix the Android build.
llvm-svn: 200936
2014-02-06 18:48:23 +00:00
Sergey Matveev
07802a090a
[sanitizer] Intercept getifaddrs().
...
llvm-svn: 200926
2014-02-06 17:42:36 +00:00
Sergey Matveev
0c62992d6e
[sanitizer] Intercept getresuid and getresgid.
...
llvm-svn: 200925
2014-02-06 15:12:56 +00:00
Dmitry Vyukov
a5d1fcfde1
tsan: improve error message for Go
...
llvm-svn: 200914
2014-02-06 09:22:29 +00:00
Sergey Matveev
efefe5e225
[sanitizer] Fix build.
...
llvm-svn: 200873
2014-02-05 20:04:12 +00:00
Sergey Matveev
c5c84a1d86
[sanitizer] Implement ioctl decoding.
...
When an unknown ioctl is encountered, try to guess the parameter size from the
request id.
llvm-svn: 200872
2014-02-05 19:35:24 +00:00
Kostya Serebryany
9ebd483017
[sanitizer] hide two functions in the __sanitizer namespace to avoid exporting them (gold complained)
...
llvm-svn: 200844
2014-02-05 15:06:32 +00:00
Timur Iskhodzhanov
aeefb6abce
[ASan/Win] Fall back to stdout if we can't print the reports to stderr
...
llvm-svn: 200804
2014-02-04 23:28:30 +00:00
Dmitry Vyukov
a538aac8ce
tsan: fix windows build
...
llvm-svn: 200778
2014-02-04 17:27:29 +00:00
Alexander Potapenko
2e7dc60ee3
[ASan] Replace the call to "vname" with "WRAP(vname)" in FORMAT_INTERCEPTOR_IMPL
...
It's incorrect to call the function by its name in the interceptor, because that means WRAP(vname) on Linux and REAL(vname) on OSX.
This patch fixes asan/lit_tests/TestCases/printf-3.c on Mac.
llvm-svn: 200749
2014-02-04 09:35:09 +00:00
Kostya Serebryany
f6e085cf89
[sanitizer] make __tls_get_addr interceptor (more) AS-safe. No good test so far, will keep trying.
...
llvm-svn: 200734
2014-02-04 05:22:00 +00:00
Kostya Serebryany
51f135d820
[sanitizer] Handle TLS sizes for glibc < 2.13; As discussed in http://gcc.gnu.org/PR60038 , the hardcoded sizeof(struct thread); patch by Jakub Jelinek
...
llvm-svn: 200733
2014-02-04 04:09:38 +00:00
Alexander Potapenko
f6ff6b0929
[libsanitizer] Workaround for https://code.google.com/p/address-sanitizer/issues/detail?id=261
...
If pthread_get_stacksize_np() returns 512K for the main thread on Mavericks, obtain the stack size from the current stack rlimit.
llvm-svn: 200703
2014-02-03 16:42:29 +00:00
Alexander Potapenko
8d58767b34
[libsanitizer] Follow-up for r200700: add the new header to CMakeLists.txt and make it empty on non-Mac.
...
llvm-svn: 200701
2014-02-03 15:45:03 +00:00
Alexander Potapenko
768e315a74
[ASan] Move GetMacosVersion() to sanitizer_common.
...
llvm-svn: 200700
2014-02-03 15:32:19 +00:00
Sergey Matveev
c18b36625e
[sanitizer] Partial revert of recent ioctl changes.
...
Some build environments are missing the required headers.
This reverts r200544, r200547, r200551. This does not revert the change that
introduced READWRITE ioctl type.
llvm-svn: 200567
2014-01-31 19:19:45 +00:00
Alexander Potapenko
ea4a0dbb8d
[ASan] Implement __sanitizer::InstallDeadlySignalHandlers() and __asan::AsanOnSIGSEGV() on Windows.
...
llvm-svn: 200554
2014-01-31 15:11:11 +00:00
Evgeniy Stepanov
a78dbe2e6f
[asan] Fix Android build.
...
llvm-svn: 200551
2014-01-31 14:46:37 +00:00
Evgeniy Stepanov
01cd8ae204
[asan] Read extra flags from a system property on activation on Android.
...
llvm-svn: 200550
2014-01-31 14:36:55 +00:00
Alexander Potapenko
36b18dfe64
[libsanitizer] Fix compilation for gotsan.
...
llvm-svn: 200549
2014-01-31 14:30:12 +00:00
Sergey Matveev
dffda4cfec
[sanitizer] Attempt to fix Android build.
...
llvm-svn: 200547
2014-01-31 14:28:32 +00:00
Sergey Matveev
6b3397546e
[sanitizer] Support most ioctls from /usr/include/sound/.
...
llvm-svn: 200544
2014-01-31 14:02:21 +00:00
Alexander Potapenko
789e3e1b7c
[ASan] Move the SIGSEGV/SIGBUS handling to sanitizer_common
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
This particular CL moves InstallSignalHandlers() into sanitizer_common (making it InstallDeadlySignalHandlers()), but doesn't enable default signal handlers for any tool other than ASan.
llvm-svn: 200542
2014-01-31 13:10:07 +00:00
Alexander Potapenko
e925e53114
Fix compilation: don't convert NULL to a pointer-incompatible type.
...
llvm-svn: 200536
2014-01-31 11:44:15 +00:00
Alexander Potapenko
d5802fe548
Make signal-related functions use __sanitizer_* structures instead of __sanitizer_kernel_* ones.
...
Also rename internal_sigaction() into internal_sigaction_norestorer(), as this function doesn't fully
implement the sigaction() functionality on Linux.
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200535
2014-01-31 11:29:51 +00:00
Dmitry Vyukov
e63a09adb6
tsan: fix Go build
...
Go linker does not like function-static objects.
llvm-svn: 200534
2014-01-31 11:20:55 +00:00
Timur Iskhodzhanov
00aa75b774
Move /FS to SANITIZER_COMMON_CFLAGS
...
llvm-svn: 200485
2014-01-30 19:48:13 +00:00
Timur Iskhodzhanov
272502656e
Add an /FS flag to the sanitizer_common CMake to make it buildable with VS2013
...
llvm-svn: 200480
2014-01-30 18:56:06 +00:00
Evgeniy Stepanov
3f6af151df
[sanitizer] Fix typo that breaks shmctl() interceptor.
...
https://code.google.com/p/address-sanitizer/issues/detail?id=259
llvm-svn: 200468
2014-01-30 14:31:26 +00:00
Sergey Matveev
be68311660
[msan] Intercept *getxattr and *listxattr.
...
llvm-svn: 200464
2014-01-30 12:21:12 +00:00
Kostya Serebryany
b22298af9a
[asan] re-enable __tls_get_addr interceptor with a proper fix (use __attribute__((tls_model(initial-exec))))
...
llvm-svn: 200463
2014-01-30 09:25:48 +00:00
Kostya Serebryany
409d26ac5e
[asan] disable __tls_get_addr interceptor while I am investigating why it causes trouble; few more debugging
...
llvm-svn: 200462
2014-01-30 09:00:42 +00:00
Kostya Serebryany
cda06acd31
[asan] fix build on Mac (hopefully)
...
llvm-svn: 200386
2014-01-29 10:26:38 +00:00
Kostya Serebryany
71788fac2a
[asan] experimental intercetor for __tls_get_addr. So far it does nothing interesting, actual usage will come later. See https://groups.google.com/forum/#!topic/address-sanitizer/BfwYD8HMxTM for background
...
llvm-svn: 200384
2014-01-29 09:29:16 +00:00
Alexander Potapenko
b0930f5c04
[ASan] Reinstate ASAN_LOW_MEMORY, which has nothing to do with signal handling and thus should not be moved to common.
...
llvm-svn: 200319
2014-01-28 14:17:16 +00:00
Alexander Potapenko
31e24962f4
[ASan] Remove an accidentally added include of signal.h
...
llvm-svn: 200318
2014-01-28 14:10:06 +00:00
Alexander Potapenko
d8d490ed50
[ASan] Move the sigaltstack() bits to sanitizer_common.
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
Note that this particular change doesn't enable use_sigaltstack support in every tool.
llvm-svn: 200310
2014-01-28 11:12:29 +00:00
Alexander Potapenko
cf4bef3161
[ASan] Move the signal handling-related flags to sanitizer_common.
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200295
2014-01-28 09:28:57 +00:00
Kostya Serebryany
7fe86589f1
[sanitizer] revert r200197: the buggy kernel ( https://bugzilla.kernel.org/show_bug.cgi?id=67651 ) is almost unusable with asan even with this workaround (too slow), so this workaround makes no sense. The asan/msan bootstrap bot was changed to use a non-buggy kernel
...
llvm-svn: 200217
2014-01-27 13:05:09 +00:00
Evgeniy Stepanov
067f54718f
[msan] Disable mmap outside of application address range.
...
llvm-svn: 200200
2014-01-27 09:12:22 +00:00
Kostya Serebryany
0a5049b780
[sanitizer] increase the mmap granularity in sanitizer allocator from 2^16 to 2^18. This is a partial workaround for the fresh Kernel bug https://bugzilla.kernel.org/show_bug.cgi?id=67651
...
llvm-svn: 200197
2014-01-27 07:35:32 +00:00
Dmitry Vyukov
16e7a758b0
tsan: do not deadlock on fork
...
Currently correct programs can deadlock after fork, because atomic operations and async-signal-safe calls are not async-signal-safe under tsan.
With this change:
- if a single-threaded program forks, the child continues running with verification enabled (the tsan background thread is recreated as well)
- if a multi-threaded program forks, then the child runs with verification disabled (memory accesses, atomic operations and interceptors are disabled); it's expected that it will exec soon anyway
- if the child tries to create more threads after multi-threaded fork, the program aborts with error message
- die_after_fork flag is added that allows to continue running, but all bets are off
http://llvm-reviews.chandlerc.com/D2614
llvm-svn: 199993
2014-01-24 12:33:35 +00:00
Alexey Samsonov
1d028b8a9f
[Sanitizer] Fix false positive in snprintf interceptor - take the number of actually written symbols from real snprintf call.
...
llvm-svn: 199899
2014-01-23 15:09:38 +00:00
Alexey Samsonov
902bb51612
[Sanitizer] Fix false positive in printf interceptors: properly handle precision for %s
...
llvm-svn: 199895
2014-01-23 14:35:28 +00:00
Evgeniy Stepanov
350fe4b1af
[asan] Android logging.
...
This change duplicates all ASan output to system log on Android.
llvm-svn: 199887
2014-01-23 11:34:41 +00:00
Evgeniy Stepanov
6975704f62
[sanitizer] Replace inline with INLINE.
...
llvm-svn: 199883
2014-01-23 11:22:04 +00:00
Evgeniy Stepanov
04c5a836a2
[sanitizer] Add a sanity check.
...
llvm-svn: 199880
2014-01-23 11:01:07 +00:00
Evgeniy Stepanov
43d1888285
[sanitizer] Fix format string mismatches found by format attributes added in r199874.
...
llvm-svn: 199879
2014-01-23 10:57:08 +00:00
Evgeniy Stepanov
29b7866c6c
[sanitizer] Add printf format attributes.
...
These were lost in a refactoring a long time ago.
llvm-svn: 199874
2014-01-23 08:58:34 +00:00
Dmitry Vyukov
db1ad12ae2
asan: fix atomic operations on ARM
...
implement correct atomic load/store for ARM
add test for atomic load/store
http://llvm-reviews.chandlerc.com/D2582
llvm-svn: 199802
2014-01-22 14:13:37 +00:00
Alexey Samsonov
8c03475f01
[Sanitizer] try harder to fix Werror build break after r199729
...
llvm-svn: 199736
2014-01-21 13:06:38 +00:00
Alexey Samsonov
39dbd7cc2c
[Sanitizer] Update file names now that we intercept both scanf and printf
...
llvm-svn: 199735
2014-01-21 13:01:20 +00:00
Alexey Samsonov
20494ca293
Fix unused function warning from r199729
...
llvm-svn: 199730
2014-01-21 12:16:19 +00:00
Alexey Samsonov
00cd273c46
Sanitize printf functions.
...
Intercept and sanitize arguments passed to printf functions in ASan and TSan
(don't do this in MSan for now). The checks are controlled by runtime flag
(off by default for now).
Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov!
llvm-svn: 199729
2014-01-21 11:58:33 +00:00
Evgeniy Stepanov
e676aadecf
[asan] Enable frame pointer based unwinder on ARM.
...
This code works with AAPCS-style {fp, lr} frames. Unlike linux perf, it does
not unwind through code compiled with -mapcs-frame (which Clang does not
support anyway).
llvm-svn: 199725
2014-01-21 11:04:58 +00:00
Alexey Samsonov
0714b7b31b
[Sanitizer] Support %.*s in internal printf implementation. Patch by Yuri Gribov.
...
llvm-svn: 199724
2014-01-21 10:59:44 +00:00
Kostya Serebryany
714c67c31e
[asan] extend asan-coverage (still experimental).
...
- add a mode for collecting per-block coverage (-asan-coverage=2).
So far the implementation is naive (all blocks are instrumented),
the performance overhead on top of asan could be as high as 30%.
- Make sure the one-time calls to __sanitizer_cov are moved to function buttom,
which in turn required to copy the original debug info into the call insn.
Here is the performance data on SPEC 2006
(train data, comparing asan with asan-coverage={0,1,2}):
asan+cov0 asan+cov1 diff 0-1 asan+cov2 diff 0-2 diff 1-2
400.perlbench, 65.60, 65.80, 1.00, 76.20, 1.16, 1.16
401.bzip2, 65.10, 65.50, 1.01, 75.90, 1.17, 1.16
403.gcc, 1.64, 1.69, 1.03, 2.04, 1.24, 1.21
429.mcf, 21.90, 22.60, 1.03, 23.20, 1.06, 1.03
445.gobmk, 166.00, 169.00, 1.02, 205.00, 1.23, 1.21
456.hmmer, 88.30, 87.90, 1.00, 91.00, 1.03, 1.04
458.sjeng, 210.00, 222.00, 1.06, 258.00, 1.23, 1.16
462.libquantum, 1.73, 1.75, 1.01, 2.11, 1.22, 1.21
464.h264ref, 147.00, 152.00, 1.03, 160.00, 1.09, 1.05
471.omnetpp, 115.00, 116.00, 1.01, 140.00, 1.22, 1.21
473.astar, 133.00, 131.00, 0.98, 142.00, 1.07, 1.08
483.xalancbmk, 118.00, 120.00, 1.02, 154.00, 1.31, 1.28
433.milc, 19.80, 20.00, 1.01, 20.10, 1.02, 1.01
444.namd, 16.20, 16.20, 1.00, 17.60, 1.09, 1.09
447.dealII, 41.80, 42.20, 1.01, 43.50, 1.04, 1.03
450.soplex, 7.51, 7.82, 1.04, 8.25, 1.10, 1.05
453.povray, 14.00, 14.40, 1.03, 15.80, 1.13, 1.10
470.lbm, 33.30, 34.10, 1.02, 34.10, 1.02, 1.00
482.sphinx3, 12.40, 12.30, 0.99, 13.00, 1.05, 1.06
llvm-svn: 199488
2014-01-17 11:00:30 +00:00
Alexey Samsonov
a64851bccb
[Sanitizer] Remove empty method
...
llvm-svn: 199481
2014-01-17 08:39:05 +00:00
Alexey Samsonov
4d075df406
[Sanitizer] Add basic support for using libbacktrace in symbolizer.
...
This change allows to compile sanitizer sources so that *san runtime
will attempt to use libbacktrace and/or libiberty for symbolization
(instead of communicating with llvm-symbolizer).
I've tested this patch by manually defining SANITIZER_LIBBACKTRACE and/or
SANITIZER_CP_DEMANGLE, linking with necessary libraries and verifying that
all tests from ASan test suite work.
Based on patches by Jakub Jelinek!
llvm-svn: 199384
2014-01-16 13:48:15 +00:00
Kostya Serebryany
47d5569de1
[asan] Include <sys/stat.h> if __x86_64__ is defined
...
struct stat defined in <asm/stat.h> is incorrect for x32. <asm/stat.h>
is included to get struct __old_kernel_stat. But struct __old_kernel_stat
isn't used for x86-64 nor x32. This patch includes <sys/stat.h> instead
of <asm/stat.h> and comments out size check of struct __old_kernel_stat
for x86-64.
Patch by H.J. Lu
llvm-svn: 199192
2014-01-14 07:38:53 +00:00
Kostya Serebryany
d651412cd4
[asan] fix the ppc32 build (by Jakub Jelinek). Note that the LLVM build still builds only for 64-bit PowerPC, and not for 32-bit
...
llvm-svn: 199090
2014-01-13 10:19:12 +00:00
Dmitry Vyukov
5b57ea7a24
tsan: fix Go build
...
Currently fails with:
gotsan.cc:7686:40: error: the address of 'int __sanitizer_pthread_attr_getstack(void*, void**, size_t*)' will always evaluate as 'true' [-Werror=address]
llvm-svn: 198261
2013-12-31 09:38:23 +00:00
Chandler Carruth
a989fb5ce7
Fix an ODR violation in the sanitizer runtimes.
...
A helper function is a C++ function, and so even though one of the two
definitions is weak, it still technically triggers the ODR. Perhaps
these two definitions are ODR equivalent, but I'm not even confident in
that.
Instead, just define the function once, declare it as weak, and use
a wrapper that is clearly file-local. This avoids two definitions. Also
make the function extern "C" so that we can't even mess up the type
signature somehow or otherwise fail to match up the weak declaration
here with the interceptor defined elsewhere.
llvm-svn: 198253
2013-12-30 23:36:11 +00:00
Alexander Potapenko
79bb924e17
[libsanitizer] fix lint errors
...
llvm-svn: 198209
2013-12-30 11:12:11 +00:00
Alexander Potapenko
e93e87369f
[libsanitizer] Remove the redundant spaces between '#' and 'define'.
...
These definitions weren't included in any #ifdef blocks, and the spaces were placed inconsistently.
llvm-svn: 198207
2013-12-30 09:22:06 +00:00
Kostya Serebryany
2b5fddbc75
[asan] allow asan to use SizeClassAllocator32 on a 64-bit platform (if SANITIZER_CAN_USE_ALLOCATOR64=0). No functionality change by default is intended
...
llvm-svn: 198044
2013-12-26 13:52:38 +00:00
Alexey Samsonov
23347de6ef
[Sanitizer] Add Symbolizer::GetModuleNameAndOffsetForPC() and use it in LSan suppression matching.
...
This allows us to avoid retrieving file/line info for suppressed modules.
llvm-svn: 198025
2013-12-25 20:15:46 +00:00
Alexey Samsonov
782ad0eb71
[Sanitizer] Remove now unused symbolization functionality from MemoryMappingLayout
...
llvm-svn: 198014
2013-12-25 12:11:06 +00:00
Alexey Samsonov
5746c07629
[Sanitizer] Use different MemoryMappingLayout::DumpListOfModules on Linux and Mac.
...
Make a unit test added in r198004 more robust.
llvm-svn: 198012
2013-12-25 11:29:19 +00:00
Alexey Samsonov
bf658026c1
[Sanitizer] Properly specify linux-only unit test.
...
llvm-svn: 198007
2013-12-25 09:31:42 +00:00
Alexey Samsonov
ca7a213118
[Sanitizer] Don't use MemoryMappingLayout in StackTrace::PrintStack - it is now a responsibility of Symbolizer class.
...
llvm-svn: 198006
2013-12-25 09:29:54 +00:00
Alexey Samsonov
64ffa598ce
[Sanitizer] Teach MemoryMappingLayout to dump all loaded modules.
...
Use this to implement GetListOfModules() on Mac and on Android
(on Linux we use dl_iterate_phdr).
llvm-svn: 198004
2013-12-25 08:39:38 +00:00
Alexey Samsonov
2f392d237c
[Sanitizer] Move OS-specific code for MemoryMappingLayout into separate source files.
...
llvm-svn: 198003
2013-12-25 08:01:16 +00:00
Alexey Samsonov
6322e036aa
[Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
...
Remove now redundant checks in symbolizer initialization in TSan and MSan.
llvm-svn: 198000
2013-12-25 07:09:44 +00:00
Evgeniy Stepanov
3d0edea4e1
[sanitizer] Add missing file comment.
...
llvm-svn: 197807
2013-12-20 13:13:49 +00:00
Evgeniy Stepanov
66297cac72
[msan] Wrap indirect calls to REAL(x) in interceptors.
...
llvm-svn: 197806
2013-12-20 12:20:15 +00:00
Evgeniy Stepanov
61628196e4
[msan] Replace wrap_indirect_calls runtime flag with an interface method.
...
llvm-svn: 197799
2013-12-20 11:05:19 +00:00
Alexey Samsonov
f2c7659cf8
[ASan] Get rid of ASan-specific functions for printing stack traces
...
llvm-svn: 197672
2013-12-19 11:25:05 +00:00
Alexey Samsonov
3efe401db0
[Sanitizer] Delete unused StackTrace::PrintStack argument
...
llvm-svn: 197671
2013-12-19 11:14:26 +00:00
Timur Iskhodzhanov
caf7c0cdcd
[Sanitizers] Fix CL compile-time warning in the symbolizer
...
llvm-svn: 197573
2013-12-18 14:39:23 +00:00
Timur Iskhodzhanov
1c84bd64db
[Sanitizer] Implement Symbolizer class on Windows
...
llvm-svn: 197571
2013-12-18 14:29:16 +00:00
Timur Iskhodzhanov
b5f983e4b0
[Sanitizers] Rename Symbolizer::SymbolizeCode to Symbolizer::SymbolizePC
...
llvm-svn: 197569
2013-12-18 14:17:39 +00:00
Alexey Samsonov
33a2cc1e10
Fix gen_dynamic_list.py for Python 3. Patch by Marcoen Hirschberg.
...
llvm-svn: 197493
2013-12-17 12:19:16 +00:00
Alexey Samsonov
25d010a98d
[Sanitizer] Always initialize a Symbolizer (even if 'symbolize' is false).
...
If 'symbolize' flag is not set, we still want to transform virtual address
to module+offset pair in the call to Symbolizer::SymbolizeCode().
See https://code.google.com/p/address-sanitizer/issues/detail?id=251 for
more details.
llvm-svn: 197491
2013-12-17 11:15:39 +00:00
Evgeniy Stepanov
59bb0878e2
[msan] Tweak gethostbyname_r interceptor some more.
...
This is covered by msan_test depending on glibc version and/or resolver setup.
llvm-svn: 197484
2013-12-17 09:13:54 +00:00
Evgeniy Stepanov
43fc44007d
[msan] Fix gethostbyname_r and similar interceptors.
...
*h_errno is written not on success, but on failure.
In fact, it seems like it can be written even when return value signals
success, so we just unpoison it in all cases.
llvm-svn: 197383
2013-12-16 13:24:33 +00:00
Kostya Serebryany
57bfdb080b
[asan] add flag uar_noreserve to use noreserve mmap for fake stack. uar_noreserve=1 will save some memory but also negatively affect performance
...
llvm-svn: 197233
2013-12-13 15:03:49 +00:00
Evgeniy Stepanov
a643a754be
[sanitizer] Disable call wrapping when building for Go.
...
llvm-svn: 197232
2013-12-13 14:58:21 +00:00
Evgeniy Stepanov
879c552dd9
[msan] Wrap indirect calls from sanitizer rtl when running under DR.
...
llvm-svn: 197226
2013-12-13 13:13:46 +00:00
Timur Iskhodzhanov
89a346c2a1
[ASan] Fix StackTrace::SlowUnwindStack on Windows
...
llvm-svn: 196894
2013-12-10 08:30:39 +00:00
Chandler Carruth
3f697191bb
Revert a final patch that was committed without the author contributing
...
it to the LLVM project through the appropriate channels.
This reverts:
r195837: "[Sanitizer] Add rudimentary support for using libbacktrace in ..."
llvm-svn: 196875
2013-12-10 04:40:39 +00:00
Richard Smith
ab788cdc81
Unbreak build by adding an implementation of PopStackFrames function.
...
llvm-svn: 196809
2013-12-09 19:52:39 +00:00
Chandler Carruth
736f9fd229
Revert three patches which were committed without explicit contribution
...
by their authors.
This may break builds where others added code relying on these patches,
but please *do not* revert this commit. Instead, we will prepare patches
which fix the failures.
Reverts the following commits:
r168306: "[asan] support x32 mode in the fast stack unwinder. Patch by H.J. Lu"
r168356: "[asan] more support for powerpc, patch by Peter Bergner"
r196489: "[sanitizer] fix the ppc32 build (patch by Jakub Jelinek)"
llvm-svn: 196802
2013-12-09 19:25:51 +00:00
Alexey Samsonov
9f6218bf44
PR17977: don't assume EOWNERDEAD is always defined
...
Summary: See details in http://llvm.org/bugs/show_bug.cgi?id=17977
Reviewers: dvyukov
Reviewed By: dvyukov
CC: glider, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2340
llvm-svn: 196779
2013-12-09 13:21:43 +00:00
Sergey Matveev
9be70fbda9
[sanitizer] Introduce VReport and VPrintf macros and use them in sanitizer code.
...
Instead of "if (common_flags()->verbosity) Report(...)" we now have macros.
llvm-svn: 196497
2013-12-05 12:04:51 +00:00
Kostya Serebryany
f2c93b2973
[sanitizer] fix the ppc32 build (patch by Jakub Jelinek)
...
llvm-svn: 196489
2013-12-05 08:51:48 +00:00
Kostya Serebryany
14e92c2c62
[sanitizer] support toolchains that don't understand CFI directives
...
Summary: Support toolchains that don't understand CFI directives.
Reviewers: dvyukov
Reviewed By: dvyukov
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2336
llvm-svn: 196480
2013-12-05 07:44:35 +00:00
Sergey Matveev
7bc300c8fc
[sanitizer] Fix log_path behavior with StopTheWorld.
...
Summary:
Fix race on report_fd/report_fd_pid between the parent process and the
tracer task.
Reviewers: samsonov
Reviewed By: samsonov
CC: llvm-commits, kcc, dvyukov
Differential Revision: http://llvm-reviews.chandlerc.com/D2306
llvm-svn: 196385
2013-12-04 14:37:01 +00:00
Alexey Samsonov
907eb5b630
[Sanitizer] Use more appropriate InternalScopedString in GetCodeRangeForFile
...
llvm-svn: 196264
2013-12-03 09:29:23 +00:00
Alexey Samsonov
8dd33a27c3
[Sanitizer] Fix a bug introduced in r196112. Add a test.
...
llvm-svn: 196263
2013-12-03 09:21:08 +00:00
Sergey Matveev
b748d46019
[sanitizer] Allow InternalMmapVector construction with zero capacity.
...
llvm-svn: 196112
2013-12-02 15:41:04 +00:00
Evgeniy Stepanov
c0378e72d1
[sanitizer] Intercept textdomain.
...
Patch by Alexander Taran.
llvm-svn: 196098
2013-12-02 13:43:26 +00:00
Kostya Serebryany
5774faf5b0
[sanitizer] disable shmctl intercetor in 32-bit -- it is rotten (bug filed)
...
llvm-svn: 195958
2013-11-29 14:09:13 +00:00
Timur Iskhodzhanov
5ca41e3800
Increase the LocatePcInTrace PC threshold now that GET_STACK_TRACE_WITH_PC_AND_BP has grown
...
llvm-svn: 195957
2013-11-29 13:15:25 +00:00
Timur Iskhodzhanov
bbf2ff8193
[ASan] Also print <empty stack> when size==0
...
llvm-svn: 195955
2013-11-29 12:08:59 +00:00
Evgeniy Stepanov
f2cddc3e64
[sanitizer] Disable iconv interceptor in OSX.
...
iconv is defined in an optional DSO, and our interception logic on OSX does not
support that.
llvm-svn: 195919
2013-11-28 14:42:59 +00:00
Evgeniy Stepanov
b56c5cd95e
[sanitizer] Intercept times.
...
llvm-svn: 195918
2013-11-28 14:41:22 +00:00
Evgeniy Stepanov
9c1f8323ae
[sanitizer] Intercept iconv.
...
llvm-svn: 195917
2013-11-28 14:14:48 +00:00
Dmitry Vyukov
8d1eb705c7
tsan: add support for passing file descriptors over UNIX domain sockets
...
tsan was missing new fd's arrived from recvmsg(),
and thus was reporting false positives due to missed synchronization on the fd's
llvm-svn: 195914
2013-11-28 09:09:42 +00:00
Evgeniy Stepanov
b76b687628
[sanitizer] Intercept __xpg_strerror_r.
...
llvm-svn: 195839
2013-11-27 12:29:10 +00:00
Alexey Samsonov
1c256cbcc4
[Sanitizer] Add rudimentary support for using libbacktrace in symbolizer.
...
More steps are needed to actually make it usable:
* sanitizer runtimes should be compiled with -DSANITIZER_LIBBACKTRACE.
* libbacktrace headers should be installed.
* user has to manually link in libbacktrace.a into the executable.
We can easily solve the first two problems in the build system, but
detecting/linking libbacktrace to all the tests we have and end-user programs
is more challenging (and will unlikely work w/o Driver support).
Based on the patch by Jakub Jelinek!
llvm-svn: 195837
2013-11-27 11:46:58 +00:00
Dmitry Vyukov
44be414d69
asan: fix android build
...
android does not seem to have IOCB_CMD_PREADV
llvm-svn: 195835
2013-11-27 11:20:55 +00:00
Dmitry Vyukov
51b35901fd
tsan: minor refactoring
...
use common helper macro
llvm-svn: 195832
2013-11-27 09:59:11 +00:00
Dmitry Vyukov
7bd319cc08
tsan: fix flags parsing
...
- running_on_valgrind was not parsed in some contexts
- refactor code a bit
- add comprehensive tests for flags parsing
llvm-svn: 195831
2013-11-27 09:54:10 +00:00
Dmitry Vyukov
ee882ba4a1
tsan: support synchronization by means of linux aio
...
http://llvm-reviews.chandlerc.com/D2269
llvm-svn: 195830
2013-11-27 09:10:47 +00:00
Alexey Samsonov
d5144879f9
[Sanitizer] Improve external symbolizer behavior.
...
1) Don't start external symbolizer subprocess until we actually try to
symbolize anything.
2) Allow to turn off external symbolizer by providing empty ?SAN_SYMBOLIZER_PATH
environment variable.
llvm-svn: 195771
2013-11-26 16:24:53 +00:00
Lorenzo Martignoni
895454e1e4
Implement a bunch of custom glibc wrappers & corresponding tests
...
llvm-svn: 195749
2013-11-26 11:45:58 +00:00
Timur Iskhodzhanov
895392d03f
[ASan] Use ExitProcess rather than _exit on Windows to avoid calling global dtors etc
...
llvm-svn: 195723
2013-11-26 09:40:39 +00:00
Kostya Serebryany
ccfc0481f1
[sanitizer] Implement TwoLevelByteMap and use it for the internal allocator on 64-bit.
...
Summary:
Implement TwoLevelByteMap and use it for the internal allocator on 64-bit.
This reduces bss on 64-bit by ~8Mb because we don't use FlatByteMap on 64-bits any more.
Dmitry, please check my understanding of atomics.
Reviewers: dvyukov
Reviewed By: dvyukov
CC: samsonov, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2259
llvm-svn: 195637
2013-11-25 11:33:41 +00:00
Timur Iskhodzhanov
0d419293e2
[ASan] Follow-up fix: use #if SANITIZER_WINDOWS, not #ifdef
...
llvm-svn: 195625
2013-11-25 07:56:05 +00:00
Timur Iskhodzhanov
25cc3c55cc
[ASan] Un-break the Windows build
...
llvm-svn: 195624
2013-11-25 07:54:55 +00:00
Sergey Matveev
634a75b63e
[sanitizer] Do not clear memory which comes from secondary allocator.
...
Secondary allocator is mmap-based, so the memory is already zeroed.
llvm-svn: 195571
2013-11-24 14:45:38 +00:00
Kostya Serebryany
a2fde9484f
[sanitizer] use 16-byte aligned bzero in performance critical place (mostly for lsan)
...
llvm-svn: 195549
2013-11-23 12:49:19 +00:00