Alexey Samsonov
734aab4066
[Sanitizer] Use a common mutex to prevent mixing reports from different sanitizers. This fixes PR15516
...
llvm-svn: 178853
2013-04-05 07:30:29 +00:00
Evgeniy Stepanov
7b0e132551
[sanitizer] Use ucontext_t instead of "struct ucontext".
...
Fixes Mac build.
llvm-svn: 178755
2013-04-04 09:03:56 +00:00
Evgeniy Stepanov
1f8b3538b4
[msan] Unpoison siginfo_t and ucontext_t in signal handlers.
...
Add wrappers for all user signal handlers to unpoison the handler's arguments.
llvm-svn: 178754
2013-04-04 08:22:52 +00:00
Kostya Serebryany
c3525ce6ac
[sanitizer] while doing fast unwinding make sure that the frame pointer is aligned; fix lint
...
llvm-svn: 178747
2013-04-04 06:52:40 +00:00
Evgeniy Stepanov
f8213b4eb3
[sanitizer] More interceptors.
...
getpwnam, getpwuid, getpwnam_r, getpwuid_r, clock_getres, clock_gettime,
clock_settime, getitimer, setitimer, sigaction (MSan).
llvm-svn: 178465
2013-04-01 14:47:21 +00:00
Alexander Potapenko
f8109dd0f8
[libsanitizer] Unmapping the old cache partially invalidates the memory layout, so add
...
a flag to skip cache update for cases when that's unacceptable (e.g. lsan).
Patch by Sergey Matveev (earthdok@google.com )
llvm-svn: 178000
2013-03-26 10:34:37 +00:00
Richard Smith
c91e327cba
Build and install .syms files alongside sanitizer runtimes. These are used to
...
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.
llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Evgeniy Stepanov
ecbf64648f
[msan] Handle dlopen() failure in dlopen interceptor.
...
llvm-svn: 177728
2013-03-22 11:59:49 +00:00
Evgeniy Stepanov
93a842bd1f
[msan] Move test main and gtest include to separate files.
...
llvm-svn: 177718
2013-03-22 09:01:26 +00:00
Evgeniy Stepanov
bfe9df221d
[msan] Place dlopen in an anon namespace.
...
llvm-svn: 177716
2013-03-22 08:49:36 +00:00
Evgeniy Stepanov
0af672326a
[sanitizer] Replace more platform checks with SANITIZER_ constants.
...
llvm-svn: 177400
2013-03-19 14:33:38 +00:00
Evgeniy Stepanov
b4a218db34
[sanitizer] Don't adjust the size of the user-allocated stack.
...
Moved this code to sanitizer_common.
llvm-svn: 177383
2013-03-19 09:30:52 +00:00
Evgeniy Stepanov
c6bce93591
[msan] Intercept readdir64.
...
llvm-svn: 177065
2013-03-14 12:49:23 +00:00
Evgeniy Stepanov
4062a396c7
[msan] Fix a typo in test.
...
llvm-svn: 177059
2013-03-14 11:58:13 +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
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