Evgeniy Stepanov
6488b2b257
[asan] Switch to allocator2 on Android.
...
llvm-svn: 177263
2013-03-18 09:22:58 +00:00
Dmitry Vyukov
a1bdd2d942
tsan: fix memory leak
...
llvm-svn: 177262
2013-03-18 09:09:41 +00:00
Dmitry Vyukov
7cd2025c4d
tsan: use StackDepot for thread creation stacks
...
llvm-svn: 177261
2013-03-18 09:02:27 +00:00
Dmitry Vyukov
50160030e1
tsan: fix Go build
...
llvm-svn: 177260
2013-03-18 08:52:46 +00:00
Dmitry Vyukov
a221620b2e
tsan: use StackDepot in sync object to store creation stacks
...
llvm-svn: 177258
2013-03-18 08:27:47 +00:00
Dmitry Vyukov
6f7ca81cce
tsan: fix huge stack frames
...
llvm-svn: 177255
2013-03-18 08:09:42 +00:00
Kostya Serebryany
c4722a65a5
[asan] while generating the description of a global variable, emit the module name in a separate field, thus not duplicating this information if every description. This decreases the binary size (observed up to 3%). https://code.google.com/p/address-sanitizer/issues/detail?id=168 . This changes the asan API version. compiler-rt part, llvm-part will follow
...
llvm-svn: 177253
2013-03-18 08:04:55 +00:00
Dmitry Vyukov
0f2c7ea5d0
tsan: fix lint warnings
...
llvm-svn: 177251
2013-03-18 07:58:20 +00:00
Alexey Samsonov
cbed82ea70
[TSan] fix undefined variable in debug TSan build
...
llvm-svn: 177249
2013-03-18 07:33:00 +00:00
Alexey Samsonov
4f1c8a13d5
[TSan] Use ThreadRegistry::FindThreadContextLocked() to find thread by its stack/tls address.
...
llvm-svn: 177248
2013-03-18 07:02:08 +00:00
Alexey Samsonov
e1955b851d
[TSan] Makefiles: allow configurable paths to clang and FileCheck. Add -fno-rtti flag.
...
llvm-svn: 177247
2013-03-18 07:00:36 +00:00
Alexey Samsonov
f9dbbda5bc
[Sanitizer] Get rid of global mutexes in StopTheWorld implementation
...
llvm-svn: 177246
2013-03-18 06:27:13 +00:00
Alexey Samsonov
e25c72958a
[Sanitizer] Rely on template argument deduction in sanitizer_allocator_test
...
llvm-svn: 177245
2013-03-18 06:07:44 +00:00
Alexander Potapenko
845b575370
[libsanitizer] StopTheWorld in sanitizer_common
...
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.
Linux implementation provided.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177156
2013-03-15 14:37:21 +00:00
Alexey Samsonov
3a6b6b9d55
[Sanitizer] Don't intercept frexpf and frexpl on Windows. Add frexp declaration to asan_intercepted_functions.h
...
llvm-svn: 177155
2013-03-15 14:02:21 +00:00
Alexey Samsonov
9aecdfe34d
[TSan] Switch TSan runtime to use ThreadRegistry class from sanitizer_common
...
llvm-svn: 177154
2013-03-15 13:48:44 +00:00
Alexey Samsonov
e4385c4b98
[Sanitizer] Don't link tests with -lpthread on Android.
...
llvm-svn: 177151
2013-03-15 12:54:01 +00:00
Kostya Serebryany
96a7620f3a
[sanitizer] fix gcc build warnings
...
llvm-svn: 177149
2013-03-15 12:27:52 +00:00
Kostya Serebryany
b941a2fca4
[asan] Add ForEachChunk() to sanitizer allocators. Patch by Sergey Matveev
...
llvm-svn: 177147
2013-03-15 11:39:41 +00:00
Alexey Samsonov
cdd46d9ccc
[Sanitizer] Generalize compile/link flags for sanitizer_common tests on Android and on other platforms.
...
llvm-svn: 177146
2013-03-15 10:39:26 +00:00
Alexey Samsonov
337b0fcf9c
[Sanitizer] Build sanitizer_common tests w/o RTTI. Move ThreadRegistry class members below methods.
...
llvm-svn: 177143
2013-03-15 07:08:52 +00:00
Eric Christopher
d3c993b396
Fix a virtual destructor warning.
...
Patch by Manuel Klimek!
llvm-svn: 177132
2013-03-15 00:20:17 +00:00
Alexey Samsonov
d1999a1ccc
[Sanitizer] Fix compiler warnings and style issues in sanitizer_common tests. Use -Werror=sign-compare when building them.
...
llvm-svn: 177077
2013-03-14 15:15:35 +00:00
Alexey Samsonov
1cb684381a
[Sanitizer] Add generic ThreadRegistry class for sanitizer runtimes. This class holds basic thread bookkeeping logic and allows specific sanitizer runtimes to create thread contexts and mark threads as created/running/joined etc. The class is based on the way we currently store thread contexts in TSan.
...
llvm-svn: 177074
2013-03-14 13:54:30 +00:00
Alexey Samsonov
a097f7b1e3
[Sanitizer] Add default constructor for BlockingMutex
...
llvm-svn: 177072
2013-03-14 13:30:56 +00:00
Evgeniy Stepanov
8d487b4407
[sanitizer] No dirent64 on Android.
...
llvm-svn: 177071
2013-03-14 13:24:03 +00:00
Alexey Samsonov
3d09fdbf21
[Sanitizer] Build sanitizer_common with -fno-rtti
...
llvm-svn: 177070
2013-03-14 13:16:35 +00:00
Kostya Serebryany
d332d42372
[asan] remove one redundant malloc stress test, unify the usage of ASAN_LOW_MEMORY macro in tests, slightly reduce test memory usage (all to make 32-bit runs consume less RAM)
...
llvm-svn: 177069
2013-03-14 13:16:09 +00:00
Alexander Potapenko
34e1171768
[libsanitizer] fixed a bug in ThreadLister tests where we forgot to terminate one thread
...
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177068
2013-03-14 13:15:14 +00:00
Evgeniy Stepanov
740e6ebe71
[msan] Add changes missing from r177065.
...
llvm-svn: 177067
2013-03-14 13:13:49 +00:00
Evgeniy Stepanov
c6bce93591
[msan] Intercept readdir64.
...
llvm-svn: 177065
2013-03-14 12:49:23 +00:00
Alexey Samsonov
1dc928e1b1
[ASan] remove -fsanitize=init-order from lit tests as now it's implied by -fsanitize=address
...
llvm-svn: 177064
2013-03-14 12:43:03 +00:00
Alexander Potapenko
ac3bbb3ef3
[libsanitizer] Fixed incorrect handling of pre-existing threads in ThreadLister test.
...
Also, extended the test to check that ThreadLister::Reset() works as intended.
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 177060
2013-03-14 12:06:54 +00:00
Evgeniy Stepanov
4062a396c7
[msan] Fix a typo in test.
...
llvm-svn: 177059
2013-03-14 11:58:13 +00:00
Alexey Samsonov
963be1ddd8
[ASan] turn off checking initialization order in ASan runtime by default. Instead, it should be turned on by default in the compiler
...
llvm-svn: 177058
2013-03-14 11:49:40 +00:00
Evgeniy Stepanov
fe0199ea54
[msan] Options for switching between fast and cfi unwinders in run time.
...
Does not change default behavior.
llvm-svn: 177057
2013-03-14 11:47:03 +00:00
Evgeniy Stepanov
231894a902
[sanitizer] Intercept frexp and friends.
...
llvm-svn: 177056
2013-03-14 11:34:39 +00:00
Alexey Samsonov
7d2385419a
[Sanitizer] fix compilation for Windows
...
llvm-svn: 177054
2013-03-14 11:29:06 +00:00
Evgeniy Stepanov
ead6cf7c72
[msan] Intercept __strdup, strndup, __strndup.
...
llvm-svn: 177052
2013-03-14 11:10:36 +00:00
Alexey Samsonov
83e7622df6
[Sanitizer] Write a slightly better implementation of GetEnv() function on Windows
...
llvm-svn: 177051
2013-03-14 11:10:23 +00:00
Alexey Samsonov
140cd84155
[ASan] make ASan assume ASAN_OPTIONS=symbolize=1 if ASAN_EXTERNAL_SYMBOLIZER is defined
...
llvm-svn: 177036
2013-03-14 10:07:40 +00:00
Alexey Samsonov
41a560b8cd
[TSan] Add missing header inclusion
...
llvm-svn: 177013
2013-03-14 07:13:00 +00:00
Alexey Samsonov
109ddd0fe4
[TSan] Use __sanitizer_pthread_attr_t in TSan
...
llvm-svn: 177012
2013-03-14 07:10:52 +00:00
Reid Kleckner
2325273641
[msan] Clean up extensions during msandr shutdown
...
Otherwise debug DynamoRIO complains at us for leaking memory.
llvm-svn: 176947
2013-03-13 13:59:09 +00:00
Evgeniy Stepanov
96f82f8ac3
[sanitizer] Fix lint.
...
llvm-svn: 176943
2013-03-13 10:20:35 +00:00
Alexey Samsonov
d7ab381f53
[Sanitizer] Build ASan, TSan and MSan runtimes with -fno-rtti.
...
llvm-svn: 176940
2013-03-13 09:18:30 +00:00
Evgeniy Stepanov
98f5ea0dba
[msan] Increase stack size as required.
...
Adjust stack size in pthread_attr_t when the app-requested size does not fit MSan TLS.
llvm-svn: 176939
2013-03-13 09:01:40 +00:00
Evgeniy Stepanov
5697b58ec4
[sanitizer] Move GetTlsSize code from TSan to sanitizer_common.
...
llvm-svn: 176938
2013-03-13 08:19:53 +00:00
Evgeniy Stepanov
24aad9c0cb
Break a >80 char line.
...
llvm-svn: 176937
2013-03-13 08:17:39 +00:00
Alexey Samsonov
91f833a413
[Sanitizer] Fixup for r176931 for Mac and Windows
...
llvm-svn: 176935
2013-03-13 07:39:25 +00:00
Alexey Samsonov
d38aceda4e
[Sanitizer] Fix a typo in function name
...
llvm-svn: 176932
2013-03-13 06:55:02 +00:00
Alexey Samsonov
06d3aa4884
[Sanitizer] Change MemoryMappingLayout methods to also report memory protection flags (for future use in leak checker). Patch by Sergey Matveev.
...
llvm-svn: 176931
2013-03-13 06:51:02 +00:00
Kostya Serebryany
67b1478914
[asan] use 4Tb of address space for the asan allocator instead of 1Tb. This increases the memory available for a single size class from 16Gb to 64Gb. The total VM footprint becomes 20Tb
...
llvm-svn: 176857
2013-03-12 09:04:49 +00:00
Kostya Serebryany
138b155042
[sanitizer] use fewer size classes in the allocator to reduce the memory footprint. There is no all-size-fits-all constant here, but this change is positive or neutral on several large apps I've tested
...
llvm-svn: 176855
2013-03-12 08:44:40 +00:00
Evgeniy Stepanov
26d5bc7fdf
[msan] Use sptr instead of ptrdiff_t.
...
llvm-svn: 176854
2013-03-12 07:21:17 +00:00
Kostya Serebryany
ba56c8d4f9
[sanitizer] simplify the allocator's SizeClassMap: do not require an extra template parameter, instead compute it in flight. No functionality change
...
llvm-svn: 176853
2013-03-12 07:01:27 +00:00
Reid Kleckner
c9d382b5a4
[msan] intercept dlopen and clear shadow for it
...
Summary:
The loader does not call mmap() through the PLT because it has to
bootstrap the process before libc is present. Hooking dlopen() isn't
enough either because the loader runs module initializers before
returning, and they could run arbitrary msan instrumented code.
If msandr is present, then we can intercept the mmaps from dlopen at the
syscall layer and clear the shadow there. If msandr is missing, we
clear the shadow after dlopen() and hope any initializers are trivial.
Reviewers: eugenis
CC: kcc, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D509
llvm-svn: 176818
2013-03-11 18:07:42 +00:00
Alexey Samsonov
db7d9656bb
[Sanitizer] Implement BlockingMutex::CheckLocked()
...
llvm-svn: 176805
2013-03-11 15:45:20 +00:00
Alexander Potapenko
1f78ad5da4
[ASan] Reduce the local buffer size in Report() not to fail the check enforced when building TSan runtime.
...
llvm-svn: 176804
2013-03-11 13:36:39 +00:00
Alexander Potapenko
18c916c6c5
[ASan] Try to use a small (512 bytes) stack-local buffer in Report() for short messages, fall back to MmapOrDie() in the case of a failure.
...
This shall eliminate most of the cryptic "ERROR: failed to mmap" messages caused by recursively calling MmapOrDie() from MmapOrDie().
llvm-svn: 176802
2013-03-11 11:47:43 +00:00
Alexander Potapenko
92cc1a6d24
[ASan] don't call strerr from functions that map memory, since this results in malloc().
...
llvm-svn: 176800
2013-03-11 10:21:28 +00:00
Kostya Serebryany
0f5c20b417
[sanitizer] make SizeClassAllocator64::GetBlockBegin more bullet proof (by Sergey Matveev)
...
llvm-svn: 176799
2013-03-11 09:43:12 +00:00
Nick Lewycky
593eeb000a
Don't emit the extra checksum into the .gcda file if the user hasn't asked for
...
it. Fortunately, versions of gcov that predate the extra checksum also ignore
any extra data, so this isn't a problem. This matches the API change made in
r176745.
llvm-svn: 176746
2013-03-09 01:33:12 +00:00
Nick Lewycky
8015c6ee2f
Take the GCDA version string as an input to llvm_gcda_start_file.
...
llvm-svn: 176618
2013-03-07 08:28:54 +00:00
Reid Kleckner
063dfe3244
[msan] Block reports from interceptors during _Unwind_Backtrace
...
Summary:
I'm hitting a big recursive report from:
uninit on strlen ->
__msan::PrintWarningWithOrigin() ->
__msan::GetStackTrace() ->
__sanitizer::StackTrace::SlowUnwindStack() ->
_Unwind_Backtrace() ->
... libgcc calls ->
uninit on strlen() ->
... repeats
Reviewers: eugenis
Differential Revision: http://llvm-reviews.chandlerc.com/D497
llvm-svn: 176555
2013-03-06 16:11:58 +00:00
Reid Kleckner
c193da57b8
[msan] pthread_join() returns int, not void*
...
pthread_join() returns an error code, not the result of the
pthread_create() function like I thought.
llvm-svn: 176554
2013-03-06 15:41:35 +00:00
Reid Kleckner
66c26e5e96
[sanitizers] Fix check failure on dealloc from new thread
...
Summary:
Adds a test for this case, which was reduced from a chromium build of
WebKit's DumpRenderTree.
Reviewers: eugenis
CC: glider
Differential Revision: http://llvm-reviews.chandlerc.com/D495
llvm-svn: 176552
2013-03-06 14:54:08 +00:00
Alexey Samsonov
dcb0e72e6f
[Sanitizer] fix signed-unsigned mismatch in test and use correct order of EXPECT_EQ() args
...
llvm-svn: 176479
2013-03-05 12:23:07 +00:00
Alexey Samsonov
434dde9996
[Sanitizer] Add methods back() and pop_back() to InternalVector. Patch by Sergey Matveev
...
llvm-svn: 176478
2013-03-05 11:58:25 +00:00
Nick Kledzik
2b9a65e4c4
update how libcompiler_rt.dylib links under libSystem.dylib on MacOSX
...
llvm-svn: 176466
2013-03-05 00:16:52 +00:00
Evgeniy Stepanov
f5d8c90f57
[asan] Revert r176255, r176264.
...
New allocator has 1.5x memory overhead of the old one.
llvm-svn: 176340
2013-03-01 09:33:05 +00:00
Evgeniy Stepanov
323771b3f1
[sanitizer] Fix check failure in SizeClassMap::Print.
...
llvm-svn: 176338
2013-03-01 08:49:14 +00:00
Evgeniy Stepanov
3305b177e6
[asan] Lower memory usage in LargeMallocTest on Android.
...
llvm-svn: 176264
2013-02-28 15:54:58 +00:00
Alexander Potapenko
f1c48eb509
[ASan] Add the memcmp_strict flag (1 by default) that controls the behavior of accessibility checks in memcmp.
...
1: memcmp(p1, p2, n) always checks n bytes
0: memcmp checks up to n bytes depending on whether the memory contents differ.
llvm-svn: 176256
2013-02-28 14:09:30 +00:00
Evgeniy Stepanov
1cb95a17b8
[asan] Enable allocator2 on Android.
...
llvm-svn: 176255
2013-02-28 14:07:01 +00:00
Kostya Serebryany
abebb57272
[asan] bump kMidMemEnd to 0x4fffffffffULL since in rare cases prelink uses addresses higher than 0x3fffffffff
...
llvm-svn: 176250
2013-02-28 12:28:37 +00:00
Alexey Samsonov
4a3234bec5
[Sanitizer] Relax ThreadLister tests to allow possible pre-existing threads. Do proper mutex destruction. Patch by Sergey Matveev
...
llvm-svn: 176249
2013-02-28 11:33:51 +00:00
Evgeniy Stepanov
218c582cb5
[msan] Lit tests for __attribute__((no_sanitize_memory)).
...
llvm-svn: 176248
2013-02-28 11:25:54 +00:00
Nick Lewycky
1052c99f46
Holy macaroons, somebody made a copy of llvm/runtime/profile/GCDAProfiling.c,
...
didn't delete the original, and now they've diverged. I have no idea what's
going on. Apply my patch in r176173 to this one too, this one looks newer?
llvm-svn: 176236
2013-02-28 07:00:13 +00:00
Kostya Serebryany
8ee2a5adc7
[asan] if calloc returns a freshly-mmaped memory, don't clear it with memset. Speeds up calloc-intensive code
...
llvm-svn: 176185
2013-02-27 13:38:19 +00:00
Alexey Samsonov
49b86b354a
[Sanitizer] don't include missing header on Android
...
llvm-svn: 176183
2013-02-27 13:03:35 +00:00
Alexey Samsonov
46a36d5019
[UBSan] Use common report decorator to print colorful diagnostics in UBSan, and be more consistent w/ Printf/RawWrite
...
llvm-svn: 176182
2013-02-27 12:58:24 +00:00
Kostya Serebryany
f0b8f989e9
add Linux syscall wrappers and ThreadLister to sanitizer_common
...
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev
llvm-svn: 176179
2013-02-27 11:22:40 +00:00
Kostya Serebryany
c98cddd024
[asan] guard ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS definition with an #ifndef
...
llvm-svn: 176175
2013-02-27 08:28:24 +00:00
Alexey Samsonov
086b940b1e
[Sanitizer] Don't die if external symbolizer is used on Mac, where it's not implemented yet
...
llvm-svn: 176091
2013-02-26 13:40:51 +00:00
Kostya Serebryany
a8cfb900dd
[sanitizer] A low-level vector implementation to be used in leak checking code. Patch by Sergey Matveev
...
llvm-svn: 176089
2013-02-26 13:30:27 +00:00
Kostya Serebryany
459df6f167
[asan] a bit stricter lint for CHECK vs CHECK_XX (these CHECK_XX really help debugging!)
...
llvm-svn: 176085
2013-02-26 12:59:06 +00:00
Kostya Serebryany
01a32bdef1
[tsan] enable tsan-vs-gvn test since it is now fixed
...
llvm-svn: 176079
2013-02-26 08:18:27 +00:00
Kostya Serebryany
8caf654731
[asan] fix the output for range accesses (memset, etc); improve the tests; more strict checking in memcmp
...
llvm-svn: 176078
2013-02-26 07:25:18 +00:00
Kostya Serebryany
c8ac15a66b
[asan] use the new attribute syntax (no_address_safety_analysis => no_sanitize_address)
...
llvm-svn: 176077
2013-02-26 07:01:06 +00:00
Alexey Samsonov
54ff0f6388
[Sanitizer] one more fix for signed/unsigned mismatch in comparison
...
llvm-svn: 176020
2013-02-25 14:06:38 +00:00
Alexey Samsonov
b2ac280f96
[Sanitizer] fix signed/unsigned compare warnings in sanitizer_stacktrace_test. Build sanitizer_common tests with -Werror as we use predictable just-built Clang for building them
...
llvm-svn: 176014
2013-02-25 09:00:03 +00:00
Alexey Samsonov
85f0a7e644
[TSan] Add interceptor for malloc_usable_size()
...
llvm-svn: 176013
2013-02-25 08:43:10 +00:00
Alexey Samsonov
10bccda948
[TSan] remove temporary build directory in 'make clean' command
...
llvm-svn: 176012
2013-02-25 08:32:02 +00:00
Richard Smith
0404ec8396
ubsan: Runtime handlers for array indexing checks.
...
llvm-svn: 175948
2013-02-23 02:40:07 +00:00
Reid Kleckner
e1596856ec
[Sanitizer] Add a test for the fast unwinder
...
Summary:
The test sets up fake x86-style fp+retaddr frames, since that's all the
unwinder works with.
Reviewers: kcc
CC: eugenis
Differential Revision: http://llvm-reviews.chandlerc.com/D445
llvm-svn: 175893
2013-02-22 15:10:16 +00:00
Evgeniy Stepanov
3065014026
[msan] MSanDR: initial commit.
...
MSanDR is a DynamoRio-based tool that handles uninstrumented libraries and
dynamically generated code for MSan.
llvm-svn: 175883
2013-02-22 09:34:19 +00:00
Kostya Serebryany
1d63d13ce2
[asan] move the .preinit_array hack into a separate file (added used attribute)
...
llvm-svn: 175871
2013-02-22 07:51:26 +00:00
Alexander Potapenko
97781c4dd0
[ASan] temporarily disable alloc_dealloc_mismatch on Mac, since the previous commit caused error reports in gTest.
...
llvm-svn: 175766
2013-02-21 17:12:21 +00:00
Alexander Potapenko
a47c6ee286
[ASan] Make sure operator new/delete and friends are intercepted on OS X.
...
Because the interceptors will reside in a dylib, not the main executable, we can't just declare them,
but must use the interposition machinery.
Fix the test expectations in large_func_test.cc affected by the change.
This CL should make our Mac buildbots green.
llvm-svn: 175763
2013-02-21 16:54:09 +00:00