Alexey Samsonov
32832e6176
[Sanitizer] include sanitizer_common headers when building interception library
...
llvm-svn: 173930
2013-01-30 14:27:41 +00:00
Alexey Samsonov
c500132a93
[Sanitizer] Add change missed in r173926
...
llvm-svn: 173929
2013-01-30 13:19:15 +00:00
Evgeniy Stepanov
358698279d
[sanitizer] Further split private and public sanitizer headers.
...
And make msan_interface.h C-compatible.
llvm-svn: 173928
2013-01-30 13:12:08 +00:00
Alexey Samsonov
0d92533b29
Use LLVM_BUILD_TYPE instead of CMAKE_BUILD_TYPE in compiler-rt unit tests to match the behavior of llvm unittests
...
llvm-svn: 173926
2013-01-30 12:18:49 +00:00
Evgeniy Stepanov
5725e5b715
[msan] Remove an extra #ifdef.
...
__has_feature is always defined at this point.
llvm-svn: 173920
2013-01-30 09:56:11 +00:00
Dmitry Vyukov
d6b9348bf3
tsan: introduce a helped macro CPP_WEAK (Go linker does not support weak symbols)
...
llvm-svn: 173917
2013-01-30 09:46:53 +00:00
Dmitry Vyukov
5fbfafcd8c
tsan: add OnFinalize() callback for frontends
...
llvm-svn: 173915
2013-01-30 09:24:00 +00:00
Alexey Samsonov
a1eb11f915
[TSan] relax output tests a bit to make them pass in gcc build
...
llvm-svn: 173913
2013-01-30 08:41:57 +00:00
Alexey Samsonov
49a32c1d08
[Sanitizer] update style checker script and fix namespace style warnings
...
llvm-svn: 173910
2013-01-30 07:45:58 +00:00
Will Dietz
25abfe49e1
[tsan] Fix checks for siginfo_t in tests
...
llvm-svn: 173815
2013-01-29 18:29:34 +00:00
Evgeniy Stepanov
eac7f934f0
[msan] Cleanup public interface header.
...
Moved everything users are not supposed to use to a private interface header.
Documented all public interfaces. Made them safe to use even if built without
MemorySanitizer.
llvm-svn: 173800
2013-01-29 14:33:29 +00:00
Dmitry Vyukov
019ef67a97
tsan: dump stack on internal assert failure
...
llvm-svn: 173799
2013-01-29 14:20:12 +00:00
Dmitry Vyukov
4399d92252
tsan: support for inprocess symbolizer
...
llvm-svn: 173797
2013-01-29 13:05:30 +00:00
Dmitry Vyukov
b46930befa
tsan: remember when we are inside of symbolizer code (required for inprocess symbolizer)
...
llvm-svn: 173796
2013-01-29 13:03:07 +00:00
Alexey Samsonov
322d7fbd9d
ASan: fix lint
...
llvm-svn: 173795
2013-01-29 12:08:12 +00:00
Evgeniy Stepanov
c9db3b8b39
[sanitizer] Copy sanitizer headers to the build tree.
...
llvm-svn: 173794
2013-01-29 11:46:06 +00:00
Dmitry Vyukov
73b12d7132
asan: fix the test
...
llvm-svn: 173786
2013-01-29 09:59:53 +00:00
Dmitry Vyukov
0632dd410c
tsan: fix the message (tsan is not asan)
...
llvm-svn: 173784
2013-01-29 09:39:58 +00:00
Dmitry Vyukov
7943b69002
tsan: add IsSymbolizerAvailable() function for querying for presence of internal/external symbolizer
...
llvm-svn: 173783
2013-01-29 09:35:14 +00:00
Dmitry Vyukov
b130fc3c0d
tsan: add interceptor stubs for stat family of functions
...
llvm-svn: 173782
2013-01-29 09:23:09 +00:00
Alexey Samsonov
9aa2e4f5c4
[ASan] fix deallocation hook in allocator2: according to specification, dealloc hook should be called before deallocating memory
...
llvm-svn: 173778
2013-01-29 08:19:11 +00:00
Alexey Samsonov
615b86cf0a
[ASan] Do allocate memory even for zero-size allocation requests. Explain why we have to do this in comments.
...
llvm-svn: 173776
2013-01-29 07:51:34 +00:00
Timur Iskhodzhanov
6cff9deb16
Use the correct order of NOINLINE vs ret type to fix Windows build
...
llvm-svn: 173694
2013-01-28 17:29:50 +00:00
Evgeniy Stepanov
9f7e8c1433
[msan] A runtime call to support custom allocators.
...
llvm-svn: 173687
2013-01-28 13:52:49 +00:00
Evgeniy Stepanov
2538bd1901
[msan] Remove icmp tests that require exact shadow propagation.
...
llvm-svn: 173686
2013-01-28 13:45:16 +00:00
Alexey Samsonov
7eda134fa7
[ASan] fix a bug in allocator-v2 which could lead to SEGV on realloc(malloc(0), 4)
...
llvm-svn: 173681
2013-01-28 11:24:13 +00:00
Alexey Samsonov
7c362fb1b6
CMake: simplify build rules for compiler-rt unit tests. This fixes warnings in Ninja build tree.
...
llvm-svn: 173677
2013-01-28 09:07:30 +00:00
Kostya Serebryany
61761f182b
[asan] fix a crash in asan stats printing (initialize the allocator in __asan_init)
...
llvm-svn: 173676
2013-01-28 08:05:47 +00:00
Kostya Serebryany
6c17547ef1
[asan] two more internal flags for asan-rt: print_stats (0) and print_legend (1)
...
llvm-svn: 173671
2013-01-28 07:34:22 +00:00
Alexey Samsonov
5311754b62
[CMake] Fix compiler-rt tests after r173617
...
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
NAKAMURA Takumi
385bbc1594
AddCompilerRT.cmake: Try to unbreak since r173617.
...
llvm-svn: 173619
2013-01-27 14:12:25 +00:00
Daniel Dunbar
562fe1af43
[build/clang_darwin] Don't try to run sw_vers if we don't have it.
...
- Also, fix the test this is guarding, which was backwards.
llvm-svn: 173465
2013-01-25 18:09:28 +00:00
Evgeniy Stepanov
0e5becb830
[msan] Tests for ICmp handling.
...
llvm-svn: 173456
2013-01-25 15:39:11 +00:00
Alexey Samsonov
622a7b2408
[Sanitizer] More fixes to scanf interceptor: stub support for %s, support for %[...] directive
...
llvm-svn: 173451
2013-01-25 15:26:19 +00:00
Kostya Serebryany
c1056f90ae
[sanitizer] improve the calloc overflow check (spotted by samsonov@)
...
llvm-svn: 173443
2013-01-25 12:22:21 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +00:00
Alexey Samsonov
4899fb5cfb
[Sanitizer] fix errors in scanf interceptors: add support for %c and fix cases like %5d
...
llvm-svn: 173440
2013-01-25 11:43:32 +00:00
Dmitry Vyukov
4e3b9802bd
tsan: return the old fake numbers from malloc stats (some code already depends on them)
...
llvm-svn: 173348
2013-01-24 14:07:19 +00:00
Alexey Samsonov
971b0cd26f
[Sanitizer] use stub InternalSymbolizer on platforms where we don't have weak hooks
...
llvm-svn: 173347
2013-01-24 14:01:59 +00:00
Dmitry Vyukov
f4f76b1c10
tsan: suppress reports using both stacks
...
llvm-svn: 173346
2013-01-24 13:50:32 +00:00
Dmitry Vyukov
83566dadaf
tsan: allow a front-end to provide default suppressions
...
llvm-svn: 173345
2013-01-24 13:50:10 +00:00
Alexey Samsonov
8db4077583
[Sanitizer] Add skeleton for InternalSymbolizer that can be used by providing callbacks __sanitizer_symbolize_{code,data}
...
llvm-svn: 173344
2013-01-24 13:42:45 +00:00
Kostya Serebryany
35fb1167b0
[asan] run-time tests for adaptive redzones
...
llvm-svn: 173336
2013-01-24 10:36:11 +00:00
Alexander Potapenko
56a3724cf1
[ASan] fix compilation on Mac by adding a missing pwrite parameter.
...
llvm-svn: 173333
2013-01-24 09:15:08 +00:00
Dmitry Vyukov
6e406cda4b
tsan: implement malloc stats querying
...
llvm-svn: 173332
2013-01-24 09:08:03 +00:00
Dmitry Vyukov
0ced85a8c7
asan/tsan: fix pwrite interceptors
...
llvm-svn: 173328
2013-01-24 07:44:21 +00:00
Dmitry Vyukov
e9a44974d4
tsan: also test asan during presubmit checks, because sanitizer_common changes can affect it
...
llvm-svn: 173327
2013-01-24 07:43:55 +00:00
Evgeniy Stepanov
d1bfdc32b2
[msan] Allow waitpid while in __msan_init().
...
This is used in symbolizer init.
llvm-svn: 173263
2013-01-23 14:22:05 +00:00
Kostya Serebryany
7206a145dd
[sanitizer] increase the minimal mmap size in allocator to 2^16; fix the asan Mac build
...
llvm-svn: 173261
2013-01-23 14:07:17 +00:00
Kostya Serebryany
8f267137c2
[asan] initialize kHighMemEnd at startup (instead of at compile time) to simplify further changes for various address space layouts. Fix asan_allocator2 for PowerPC (tested on 44-bit address space)
...
llvm-svn: 173260
2013-01-23 13:27:43 +00:00
Dmitry Vyukov
228921d71e
tsan: add stubs for malloc introspection (similar to what we have in asan)
...
llvm-svn: 173255
2013-01-23 12:08:03 +00:00
Dmitry Vyukov
5787924e85
tsan: add missing interceptors
...
llvm-svn: 173253
2013-01-23 11:52:19 +00:00
Kostya Serebryany
7d2e4c0389
[asan] simplify the code that poisons global redzones, add some more tests
...
llvm-svn: 173251
2013-01-23 11:14:21 +00:00
Evgeniy Stepanov
ffffbefa43
[msan] gethostbyname interceptor.
...
llvm-svn: 173249
2013-01-23 10:43:38 +00:00
Evgeniy Stepanov
fdf3fa69c2
[msan] Remove the trap handler code.
...
llvm-svn: 173161
2013-01-22 14:29:15 +00:00
Evgeniy Stepanov
03ee782bee
[msan] Follow -msan-keep-going in reports from interceptors.
...
llvm-svn: 173158
2013-01-22 13:35:45 +00:00
Evgeniy Stepanov
8fdf7d0586
[msan] Fix linkage type of __msan_track_origins.
...
llvm-svn: 173157
2013-01-22 13:34:57 +00:00
Evgeniy Stepanov
f9a7aba34a
[msan] Simplify test code.
...
llvm-svn: 173155
2013-01-22 12:33:11 +00:00
Evgeniy Stepanov
2b65c0d1cf
[msan] Test handling of volatile bitfields.
...
llvm-svn: 173154
2013-01-22 12:31:39 +00:00
Evgeniy Stepanov
ef68259d26
[msan] Stop using volatile assignments as undef checks in MSan tests.
...
A runtime call is used instead.
MSan will stop adding shadow checks on volatile stores soon.
llvm-svn: 173152
2013-01-22 12:29:00 +00:00
Alexander Potapenko
81f0b331dc
[ASan] Disable the new/delete implementations for OSX
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=131
llvm-svn: 173149
2013-01-22 11:39:28 +00:00
Alexey Samsonov
1e63b08575
ASan: add output test for -fsanitize-address-zero-based-shadow option on Linux
...
llvm-svn: 173146
2013-01-22 10:45:20 +00:00
Alexander Potapenko
dc00c44d46
[ASan] Remove the declarations of pthread_workqueue_t and pthread_workitem_handle_t, which are used no more.
...
Kudos to Jeremy Huddleston Sequoia <jeremyhu@apple.com>
llvm-svn: 173143
2013-01-22 10:32:06 +00:00
Alexey Samsonov
d7b901d581
ASan: use Clang -fsanitize-blacklist flag in unit tests (instead of -mllvm)
...
llvm-svn: 173142
2013-01-22 10:30:17 +00:00
Alexander Potapenko
0c92557fcb
[ASan] Fix the path to ASan interface in interface_symbols_linux.c
...
llvm-svn: 173140
2013-01-22 10:13:37 +00:00
Alexander Potapenko
5ef0f677ae
[ASan] Moved interface_symbols.c to lit_tests/Linux.
...
We already have Darwin-specific version of this test.
llvm-svn: 173136
2013-01-22 09:22:10 +00:00
Alexander Potapenko
cae42d23a6
[ASan] Use dylib interposition to hook memory allocation in the dynamic runtime.
...
This CL drastically simplifies the way we're hooking the memory allocation routines in ASan on Mac by using dylib interposition to replace the main malloc_zone_* functions. This allows us to avoid replacing the default CFAllocator and drop the CF dependency at all.
Committing this patch will result in the static runtime being broken. A follow-up CL will switch ASan to use the dynamic runtime library.
llvm-svn: 173134
2013-01-22 09:14:54 +00:00
Alexey Samsonov
a168f30073
ASan: simplify build rules for unit tests
...
llvm-svn: 173133
2013-01-22 07:31:28 +00:00
Alexey Samsonov
2f20275730
ASan: disable flexible mapping and offset on Android. It doesn't work for dynamic ASan runtime there
...
llvm-svn: 173132
2013-01-22 07:21:24 +00:00
Kostya Serebryany
56fc958506
[asan] split asan_test.cc even more
...
llvm-svn: 173131
2013-01-22 07:01:47 +00:00
Kostya Serebryany
81e916893d
[asan] split asan_test.cc more
...
llvm-svn: 173130
2013-01-22 06:50:42 +00:00
Kostya Serebryany
4184b64094
[asan] split asan_test.cc to speedup parallel build (most important if building with a debug clang, which takes a couple of minutes on this large file with templates). More splits to follow
...
llvm-svn: 173129
2013-01-22 06:39:20 +00:00
Kostya Serebryany
031b69d8df
[asan] fix linux build
...
llvm-svn: 173049
2013-01-21 15:04:36 +00:00
Alexander Potapenko
c21aa5cb39
[ASan] Move Mac-specific tests to asan_mac_test.cc
...
llvm-svn: 173048
2013-01-21 14:49:55 +00:00
Alexey Samsonov
b670018c9f
CMake: generalize checking for target availability and add initial support for PowerPC native arch. With this patch, building LLVM on PowerPC native arch produces a working ASan runtime.
...
llvm-svn: 173044
2013-01-21 14:31:45 +00:00
Evgeniy Stepanov
5f37c82154
[sanitizer] Disable scanf interceptor on windows.
...
llvm-svn: 173037
2013-01-21 13:30:08 +00:00
Alexey Samsonov
362286f34c
Fixup for r173021: build tests with zero-based shadow on Android only, fix condition in checking for shadow gap in asan_mapping.h
...
llvm-svn: 173026
2013-01-21 11:36:38 +00:00
Evgeniy Stepanov
5e7936f646
[sanitizer] Define va_copy on win32.
...
llvm-svn: 173025
2013-01-21 11:32:50 +00:00
Kostya Serebryany
9b46312c87
[tsan] fix thread_name.cc test to work with older versions of libc
...
llvm-svn: 173023
2013-01-21 11:20:49 +00:00
Alexey Samsonov
6ad1d7809d
ASan: build unit tests with -fsanitize-address-zero-base-shadow on Linux and Android
...
llvm-svn: 173021
2013-01-21 10:51:18 +00:00
Evgeniy Stepanov
f940b2e381
[asan] Move *scanf declarations out of mac-only section.
...
llvm-svn: 173020
2013-01-21 10:33:14 +00:00
Alexey Samsonov
3fd1260155
ASan: build runtime flexible mapping and offset in configure+make build as well
...
llvm-svn: 173016
2013-01-21 09:13:10 +00:00
Alexey Samsonov
a58bcf70a1
ASan: use dynamic lookup when building dynamic ASan runtime on Mac, because shadow mapping and offset are defined in the instrumented modules instead of runtime
...
llvm-svn: 173015
2013-01-21 09:07:01 +00:00
Alexey Samsonov
b52d1a56f0
ASan: build runtime library with ASAN_FLEXIBLE_MAPPING_AND_OFFSET=1 as shadow mapping/offset are always emitted by the LLVM backend now
...
llvm-svn: 173013
2013-01-21 08:24:19 +00:00
Alexey Samsonov
b399118cad
CMake: add functions creating universal runtime libraries for several architectures on OS X and use them in ASan and UBSan build rules
...
llvm-svn: 173011
2013-01-21 08:12:20 +00:00
Alexey Samsonov
4e50333684
CMake: Add add_compiler_rt_osx_object_library to create universal libraries on Mac
...
llvm-svn: 172979
2013-01-20 14:36:12 +00:00
Alexey Samsonov
d0522c73b5
CMake: use add_compiler_rt_static_runtime to build TSan and MSan runtimes. No functionality change.
...
llvm-svn: 172978
2013-01-20 14:14:13 +00:00
Alexey Samsonov
8c2cd862b6
CMake: Add add_compiler_rt_static_runtime function and use it to build generic compiler-rt libraries
...
llvm-svn: 172977
2013-01-20 13:58:10 +00:00
Alexey Samsonov
3292fde911
Temporary disable test added in r172828 as it seems to be flaky on the buildbots
...
llvm-svn: 172976
2013-01-20 13:41:26 +00:00
Alexey Samsonov
2d04812a45
Fixup for r172828: use InternalScopedBuffer in favor of large stack buffers
...
llvm-svn: 172975
2013-01-20 13:22:06 +00:00
Alexey Samsonov
67c8e14760
Fix a typo from r172289
...
llvm-svn: 172830
2013-01-18 17:03:47 +00:00
Alexey Samsonov
b068483d4d
CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
...
llvm-svn: 172829
2013-01-18 16:51:07 +00:00
Alexander Potapenko
b4ba995366
[ASan] Fix the log_path option to use different log files for parent and child processes after fork().
...
llvm-svn: 172828
2013-01-18 16:44:27 +00:00
Evgeniy Stepanov
8a3666f63c
[sanitizer] Workaround broken mktemp on certain platforms.
...
llvm-svn: 172827
2013-01-18 16:24:50 +00:00
Alexey Samsonov
163ab9d0a5
CMake: create AddCompilerRT module and implement convenience add_compiler_rt_object_library function
...
llvm-svn: 172826
2013-01-18 16:05:21 +00:00
Evgeniy Stepanov
c8cde8d736
[sanitizer] Enable cpplint for .inc files.
...
llvm-svn: 172825
2013-01-18 15:53:43 +00:00
Evgeniy Stepanov
01671c33ff
[sanitizer] lint
...
llvm-svn: 172817
2013-01-18 13:12:56 +00:00
Alexey Samsonov
4b0ee8ecd5
CMake: start to generalize rules for non-x86 architectures
...
llvm-svn: 172816
2013-01-18 13:10:42 +00:00
Kostya Serebryany
84c7e47b5c
[asan] kill some dead code
...
llvm-svn: 172815
2013-01-18 13:01:44 +00:00
Evgeniy Stepanov
a6c4a387ee
[sanitizer] Rename 2 files *.h->*.inc as appropriate.
...
Also add a missing include.
llvm-svn: 172814
2013-01-18 13:01:18 +00:00