summaryrefslogtreecommitdiff
path: root/lib/msan
AgeCommit message (Collapse)Author
2017-05-12[msan] Remove a failing test from MemorySanitizer.ICmpRelationalAlexander Potapenko
This is a follow-up to r302787, which broke MemorySanitizer.ICmpRelational. MSan is now reporting a false positive on the following test case: TestForNotPoisoned((poisoned(-1, 0x80000000U) >= poisoned(-1, 0U))) , which is sort of anticipated, because we're approximating the comparison with an OR of the arguments' shadow values. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302887 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11[asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau
Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10[msan] Fix getmntent{_r} for empty /etc/fstabAdhemerval Zanella
Some configuration (for instance default docker ubuntu images) uses a default empty and invalid /etc/fstab configuration file. It makes any call to getmntent return NULL and it leads to failures on Msan-aarch64{-with-call}-Test/MemorySanitizer.getmntent{_r}. This patch fixes it by creating a temporary file with some valid entries (although not valid for the system) to use along with setmntent/getmntent. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302639 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02Revert r301904 causing tsan test failure in x86_64-linux-autoconfPierre Gousseau
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02[asan] Add strndup/__strndup interceptors if targeting linux.Pierre Gousseau
Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13[msan] Fix msan_test.cc by checking bind results before assuming IPv6 supported.Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300250 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13Revert "[msan] Fix msan_test broken after r299884."Vitaly Buka
This does not fix the test, it still fails to bind. This reverts commit r300150. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300249 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13[msan] Fix msan_test broken after r299884.Vitaly Buka
Bind to ANY as some machines may have IPv6 support but without IPv6 on loopback interface. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31998 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13[msan] Fix invalid use of vector constructor introduced by r299884.Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10[msan] Choose in runtime if IPv4 or IPv6 are supported.Vitaly Buka
Summary: This reverts commit cab5051c691ce27a7ffac41e8e76ceb222ad9549. Reviewers: eugenis Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D31894 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10[msan] Wrap sockaddr_in and socket for future IPv6 support.Vitaly Buka
Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31893 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10[msan] Reorder unittests for future parametrization.Vitaly Buka
Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31892 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30[sanitizer] Move fread and fwrite interceptors to sanitizer_commonMaxim Ostapenko
{M, T, E}San have fread and fwrite interceptors, let's move them to sanitizer_common to enable ASan checks as well. Differential Revision: https://reviews.llvm.org/D31456 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-29[sanitizers] Fix get_groups interceptor in sanitizer ↵Kostya Serebryany
(https://reviews.llvm.org/D31332, patch by Martin Liška) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14[msan] Intercept wcsncpy, wcsnlen.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297793 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03[msan] Test for _mm_getcsr and _mm_setcsr (r296848).Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky
This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12[sancov] moving sancov rt to sancov/ directoryMike Aizatsky
Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10Make cmake link flag naming consistentFrancis Ricci
Summary: The build system was inconsistent in its naming conventions for link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS, for consistency with cmake's LINK_FLAGS property. This patch should make it easier to search the source code for uses of link flags, as well as providing the benefit of improved style and consistency. Reviewers: compnerd, beanz Subscribers: kubabrecka, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28506 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291539 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27[compiler-rt] Move logic which replace memcpy interceptor with memmove from ↵Vitaly Buka
asan to sanitizer_common. Reviewers: eugenis Subscribers: kubabrecka, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D28074 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23Fix interceptors setup broken after r290382Vitaly Buka
Summary: We setup these interceptors twice which hangs test on windows. Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D28070 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-22Replace WRAP in interceptors with memset, memmove and memcpy implementationVitaly Buka
Summary: According https://reviews.llvm.org/D27659#625093 WRAP adds confusing stack frame. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28039 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che ↵Hans Wennborg
Wu (https://reviews.llvm.org/D27659)" It breaks programs on Mac. See comments on the code review for details. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14[sanitizer] intercept bstring functions, patch by Kuang-che Wu ↵Kostya Serebryany
(https://reviews.llvm.org/D27659) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289690 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08[MSAN][MIPS] Fix fork.cc test on MIPSSagar Thakur
Summary: For platforms which support slow unwinder only, we restrict the store context size to 1, basically only storing the current pc. We do this because the slow unwinder which is based on libunwind is not async signal safe and causes random freezes in forking applications as well as in signal handlers. Reviewed by eugenis. Differential: D23107 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-30Release memory to OS only when the requested range covers the entire pageEvgeniy Stepanov
Summary: The current code was sometimes attempting to release huge chunks of memory due to undesired RoundUp/RoundDown interaction when the requested range is fully contained within one memory page. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27228 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29Return memory to OS right after free (not in the async thread).Evgeniy Stepanov
Summary: In order to avoid starting a separate thread to return unused memory to the system (the thread interferes with process startup on Android, Zygota waits for all threads to exit before fork, but this thread never exits), try to return it right after free. Reviewers: eugenis Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27003 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29Don't use internal symbolizer if we are in process of reporting Out-of-Memory.Vitaly Buka
Reviewed by eugenis offline, as reviews.llvm.org is down. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282805 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26[msan] Fix second parameter in MsanReallocate from previous commit.Maxim Ostapenko
It's wrong to pass to MsanReallocate a pointer that MSan allocator doesn't own. Use nullptr instead of ptr to prevent possible (still unlikely) failure. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26[asan, msan] Fix reallocation logic when IsInDlsymAllocPool(ptr) is true.Maxim Ostapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23[msan] Prevent initialization failure with newer (2.23+) glibc in use.Maxim Ostapenko
This patch is pretty the same as http://reviews.llvm.org/D20235 that we used for ASan. Using the same hack for MSan fixes its initialization with newer Glibc in use. Differential Revision: https://reviews.llvm.org/D24736 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15[compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks
The definitions in sanitizer_common may conflict with definitions from system headers because: The runtime includes the system headers after the project headers (as per LLVM coding guidelines). lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry. Differential Revision: https://reviews.llvm.org/D21947 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany
madvise. Requires quite some tuning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26Additional update missed by r279793, should hopefully make the PPC sanitizer ↵Richard Smith
bots happy again. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279798 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[sanitizer] enable random shuffling the memory chunks inside the allocator, ↵Kostya Serebryany
under a flag. Set this flag for the scudo allocator, add a test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25[sanitizer] change SizeClassAllocator64 to accept just one template ↵Kostya Serebryany
parameter instead of 5. First, this will make the mangled names shorter. Second, this will make adding more parameters simpler. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25msan: Enable 48-bit VMA support on aarch64Adhemerval Zanella
This patch adds 48-bits VMA support for msan on aarch64. As current mappings for aarch64, 48-bit VMA also supports PIE executable. The 48-bits segments only cover the usual PIE/default segments plus some more segments (262144GB total, 0.39% total VMA). Memory avaliability can be increase by adding multiple application segments like 39 and 42 mapping (some mappings were added on this patch as well). Tested on 39 and 48-bit VMA kernels on aarch64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279752 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-20[msan] Disable prlimit test on glibc < 2.13.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-16[MSAN][MIPS] Changed memory mapping to support pie executable.Sagar Thakur
Reviewed by eugenis Differential: D22993 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09[sanitizer] use 32-bit offset instead of 64-bit pointers in the 64-bit ↵Kostya Serebryany
allocator's transfer batches. This saves 2x memory for the transfer batches (up to ~1.5% overall in some cases) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16[sanitizers] introduce yet another API function: ↵Kostya Serebryany
__sanitizer_install_malloc_and_free_hooks git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272943 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31__builtin_ia32_storeups is no more. Replace it with xmmintrin.h intrinsic.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19Revert "[sanitizer] Move *fstat to the common interceptors"Benjamin Kramer
This reverts commit r269981. Breaks msan tests on linux http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24019/steps/test%20standalone%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18[sanitizer] Move *fstat to the common interceptorsMike Aizatsky
Summary: Adds *fstat to the common interceptors. Removes the now-duplicate fstat interceptor from msan/tsan This adds fstat to asan/esan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D20318 with ios build fixes. Reviewers: eugenis, vitalybuka, aizatsky Subscribers: zaks.anna, kcc, bruening, kubabrecka, srhines, danalbert, tberghammer Differential Revision: http://reviews.llvm.org/D20350 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17Revert "[sanitizer] Move *fstat to the common interceptors"Mike Aizatsky
This reverts commit http://reviews.llvm.org/rL269856 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17[sanitizer] Move *fstat to the common interceptorsMike Aizatsky
Summary: Adds *fstat to the common interceptors. Removes the now-duplicate fstat interceptor from msan/tsan This adds fstat to asan/esan, which previously did not intercept it. Reviewers: eugenis, vitalybuka, aizatsky Subscribers: tberghammer, danalbert, srhines, kubabrecka, bruening, kcc Differential Revision: http://reviews.llvm.org/D20318 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269856 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11[sanitizer] Move *stat to the common interceptorsEvgeniy Stepanov
Adds *stat to the common interceptors. Removes the now-duplicate *stat interceptor from msan/tsan/esan. This adds *stat to asan, which previously did not intercept it. Patch by Qin Zhao. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09[MSan] Add a test for vararg with lots of non-vararg arguments.Marcin Koscielnicki
This is a testcase for http://llvm.org/PR27646, hitting the bug on x86_64, aarch64, mips. Differential Revision: http://reviews.llvm.org/D19944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268981 91177308-0d34-0410-b5e6-96231b3b80d8