summaryrefslogtreecommitdiff
path: root/lib/msan
AgeCommit message (Collapse)Author
2016-05-03[sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky
Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D19875 with win build fixes. Reviewers: aizatsky, eugenis Subscribers: tberghammer, llvm-commits, danalbert, vitalybuka, bruening, srhines, kubabrecka, kcc Differential Revision: http://reviews.llvm.org/D19890 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03Revert "[sanitizer] Move stat/__xstat to the common interceptors"Mike Aizatsky
This reverts commit 268440 because it breaks the windows bot. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21425/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03[sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky
Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Reviewers: aizatsky, eugenis Subscribers: tberghammer, danalbert, srhines, kubabrecka, llvm-commits, vitalybuka, eugenis, kcc, bruening Differential Revision: http://reviews.llvm.org/D19875 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29[msan] Tests for vector compare intrinsics.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[MSan] [PowerPC] Dereference function descriptors when recording stack origins.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19543 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizers] Get the proper symbol version when long double transition is ↵Marcin Koscielnicki
involved. On linux, some architectures had an ABI transition from 64-bit long double (ie. same as double) to 128-bit long double. On those, glibc symbols involving long doubles come in two versions, and we need to pass the correct one to dlvsym when intercepting them. A few more functions we intercept are also versioned (all printf, scanf, strtold variants), but there's no need to fix these, as the REAL() versions are never called. Differential Revision: http://reviews.llvm.org/D19555 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.Marcin Koscielnicki
In short, CVE-2016-2143 will crash the machine if a process uses both >4TB virtual addresses and fork(). ASan, TSan, and MSan will, by necessity, map a sizable chunk of virtual address space, which is much larger than 4TB. Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug is detected. Disable all three by aborting on process initialization if the running kernel version is not known to contain a fix. Unfortunately, there's no reliable way to detect the fix without crashing the kernel. So, we rely on whitelisting - I've included a list of upstream kernel versions that will work. In case someone uses a distribution kernel or applied the fix themselves, an override switch is also included. Differential Revision: http://reviews.llvm.org/D19576 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizers] [NFC] Add defines for the various PowerPC ABIs.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25[MSan] Use COMMON_INTERCEPTOR_ENTER in libdl interceptors.Marcin Koscielnicki
This fixes fails in test/msan/dlerror.cc - when real dlerror calls strcmp, our strcmp interceptor now skips poison checking, since it's called in interceptor context. Strictly speaking, only the dlerror change is necessary to fix the fail, but let's also change the other two just in case. Differential Revision: http://reviews.llvm.org/D19499 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] rename MmapNoAccess to MmapFixedNoAccess; NFCKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-20[msan] Implement GetPageSize in the test.Evgeniy Stepanov
Instead of calling a sanitizer_common function, implement GetPageSize in the test directly. MSan runtime does not export __sanitizer::* symbols, and the current code breaks when the test and the runtime library are in the separate link units (ex. when the test is built as a shared library). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18[msan] Don't hardcode 4kiB page size in msan_test.cc.Marcin Koscielnicki
This breaks the valloc test on PowerPC, which has 64kiB pages. Since getting page size portably is nontrivial, and there's already a function for that in __sanitizer, just use it. Unfortunately, sanitizer_common.h conflicts with the interface headers inclucded by msan_test.cc (and a few of its own macros), so we have to declare it manually. Differential Revision: http://reviews.llvm.org/D19227 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266688 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18[MSan] [PowerPC] Add loadable library name for testing.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19217 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266646 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15Revert "[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to ↵Marcin Koscielnicki
CVE-2016-2143." This reverts commit r266297. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.Marcin Koscielnicki
In short, CVE-2016-2143 will crash the machine if a process uses both >4TB virtual addresses and fork(). ASan, TSan, and MSan will, by necessity, map a sizable chunk of virtual address space, which is much larger than 4TB. Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug is detected. Disable all three by aborting on process initialization if the running kernel version is not known to contain a fix. Unfortunately, there's no reliable way to detect the fix without crashing the kernel. So, we rely on whitelisting - I've included a list of upstream kernel versions that will work. In case someone uses a distribution kernel or applied the fix themselves, an override switch is also included. Differential Revision: http://reviews.llvm.org/D18915 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25[sanitizer] Add memset, memmove, and memcpy to the common interceptorsDerek Bruening
Summary: Currently, sanitizer_common_interceptors.inc has an implicit, undocumented assumption that the sanitizer including it has previously declared interceptors for memset and memmove. Since the memset, memmove, and memcpy routines require interception by many sanitizers, we add them to the set of common interceptions, both to address the undocumented assumption and to speed future tool development. They are intercepted under a new flag intercept_intrin. The tsan interceptors are removed in favor of the new common versions. The asan and msan interceptors for these are more complex (they incur extra interception steps and their function bodies are exposed to the compiler) so they opt out of the common versions and keep their own. Reviewers: vitalybuka Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18465 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23[sanitizer] Add strnlen to the common interceptorsDerek Bruening
Summary: Adds strnlen to the common interceptors, under the existing flag intercept_strlen. Removes the now-duplicate strnlen interceptor from asan and msan. This adds strnlen to tsan, which previously did not intercept it. Adds a new test of strnlen to the sanitizer_common test cases. Reviewers: samsonov Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18397 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18[sancov] common flags initialization.Mike Aizatsky
Summary: Introducing InitializeCommonFlags accross all sanitizers to simplify common flags management. Setting coverage=1 when html_cov_report is requested. Differential Revision: http://reviews.llvm.org/D18273 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11[sanitizer] Add strlen to the common interceptorsAlexey Samsonov
Summary: Adds strlen to the common interceptors, under a new common flag intercept_strlen. This provides better sharing of interception code among sanitizers and cleans up the inconsistent type declarations of the previously duplicated interceptors. Removes the now-duplicate strlen interceptor from asan, msan, and tsan. The entry check semantics are normalized now for msan and asan, whose private strlen interceptors contained multiple layers of checks that included impossible-to-reach code. The new semantics are identical to the old: bypass interception if in the middle of init or if both on Mac and not initialized; else, call the init routine and proceed. Patch by Derek Bruening! Reviewers: samsonov, vitalybuka Subscribers: llvm-commits, kcc, zhaoqin Differential Revision: http://reviews.llvm.org/D18020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-05[cmake] Address Samsonov's post-commit review of r262723Filipe Cabecinhas
Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17896 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262770 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26[MSan] Endianness should not matter while printing a byteMohit K. Bhakkad
Reviewers: eugenis Subscribers: jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D17264 Differential Revision: http://reviews.llvm.org/D17563 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26[MSAN] Fix test SmallPreAllocatedStackThread for MIPSSagar Thakur
Summary: Msan was intercepting version 2.1 of the pthread_create function which was making it to crash in libc because __pthread_create_2_1 modifies the stack attributes of the thread. Intercepting the correct version fixes the test SmallPreAllocatedStackThread. Reviewers: eugenis, samsonov Subscribers: llvm-commits, mohit.bhakkad, jaydeep Differential: http://reviews.llvm.org/D17603 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25[sanitizer] Move recvmsg and recv interceptors to sanitizer_common.Maxim Ostapenko
This patch moves recv and recvfrom interceptors from MSan and TSan to sanitizer_common to enable them in ASan. Differential Revision: http://reviews.llvm.org/D17479 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25[Compiler-rt][MSan]Fix shmat testcase: Pass SHMLBA-alligned address to shmatMohit K. Bhakkad
Reviewers: samsonov Subscribers: jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D17262 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Assign components and dependencies during add_compiler_rt_resource_fileChris Bieneman
This makes it so that component-based installations will include resource files (i.e. blacklists). My next patch will add support for component-based installations. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261699 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22[MSan] Make unaligned load/store functions compatible for both endiansMohit K. Bhakkad
Reviewers: eugenis Subscribers: jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D17371 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[compiler-rt][msan] Ensure initialisation before calling __msan_unpoisonJonas Hahnfeld
__msan_unpoison uses intercepted memset which currently leads to a SEGV when linking with libc++ under CentOS 7. Differential Revision: http://reviews.llvm.org/D17263 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[msan] Extend prlimit test.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[msan] Intercept prlimit.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261048 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16[Compiler-rt][MSan][MIPS] Resolve gethostbyname_r_erange for MIPSMohit K. Bhakkad
Reviewers: eugenis, kcc, samsonov Subscribers: jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D17135 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@260946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12Fix MemorySanitizer.ptrtoint test on big-endian targets.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@260749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20[MSan] Clear parameters shadow before invoking malloc/free hooks.Alexey Samsonov
MSan runtime is not itself instrumented, so we need to explicitly clear shadow for function arguments before calling user-provided functions from runtime (e.g. we already do this for several interceptors). I'm still crafting a test case that would demonstrate this issue reliably, and will commit it later today. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni
With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision: http://reviews.llvm.org/D16165 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14[Sanitizer] Pass proper values to DTLS_on_libc_memalign.Alexey Samsonov
Fix a surprising typo: the old code used to think that dynamic TLS segments were several times larger than they actually are. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257722 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg
compiling" This broke the build. For example, from http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1191/steps/cmake%20stage%201/logs/stdio: -- Compiler-RT supported architectures: aarch64 CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:170 (string): string sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): projects/compiler-rt/lib/CMakeLists.txt:4 (include) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compilingSumanth Gundapaneni
environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision:http://reviews.llvm.org/D15082 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257686 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14[compiler-rt] [msan] Variadic support for AArch64Adhemerval Zanella
Now with variadic support for msan on aarch6 there is no need for XFAIL signal_stress_test anymore. Also to garantee aligned stores for the FP/SIMD arguments enforce the '__msan_va_arg_tls' alignment to sizeof the SIMD register (16). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24[compiler-rt] [msan] Couple of fixes for msan with libc++Adhemerval Zanella
This patch adds some fixes for MSAN with libc++ for aarch64: 1. Adds the libmsan_loadable name for aarch64. 2. Fixes some pthread_attr_setstacksize for aarch64, since glibc sets the mininum stack size to be higher than the x86_64 default (16KB vs 128KB). 3. Fixes a swprintf null char constant definition. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254015 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19Tell clang-format that (most) sanitizers are written using Google style guide.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253608 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19[msan] Don't unpoison phdrs on dlopen(NULL, 0)Reid Kleckner
Summary: dlopen(NULL, ...) is intended to give you back a handle to the executable for use with dlsym. Casting it to link_map and using it with ForEachMappedRegion results in a crash. We also shouldn't unpoison the globals of a DSO that is already in memory. This ensures that we don't do it for the executable, but in general, MSan may have false negatives if the DSO is already loaded. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14795 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253530 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30Revert "Apply modernize-use-default to compiler-rt."Alexey Samsonov
This reverts commit r250823. Replacing at least some of empty constructors with "= default" variants is a semantical change which we don't want. E.g. __tsan::ClockBlock contains a union of large arrays, and it's critical for correctness and performance that we don't memset() these arrays in the constructor. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29[compiler-rt] [msan] Unify aarch64 mappingAdhemerval Zanella
This patch unify the 39-bit and 42-bit mapping for aarch64 to use only one instrumentation algorithm. A runtime check avoid mapping 42-bit only segments for 39-bit kernels. The mapping to use now is for 39 and 42-bits: 0x00000000000ULL-0x01000000000ULL MappingDesc::INVALID 0x01000000000ULL-0x02000000000ULL MappingDesc::SHADOW 0x02000000000ULL-0x03000000000ULL MappingDesc::ORIGIN 0x03000000000ULL-0x04000000000ULL MappingDesc::SHADOW 0x04000000000ULL-0x05000000000ULL MappingDesc::ORIGIN 0x05000000000ULL-0x06000000000ULL MappingDesc::APP 0x06000000000ULL-0x07000000000ULL MappingDesc::INVALID 0x07000000000ULL-0x08000000000ULL MappingDesc::APP And only for 42-bits: 0x08000000000ULL-0x09000000000ULL MappingDesc::INVALID 0x09000000000ULL-0x0A000000000ULL MappingDesc::SHADOW 0x0A000000000ULL-0x0B000000000ULL MappingDesc::ORIGIN 0x0B000000000ULL-0x0F000000000ULL MappingDesc::INVALID 0x0F000000000ULL-0x10000000000ULL MappingDesc::APP 0x10000000000ULL-0x11000000000ULL MappingDesc::INVALID 0x11000000000ULL-0x12000000000ULL MappingDesc::APP 0x12000000000ULL-0x17000000000ULL MappingDesc::INVALID 0x17000000000ULL-0x18000000000ULL MappingDesc::SHADOW 0x18000000000ULL-0x19000000000ULL MappingDesc::ORIGIN 0x19000000000ULL-0x20000000000ULL MappingDesc::INVALID 0x20000000000ULL-0x21000000000ULL MappingDesc::APP 0x21000000000ULL-0x26000000000ULL MappingDesc::INVALID 0x26000000000ULL-0x27000000000ULL MappingDesc::SHADOW 0x27000000000ULL-0x28000000000ULL MappingDesc::ORIGIN 0x28000000000ULL-0x29000000000ULL MappingDesc::SHADOW 0x29000000000ULL-0x2A000000000ULL MappingDesc::ORIGIN 0x2A000000000ULL-0x2B000000000ULL MappingDesc::APP 0x2B000000000ULL-0x2C000000000ULL MappingDesc::INVALID 0x2C000000000ULL-0x2D000000000ULL MappingDesc::SHADOW 0x2D000000000ULL-0x2E000000000ULL MappingDesc::ORIGIN 0x2E000000000ULL-0x2F000000000ULL MappingDesc::APP 0x2F000000000ULL-0x39000000000ULL MappingDesc::INVALID 0x39000000000ULL-0x3A000000000ULL MappingDesc::SHADOW 0x3A000000000ULL-0x3B000000000ULL MappingDesc::ORIGIN 0x3B000000000ULL-0x3C000000000ULL MappingDesc::APP 0x3C000000000ULL-0x3D000000000ULL MappingDesc::INVALID 0x3D000000000ULL-0x3E000000000ULL MappingDesc::SHADOW 0x3E000000000ULL-0x3F000000000ULL MappingDesc::ORIGIN 0x3F000000000ULL-0x40000000000ULL MappingDesc::APP And although complex it provides a better memory utilization that previous one. [1] http://reviews.llvm.org/D13817 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251625 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21[msan] Build unit test shared library code with -fPIC.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20Apply modernize-use-default to compiler-rt.Angel Garcia Gomez
Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: klimek, bkramer Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13892 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250823 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12[msan] Add __msan_copy_shadow interface function.Evgeniy Stepanov
This can be used to annotate copies of memory that are not observed by MSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08Fix msan tests build.Evgeniy Stepanov
CMake build rules listed -I flags for two different libc++ header locations which broke when libc++ headers started using include_next. Also change -I to -isystem to avoid compiler warning about include_next. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249759 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08New MSan mapping layout (compiler-rt part).Evgeniy Stepanov
This is an implementation of https://github.com/google/sanitizers/issues/579 It has a number of advantages over the current mapping: * Works for non-PIE executables. * Does not require ASLR; as a consequence, debugging MSan programs in gdb no longer requires "set disable-randomization off". * Supports linux kernels >=4.1.2. * The code is marginally faster and smaller. This is an ABI break. We never really promised ABI stability, but this patch includes a courtesy escape hatch: a compile-time macro that reverts back to the old mapping layout. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249754 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01[compiler-rt] Apply modernize-use-nullptr fixes in sanitizersVedant Kumar
- Trim spaces. - Use nullptr in place of 0 for pointer variables. - Use '!p' in place of 'p == 0' for null pointer checks. - Add blank lines to separate function definitions. - Add 'extern "C"' or 'namespace foo' comments after the appropriate closing brackets This is a continuation of work from 409b7b82. The focus here is on the various sanitizers (not sanitizer_common, as before). Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13225 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248966 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29[msan] Early allocator initialization.Evgeniy Stepanov
Map MSan heap space early (in __msan_init) so that user code can not accidentally (i.e. w/o MAP_FIXED) create a conflicting mapping. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248829 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16[MSan] Enable MSAN for aarch64Adhemerval Zanella
This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA. As defined by lib/msan/msan.h the memory layout used is for 39-bit is: 00 0000 0000 - 40 0000 0000: invalid 40 0000 0000 - 43 0000 0000: shadow 43 0000 0000 - 46 0000 0000: origin 46 0000 0000 - 55 0000 0000: invalid 55 0000 0000 - 56 0000 0000: app (low) 56 0000 0000 - 70 0000 0000: invalid 70 0000 0000 - 80 0000 0000: app (high) And for 42-bit VMA: 000 0000 0000 - 100 0000 0000: invalid 100 0000 0000 - 11b 0000 0000: shadow 11b 0000 0000 - 120 0000 0000: invalid 120 0000 0000 - 13b 0000 0000: origin 13b 0000 0000 - 2aa 0000 0000: invalid 2aa 0000 0000 - 2ab 0000 0000: app (low) 2ab 0000 0000 - 3f0 0000 0000: invalid 3f0 0000 0000 - 400 0000 0000: app (high) Most of tests are passing with exception of: * Linux/mallinfo.cc * chained_origin_limits.cc * dlerror.cc * param_tls_limit.cc * signal_stress_test.cc * nonnull-arg.cpp The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8' instead of default first argument 'x1'. So a function prototype that aims to mimic (by using first argument as the return of function) won't work. For GCC one can make a register alias (register var asm ("r8")), but for clang it detects is an unused variable and generate wrong code. The 'chained_origin_limits' is probably due a wrong code generation, since it fails only when origin memory is used (-fsanitize-memory-track-origins=2) and only in the returned code (return buf[50]). The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic argument handling in memory sanitizer code instrumentation on LLVM side. Both 'dlerror' and 'param_tls_test' are unknown failures that require further investigation. All the failures are XFAIL for aarch64 for now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247809 91177308-0d34-0410-b5e6-96231b3b80d8