Evgeniy Stepanov
231894a902
[sanitizer] Intercept frexp and friends.
...
llvm-svn: 177056
2013-03-14 11:34:39 +00:00
Evgeniy Stepanov
ead6cf7c72
[msan] Intercept __strdup, strndup, __strndup.
...
llvm-svn: 177052
2013-03-14 11:10:36 +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
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
Evgeniy Stepanov
26d5bc7fdf
[msan] Use sptr instead of ptrdiff_t.
...
llvm-svn: 176854
2013-03-12 07:21:17 +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
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
Evgeniy Stepanov
218c582cb5
[msan] Lit tests for __attribute__((no_sanitize_memory)).
...
llvm-svn: 176248
2013-02-28 11:25:54 +00:00
Evgeniy Stepanov
57d6f737e6
[sanitizer] Add MSan to Makefile-based build rules.
...
llvm-svn: 175737
2013-02-21 13:55:54 +00:00
Evgeniy Stepanov
76dc3a81ea
[msan] Use slow stack unwinder in UMR reports.
...
llvm-svn: 175510
2013-02-19 12:43:18 +00:00
Evgeniy Stepanov
adaca58526
[msan] Fix ReExec on linux.
...
execle(argv[0], ...) is wrong, because argv[0] may contain a PATH-resolvable
program name. Execute /proc/self/exe instead.
llvm-svn: 175504
2013-02-19 11:09:29 +00:00
Evgeniy Stepanov
ea61d08185
[sanitizer] Add interceptors for localtime and friends.
...
llvm-svn: 175499
2013-02-19 09:19:16 +00:00
Kostya Serebryany
ec87e785a3
[msan] don't check shadow inside interceptors if we are inside symbolizer; add weak function __msan_default_options that overrides default options
...
llvm-svn: 175040
2013-02-13 07:19:47 +00:00
Evgeniy Stepanov
e676f66fe3
[msan] Allow zero buf pointer in getcwd() interceptor.
...
llvm-svn: 174970
2013-02-12 14:36:22 +00:00
Alexey Samsonov
93686fc6f1
[MSan] symbolize correct PC when printing Summary message
...
llvm-svn: 174956
2013-02-12 10:46:39 +00:00
Evgeniy Stepanov
257274e754
[msan] Lit tests for MemorySanitizer.
...
Build system setup for MSan lit tests (build with freshly-built clang, run,
check output) - a nearly exact copy from ASan.
First 2 lit tests for MSan.
llvm-svn: 174876
2013-02-11 11:34:26 +00:00
Kostya Serebryany
7b0b9b3b65
[msan] add strip_path_prefix flag; print error summary; don't crash while printing summary if debug info is missing. The tests will follow later once we establish the lit-like tests for msan.
...
llvm-svn: 174595
2013-02-07 08:04:56 +00:00
Kostya Serebryany
bda64b4d40
[sanitizer] make the error messages from sanitizer_common contain the actual tool name
...
llvm-svn: 174059
2013-01-31 14:11:21 +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
Alexey Samsonov
49a32c1d08
[Sanitizer] update style checker script and fix namespace style warnings
...
llvm-svn: 173910
2013-01-30 07:45:58 +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
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
5311754b62
[CMake] Fix compiler-rt tests after r173617
...
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
Evgeniy Stepanov
0e5becb830
[msan] Tests for ICmp handling.
...
llvm-svn: 173456
2013-01-25 15:39:11 +00:00
Kostya Serebryany
fa79cd65e2
[sanitizer] fix calloc overflow in asan/tsan/msan
...
llvm-svn: 173441
2013-01-25 11:46:22 +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
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
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
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
01671c33ff
[sanitizer] lint
...
llvm-svn: 172817
2013-01-18 13:12:56 +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
Alexey Samsonov
193b45f4fe
CMake variables renaming: X86_64->x86_64 I386->i386
...
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Evgeniy Stepanov
91181eaa59
[sanitizer] Fix Mac build.
...
llvm-svn: 172809
2013-01-18 11:38:23 +00:00
Evgeniy Stepanov
222076e972
[sanitizer] Common *scanf interceptors.
...
llvm-svn: 172805
2013-01-18 11:17:23 +00:00
Kostya Serebryany
69fe0ba415
[sanitizer] reapply r172719, r172721-172723, r172725, and also fix the warning on Mac.
...
llvm-svn: 172791
2013-01-18 06:43:13 +00:00
Jakob Stoklund Olesen
7956e0094d
Revert r172719, r172721-172723, and r172725.
...
The r172719 patch broke the build on Mac, the others depended on it.
compiler-rt/lib/asan/asan_interceptors.cc:78:13: error: unused function
'SetThreadName' [-Werror,-Wunused-function]
static void SetThreadName(const char *name) {
Orignal headlines:
[asan] attempting to fix the Mac build
[asan] restructure read/pread/pread64 tests
[sanitizer] move write/pwrite/pwrite64 interceptors to common
[msan] start using common interceptors in msan
[tsan] move prctl interceptor from asan to common_interceptors thus enabling it for tsan too
llvm-svn: 172763
2013-01-17 22:51:56 +00:00
Kostya Serebryany
b114d01849
[msan] start using common interceptors in msan
...
llvm-svn: 172721
2013-01-17 13:57:07 +00:00
Evgeniy Stepanov
e3a325197a
[msan] More interceptors.
...
strtod and friends, dladdr, getrusage
llvm-svn: 172720
2013-01-17 13:42:17 +00:00
Kostya Serebryany
fdcfbda750
[sanitizer] better statistics for the large allocator
...
llvm-svn: 172069
2013-01-10 13:38:38 +00:00
Evgeniy Stepanov
9b52ce94db
[msan] Set program exit code in keep-going mode.
...
llvm-svn: 172057
2013-01-10 11:17:55 +00:00
Kostya Serebryany
4a42cf69a6
[sanitizer] add statistics to the allocator; fix lint
...
llvm-svn: 171161
2012-12-27 14:09:19 +00:00
Alexey Samsonov
c20f5d2246
Define COMPILER_RT_CAN_EXECUTE_TESTS variable on platforms where we can produce working binaries and use it in build rules for sanitizers tests
...
llvm-svn: 171160
2012-12-27 13:19:23 +00:00
Evgeniy Stepanov
8798729a22
[msan] Explicitly link unit tests with libstdc++.
...
llvm-svn: 171151
2012-12-27 08:44:19 +00:00
Evgeniy Stepanov
fee82c68ae
[msan] MSan, New Year Tree style.
...
llvm-svn: 171106
2012-12-26 10:16:45 +00:00
Evgeniy Stepanov
367dc64563
[msan] Refactor report printing.
...
llvm-svn: 171105
2012-12-26 09:32:05 +00:00
Evgeniy Stepanov
794a73124b
[msan] Check for conflicting memory mappings.
...
Check for conflicting memory mappings before attempting to map shadow.
Helps avoid segfault on Linux with disabled ASLR.
llvm-svn: 171100
2012-12-26 06:37:23 +00:00
Evgeniy Stepanov
84f46d9993
[msan] Improve recvfrom interceptor.
...
llvm-svn: 171071
2012-12-25 16:51:57 +00:00
Evgeniy Stepanov
a57662d7c4
Add MSan unit tests to check-msan and check-all.
...
llvm-svn: 171065
2012-12-25 13:10:15 +00:00
Evgeniy Stepanov
f45d92bb22
MemorySanitizer unit tests.
...
llvm-svn: 171062
2012-12-25 12:39:56 +00:00
Evgeniy Stepanov
6722716d78
[msan] Fix header comments.
...
llvm-svn: 171059
2012-12-25 11:53:51 +00:00
Alexey Samsonov
cd1e68ebb1
[Sanitizer] use INTERCEPT_FUNCTION(foo) instead of CHECK(INTERCEPT_FUNCTION(foo)) - this check may fail on Linux if user program defines its own version of library function foo
...
llvm-svn: 170189
2012-12-14 11:52:02 +00:00
Kostya Serebryany
07bb3925b0
[sanitizer] replace size_t with SIZE_T in interceptors (same for ssize_t, off_t and off64_t). This is done to avoid confusion and to make the code work with compilers that define size_t w/o any includes (MSVC)
...
llvm-svn: 170103
2012-12-13 06:31:40 +00:00
Kostya Serebryany
e29883c10a
[sanitizer] add OnMap/OnUmap callbacks to the allocator interface
...
llvm-svn: 169985
2012-12-12 14:32:18 +00:00
Evgeniy Stepanov
4e772db66a
[msan] Remove an extra semicolon.
...
llvm-svn: 169967
2012-12-12 10:50:48 +00:00
Kostya Serebryany
9a58d399c7
[asan] add sanitizer_common/sanitizer_common_interceptors.h with pread/pread64/read interceptors. Use it in asan. Add asan tests for pread/etc. Add FIXME to tsan/msan interceptors
...
llvm-svn: 169966
2012-12-12 09:54:35 +00:00
Evgeniy Stepanov
c5033786ba
[msan] MemorySanitizer runtime.
...
Initial commit of the MemorySanitizer runtime library.
llvm-svn: 169858
2012-12-11 12:27:27 +00:00