Commit Graph

223 Commits

Author SHA1 Message Date
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
Evgeniy Stepanov ea61d08185 [sanitizer] Add interceptors for localtime and friends.
llvm-svn: 175499
2013-02-19 09:19:16 +00:00
Evgeniy Stepanov e676f66fe3 [msan] Allow zero buf pointer in getcwd() interceptor.
llvm-svn: 174970
2013-02-12 14:36:22 +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
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 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 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 ffffbefa43 [msan] gethostbyname interceptor.
llvm-svn: 173249
2013-01-23 10:43:38 +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 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
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 222076e972 [sanitizer] Common *scanf interceptors.
llvm-svn: 172805
2013-01-18 11:17:23 +00:00
Evgeniy Stepanov e3a325197a [msan] More interceptors.
strtod and friends, dladdr, getrusage

llvm-svn: 172720
2013-01-17 13:42:17 +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 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