summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/msan
Commit message (Collapse)AuthorAgeFilesLines
...
* [compiler-rt] Add common interceptor for wcrtomb. Eric Fiselier2015-08-261-0/+10
| | | | | | | | | | | | Summary: Currently there is a libc++ test failing under MSAN because wcrtomb is not intercepted. This patch adds an interceptor for it. Reviewers: samsonov, eugenis Subscribers: tberghammer, danalbert, srhines, llvm-commits Differential Revision: http://reviews.llvm.org/D12311 llvm-svn: 245994
* [CMake] merge add_compiler_rt_runtime and add_compiler_rt_darwin_runtime ↵Chris Bieneman2015-08-251-6/+10
| | | | | | | | | | | | | | | | into a single function Summary: This refactoring moves much of the Apple-specific behavior into a function in AddCompilerRT. The next cleanup patch will remove more of the if(APPLE) checks in the outlying CMakeLists. This patch adds a bunch of new functionality to add_compiler_rt_runtime so that the target names don't need to be reconstructed outside the call. It also updates some of the call sites to exercise the new functionality, but does not update all uses fully. Subsequent patches will further update call sites and move to using the new features. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: beanz, rengolin, llvm-commits Differential Revision: http://reviews.llvm.org/D12292 llvm-svn: 245970
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-243-7/+0
| | | | | | | | | | | Previously we had to call __sanitizer_cov_dump() from tool-specific callbacks - instead, let sanitizer_common library handle this in a single place. This is a re-application of r245770, with slightly different approach taken. llvm-svn: 245890
* [Sanitizers] Allow to install several internal Die callbacks.Alexey Samsonov2015-08-241-1/+1
| | | | | | | | | | | | | | | | | This is required to properly re-apply r245770: 1) We should be able to dump coverage in __sanitizer::Die() if coverage collection is turned on. 2) We don't want to explicitly do this in every single sanitizer that supports it. 3) We don't want to link in coverage (and therefore symbolization) bits into small sanitizers that don't support it (safestack). The solution is to make InitializeCoverage() register its own Die() callback that would call __sanitizer_cov_dump(). This callback should be executed in addition to another tool-specific die callbacks (if there are any). llvm-svn: 245889
* Revert r245770 and r245777.Alexey Samsonov2015-08-223-0/+7
| | | | | | | These changes break both autoconf Mac OS X buildbot (linker errors due to wrong Makefiles) and CMake buildbot (safestack test failures). llvm-svn: 245784
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-223-7/+0
| | | | | | | Previously we had to call __sanitizer_cov_dump() from tool-specific callbacks - instead, let sanitizer_common library handle this in a single place. llvm-svn: 245770
* [MSan] Deprecate __msan_set_death_callback() in favor of ↵Alexey Samsonov2015-08-213-7/+1
| | | | | | __sanitizer_set_death_callback(). llvm-svn: 245754
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-214-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all sanitizers. Summary: Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan into one entity. Additionally, make sure sanitizer_common now uses the value of common_flags()->exitcode when dying on error, so that this flag will automatically work for other sanitizers (UBSan and DFSan) as well. User-visible changes: * "exit_code" MSan runtime flag is now deprecated. If explicitly specified, this flag will take precedence over "exitcode". The users are encouraged to migrate to the new version. * __asan_set_error_exit_code() and __msan_set_exit_code() functions are removed. With few exceptions, we don't support changing runtime flags during program execution - we can't make them thread-safe. The users should use __sanitizer_set_death_callback() that would call _exit() with proper exit code instead. * Plugin tools (LSan and UBSan) now inherit the exit code of the parent tool. In particular, this means that ASan would now crash the program with exit code "1" instead of "23" if it detects leaks. Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12120 llvm-svn: 245734
* [msan] Intercept openpty and forkpty.Evgeniy Stepanov2015-08-181-0/+24
| | | | llvm-svn: 245345
* -Wdeprecated: Use noexcept rather than throw() where supportedDavid Blaikie2015-08-101-2/+2
| | | | | | | | | | Summary: I've copy/pasted the LLVM_NOEXCEPT definition macro goo from LLVM's Compiler.h. Is there somewhere I should put this in Compiler RT? Is there a useful header to define/share things like this? Reviewers: samsonov Differential Revision: http://reviews.llvm.org/D11780 llvm-svn: 244453
* [CMake] Don't build libc++ with MSan-with-calls instrumentation.Alexey Samsonov2015-07-311-13/+14
| | | | | | | Instead, refactor the build rules so that we build libc++ with MSan for each supported architecture. llvm-svn: 243785
* [sanitizer] Implement include_if_exists with process name substitution.Evgeniy Stepanov2015-07-211-1/+1
| | | | | | | | | include_if_exists=/path/to/sanitizer/options reads flags from the file if it is present. "%b" in the include file path (for both variants of the flag) is replaced with the basename of the main executable. llvm-svn: 242853
* re-added changes due to svn config setting issuesNaomi Musgrave2015-07-174-1/+15
| | | | llvm-svn: 242589
* [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov2015-06-291-1/+1
| | | | | | | On Android L, TSD destructors run 8 times instead of 4. Back to 4 times on the current master branch (as well as on K). llvm-svn: 240992
* [msan] Fix infinite recursion when _Unwind_Backtrace calls memcpyJay Foad2015-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On PPC64, half the msan tests fail with an infinite recursion through GetStackTrace like this: #0 __msan::GetStackTrace #1 __msan_memcpy #2 ?? () from /lib64/libgcc_s.so.1 #3 ?? () from /lib64/libgcc_s.so.1 #4 _Unwind_Backtrace #5 __sanitizer::BufferedStackTrace::SlowUnwindStack #6 __sanitizer::BufferedStackTrace::Unwind #7 __msan::GetStackTrace #8 __interceptor_calloc #9 _dl_allocate_tls #10 pthread_create@@GLIBC_2.17 #11 __interceptor_pthread_create #12 main The problem is that we call _Unwind_Backtrace to get a stack trace; but _Unwind_Backtrace calls memcpy, which we intercept and try to get another stack trace. This patch fixes it in __msan_memcpy by skipping the stack trace if IsInSymbolizer(). This works because GetStackTrace already creates a SymbolizerScope to "block reports from our interceptors during _Unwind_Backtrace". Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10762 llvm-svn: 240878
* [msan] Fix SetShadow for mappings at the end of the application address spaceJay Foad2015-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: On PPC64 if you disable ASLR (or run under gdb) you're likely to see mmap returning a mapping right at the end of the application address space region. This caused SetShadow to call MEM_TO_SHADOW() on the last+1 address in the region, which seems wrong to me; how can MEM_TO_SHADOW() distinguish this from the first address in the following region? Fixed by only calling MEM_TO_SHADOW() once, on the start address. Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10735 llvm-svn: 240690
* Enable memory sanitizer for PPC64Jay Foad2015-06-252-0/+28
| | | | | | | | | | | | | | | | | | Summary: This patch adds basic memory sanitizer support for PPC64. PR23219. I have further patches ready to enable it in LLVM and Clang, and to fix most of the many failing tests in check-msan. Reviewers: kcc, willschm, samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: wschmidt, llvm-commits Differential Revision: http://reviews.llvm.org/D10648 llvm-svn: 240623
* CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Use CMake's cmake_parse_arguments() instead. It's called in a slightly different way, but supports all our use cases. It's in CMake 2.8.8, which is our minimum supported version. CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc): http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments Since I was already changing these calls, I changed ARCH and LIB into ARCHS and LIBS to make it more clear that they're lists of arguments. Reviewers: eugenis, samsonov, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10529 llvm-svn: 240120
* [ASan] Make binary name reader cross-platform.Yury Gribov2015-06-041-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D10213 llvm-svn: 239020
* Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.Evgeniy Stepanov2015-05-291-5/+5
| | | | | | | | | | | | | | | | | | This is done by creating a named shared memory region, unlinking it and setting up a private (i.e. copy-on-write) mapping of that instead of a regular anonymous mapping. I've experimented with regular (sparse) files, but they can not be scaled to the size of MSan shadow mapping, at least on Linux/X86_64 and ext3 fs. Controlled by a common flag, decorate_proc_maps, disabled by default. This patch has a few shortcomings: * not all mappings are annotated, especially in TSan. * our handling of memset() of shadow via mmap() puts small anonymous mappings inside larger named mappings, which looks ugly and can, in theory, hit the mapping number limit. llvm-svn: 238621
* [msan] Mprotect all inaccessible memory regions.Evgeniy Stepanov2015-05-243-12/+33
| | | | | | | | | | | | | | | | | Fix 2 bugs in memory mapping setup: - the invalid region at offset 0 was not protected because mmap at address 0 fails with EPERM on most Linux systems. We did not notice this because the check condition was flipped: the code was checking that mprotect has failed. And the test that was supposed to catch this was weakened by the mitigations in the mmap interceptor. - when running without origins, the origin shadow range was left unprotected. The new test ensures that mmap w/o MAP_FIXED always returns valid application addresses. llvm-svn: 238109
* [sanitizer] Recognize static TLS in __tls_get_addr interceptor.Evgeniy Stepanov2015-05-161-0/+8
| | | | | | | Current code tries to find the dynamic TLS header to the left of the TLS block without checking that it's not a static TLS allocation. llvm-svn: 237495
* Export __ubsan_* symbols from MSan and TSan runtimes.Alexey Samsonov2015-04-281-0/+1
| | | | llvm-svn: 235958
* Allow UBSan+MSan and UBSan+TSan combinations (Clang part).Alexey Samsonov2015-04-283-5/+34
| | | | | | | | Embed UBSan runtime into TSan and MSan runtimes in the same as we do in ASan. Extend UBSan test suite to also run tests for these combinations. llvm-svn: 235954
* Introduce tsan_cxx and msan_cxx libraries (compiler-rt part).Alexey Samsonov2015-04-271-4/+14
| | | | | | | | For now tsan_cxx and msan_cxx contain only operator new/delete replacements. In the future, when we add support for running UBSan+TSan and UBSan+MSan, they will also contain bits ubsan_cxx runtime. llvm-svn: 235928
* [MSan] Prepare for splitting msan_new_delete.cc into a separate library. NFC.Alexey Samsonov2015-04-273-10/+0
| | | | llvm-svn: 235926
* Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portableTimur Iskhodzhanov2015-04-101-1/+1
| | | | | | | On Windows, we have to know if a memory to be protected is mapped or not. On POSIX, Mprotect was semantically different from mprotect most people know. llvm-svn: 234602
* sanitizer: new "strict_string_checks" run-time flagDmitry Vyukov2015-04-061-3/+16
| | | | | | | | | | This patch is related to Issue 346: moar string interceptors: strstr, strcasestr, strcspn, strpbrk As was suggested in original review http://reviews.llvm.org/D6056 a new "strict_string_checks" run-time flag introduced. The flag support applied for existing common, asan, msan and tsan interceptors. New asan tests added. Change by Maria Guseva reviewed in http://reviews.llvm.org/D7123 llvm-svn: 234187
* [Sanitizer] Be consistent about separating ==%PID== and logged data.Alexey Samsonov2015-03-311-2/+2
| | | | | | See https://code.google.com/p/address-sanitizer/issues/detail?id=385. llvm-svn: 233720
* [Sanitizer] Fix/suppress compiler warnings in unit tests.Alexey Samsonov2015-03-041-0/+1
| | | | llvm-svn: 231293
* [msan] Fix MsanTest to pass in track_origins=2 mode.Evgeniy Stepanov2015-02-264-23/+39
| | | | llvm-svn: 230639
* Remove support for building sanitizers from Makefile/autoconf build on Linux.Alexey Samsonov2015-02-181-24/+0
| | | | | | | This is a re-application of r229554 restricted to Linux build only. Apple still uses Makefile/autoconf to build Clang and sanitizers. llvm-svn: 229756
* [MSan][MIPS] Fix for some failing tests on MIPS64Mohit K. Bhakkad2015-02-181-2/+7
| | | | | | | | | | | | | | Enabling internal ptrace for mips, which fixes some ptrace related tests. Along with this fixing some other failures. Reviewers: Reviewers: eugenis, kcc, samsonov Subscribers: dsanders, sagar, lldb-commits Differential Revision: http://reviews.llvm.org/D7332 llvm-svn: 229656
* Revert "Remove support for building sanitizers from Makefile/autoconf build."Matthias Braun2015-02-171-0/+24
| | | | | | | | | This reverts commit r229556. Reverting this for now as internal apple builds rely on this functionality. llvm-svn: 229585
* Remove support for building sanitizers from Makefile/autoconf build.Alexey Samsonov2015-02-171-24/+0
| | | | | | | | They autotools build has a number of missing features, supports less OS, architectures, build configurations, doesn't have any tests and is hard to support in sync with CMake build. llvm-svn: 229556
* [Msan] Fix the unit tests' PathToLoadable() to work on FreeBSDViktor Kutuzov2015-02-171-21/+35
| | | | | | Differential Revision: http://reviews.llvm.org/D7587 llvm-svn: 229491
* [msan] Fix UnalignedLoad/UnalignedStore tests.Evgeniy Stepanov2015-02-161-9/+8
| | | | | | | Add alignment attrubutes to ensure that the tests actually test unaligned access irrespective of the stack layout. llvm-svn: 229398
* [Msan] Improve the EXPECT_NOT_POISONED() macro to provide the original line ↵Viktor Kutuzov2015-02-161-3/+3
| | | | | | | | number Differential Revision: http://reviews.llvm.org/D7341 llvm-svn: 229389
* [Msan] Make unit tests that use mempcpy() passing on FreeBSDViktor Kutuzov2015-02-161-0/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D7588 llvm-svn: 229388
* [Msan] Disable the fgetgrent_r unit test on FreeBSDViktor Kutuzov2015-02-161-0/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D7343 llvm-svn: 229387
* [Msan] Disable fcvt unit tests on FreeBSDViktor Kutuzov2015-02-161-1/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D7340 llvm-svn: 229386
* [Msan] Fix the getgrnam_r unit test to pass on FreeBSDViktor Kutuzov2015-02-161-1/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D7339 llvm-svn: 229385
* [Msan] Fix the sigaction unit test to build on FreeBSDViktor Kutuzov2015-02-161-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D7335 llvm-svn: 229384
* [Msan] Fix the ether unit test to build on FreeBSDViktor Kutuzov2015-02-161-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D7334 llvm-svn: 229383
* [Sanitizer] Change InitializeFlags() signatures. NFC.Alexey Samsonov2015-02-121-7/+7
| | | | | | | These functions are always used to initialize singleton flags(), as well as other global data (common_flags()). llvm-svn: 228894
* [Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.Alexey Samsonov2015-02-121-1/+1
| | | | llvm-svn: 228893
* [Msan] Fix the pthread_attr_get unit test to build on FreeBSDViktor Kutuzov2015-02-041-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D7342 llvm-svn: 228125
* [ASan] Add use_madv_dontdump flag.Yury Gribov2015-02-031-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D7294 llvm-svn: 227959
* Fix missed #endif in rL227790.Viktor Kutuzov2015-02-021-0/+1
| | | | llvm-svn: 227797
* [Msan] Disable unit tests for non-FreeBSD functions on FreeBSDViktor Kutuzov2015-02-021-0/+50
| | | | | | Differential Revision: http://reviews.llvm.org/D7252 llvm-svn: 227790
OpenPOWER on IntegriCloud