summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/msan
Commit message (Collapse)AuthorAgeFilesLines
* [msan] Fix underflow in qsort interceptor.Evgenii Stepanov2020-01-061-0/+7
|
* [msan] Check qsort input.Evgenii Stepanov2020-01-061-0/+5
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* Reland "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-271-0/+73
| | | | | | | This reverts commit 8fcce5ac73d49981656d9126e6c88391c1f6bf01. I spoke too soon, the revert does not actually cause the startup crash to go away.
* Revert "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-271-73/+0
| | | | | | | | | | | | | | | | | | | This reverts commit 7a9ebe95125ea87a494d0c18f44f10bd70e12188, and dependent commit 54c522420347e58aa7bae1892cf5c5672b57c875, which disables qsort interception for some iOS platforms. After this change, the -Nolibc sanitizer common test binary crashes on startup on my regular Linux workstation, as well as on our bots: https://ci.chromium.org/p/chromium/builders/try/linux_upload_clang/740 ******************** Failing Tests (1): SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test/SanitizerCommon.NolibcMain Loading it up in gdb shows that it crashes during relocation processing, which suggests that some glibc loader versions do not support the THREADLOCAL data added in this interceptor.
* Revert "[msan] Check qsort input."Evgenii Stepanov2019-12-261-5/+0
| | | | | | | | | | | | | This change breaks LLVM bootstrap with ASan and MSan. FAILED: lib/ToolDrivers/llvm-lib/Options.inc OptParser.td:137:1: error: Option is equivalent to def INPUT : Option<[], "<input>", KIND_INPUT>; ^ OptParser.td:137:1: error: Other defined here def INPUT : Option<[], "<input>", KIND_INPUT>; This reverts commit caa48a6b88aeed8ae80e6ddb1eae8c6a7cbe260b.
* [msan] Check qsort input.Evgenii Stepanov2019-12-231-0/+5
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-231-0/+73
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* Revert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."Jonas Devlieghere2019-12-201-78/+0
| | | | | | | | | | | | | | Temporarily revert the qsort changes because they fail to build on bots that build with modules: > error: thread-local storage is not supported for the current > target (iossim) http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/1820/console http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/4983/console This reverts commit ddf897fc80499ece298bc33201db6b697d2af50e. This reverts commit 07861e955d0095f25639d84c5726c73b528567cb.
* [msan] Check qsort input.Evgenii Stepanov2019-12-201-0/+5
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-201-0/+73
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* [compiler-rt] [test] Add missing %run to fread_fwrite MSAN testMichał Górny2019-12-191-1/+1
| | | | | | | | Add a missing %run substitution to fread_fwrite test. This fixes the test on NetBSD where %run disables ASLR as necessary for MSAN to function. Differential Revision: https://reviews.llvm.org/D71623
* [compiler-rt] [test] Disable ASLR on ASAN/MSAN/TSAN tests on NetBSDMichał Górny2019-12-061-0/+3
| | | | | | | | Use a new %run wrapper for ASAN/MSAN/TSAN tests that calls paxctl in order to disable ASLR on the test executables. This makes it possible to test sanitizers on systems where ASLR is enabled by default. Differential Revision: https://reviews.llvm.org/D70958
* Reland "[compiler-rt] Fix tests after 03b84e4f6d0"Jan Korous2019-11-081-1/+1
| | | | This reverts commit d6be9273c6035c07b25dd1494f76cd61d523b878.
* Revert "[compiler-rt] Fix tests after 03b84e4f6d0"Jeremy Morse2019-11-081-1/+1
| | | | | | This reverts commit bdeb2724f0aa9c518f94d998d24d8620a1e88727. (Reverting 03b84e4f6d0, so this must come out as well)
* [compiler-rt] Fix tests after 03b84e4f6d0Jan Korous2019-11-071-1/+1
| | | | | | | Fallout from: [clang] Report sanitizer blacklist as a dependency in cc1 Default blacklists are now passed via -fsanitize-system-blacklist from driver to cc1.
* [compiler-rt] [msan] Support POSIX iconv(3) on NetBSD 9.99.17+Kamil Rytarowski2019-11-041-1/+10
| | | | Fixes build of test.
* Fix lld detection in standalone compiler-rt.Evgenii Stepanov2019-10-241-1/+3
| | | | | | | | | | | | | | | Summary: Right now all hwasan tests on Android are silently disabled because they require "has_lld" and standalone compiler-rt can not (and AFAIK was never able to) set it. Reviewers: pcc Subscribers: dberris, mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69405
* [msan] Intercept __getrlimit.Evgeniy Stepanov2019-09-301-0/+16
| | | | | | | | | | | | | | | | | | | | Summary: This interceptor is useful on its own, but the main purpose of this change is to intercept libpthread initialization on linux/glibc in order to run __msan_init before any .preinit_array constructors. We used to trigger on pthread_initialize_minimal -> getrlimit(), but that call has changed to __getrlimit at some point. Reviewers: vitalybuka, pcc Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68168 llvm-svn: 373239
* msan, codegen, instcombine: Keep more lifetime markers used for msanVitaly Buka2019-08-261-0/+18
| | | | | | | | | | | | Reviewers: eugenis Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66695 llvm-svn: 369979
* compiler-rt: Remove .cc from all lit config filesNico Weber2019-08-051-1/+1
| | | | | | All cc files have been renamed to cpp now. llvm-svn: 367911
* compiler-rt: Rename .cc file in test/msan to .cppFangrui Song2019-08-02136-78/+78
| | | | | | Like r367463, but for test/msan. llvm-svn: 367653
* try to fix bots more after r367562Nico Weber2019-08-011-6/+6
| | | | llvm-svn: 367587
* try to fix bots after r367562Nico Weber2019-08-011-3/+3
| | | | llvm-svn: 367586
* compiler-rt: Rename .cc file in lib/msan to .cppNico Weber2019-08-012-11/+11
| | | | | | Like r367463, but for msan. llvm-svn: 367562
* [Sanitizer][ASAN][MSAN] Fix infinite recursion on FreeBSDAlexander Richardson2019-07-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: MSAN was broken on FreeBSD by https://reviews.llvm.org/D55703: after this change accesses to the key variable call __tls_get_addr, which is intercepted. The interceptor then calls GetCurrentThread which calls MsanTSDGet which again calls __tls_get_addr, etc... Using the default implementation in the SANITIZER_FREEBSD case fixes MSAN for me. I then applied the same change to ASAN (introduced in https://reviews.llvm.org/D55596) but that did not work yet. In the ASAN case, we get infinite recursion again during initialization, this time because calling pthread_key_create() early on results in infinite recursion. pthread_key_create() calls sysctlbyname() which is intercepted but COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED returns true, so the interceptor calls internal_sysctlbyname() which then ends up calling the interceptor again. I fixed this issue by using dlsym() to get the libc version of sysctlbyname() instead. This fixes https://llvm.org/PR40761 Reviewers: vitalybuka, krytarowski, devnexen, dim, bsdjhb, #sanitizers, MaskRay Reviewed By: MaskRay Subscribers: MaskRay, emaste, kubamracek, jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65221 llvm-svn: 367442
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-275-5/+5
| | | | | | | | | | | | | These lit configuration files are really Python source code. Using the .py file extension helps editors and tools use the correct language mode. LLVM and Clang already use this convention for lit configuration, this change simply applies it to all of compiler-rt. Reviewers: vitalybuka, dberris Differential Revision: https://reviews.llvm.org/D63658 llvm-svn: 364591
* [MSan] Introduce __msan_unpoison_param().Matt Morehouse2019-05-091-0/+51
| | | | | | | | | | | | | | | | | | | Summary: This allows libFuzzer to unpoison parameter shadow before calling LLVMFuzzerTestOneInput to eliminate the false positives described in https://github.com/google/oss-fuzz/issues/2369. Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, metzman, kcc Tags: #llvm Differential Revision: https://reviews.llvm.org/D61751 llvm-svn: 360379
* [NFC] Use clearer naming for local variablesJF Bastien2019-04-101-9/+9
| | | | llvm-svn: 358145
* [sanitizer] Intercept bzero.Evgeniy Stepanov2019-03-041-0/+16
| | | | | | | | | | | | | | | | Summary: Intercept bzero and enable existing __bzero interceptor in Linux. bzero is deprecated but still used occasionally. Reviewers: vitalybuka Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58850 llvm-svn: 355347
* [msan] Add an interceptor for ttyname().Evgeniy Stepanov2019-03-011-3/+6
| | | | llvm-svn: 355214
* Reland "[compiler-rt] Intercept the bcmp() function."Clement Courbet2019-03-012-2/+2
| | | | | | | Fix test issues on darwin: The REQUIRES for the test should be the same as the guard for whether we intercept bcmp. llvm-svn: 355204
* Revert "[compiler-rt] Intercept the bcmp() function."Vlad Tsyrklevich2019-02-262-2/+2
| | | | | | | This reverts commits r354851, 354852, 354853 and r354888. They were causing build failures on the android sanitizer bot. llvm-svn: 354906
* [compiler-rt] Fix test broken by r354851.Clement Courbet2019-02-262-2/+2
| | | | | | | error: CHECK: expected string not found in input // CHECK: Uninitialized bytes in __interceptor_memcmp at offset 3 llvm-svn: 354852
* [msan] Fix name_to_handle_at test on overlayfs.Evgeniy Stepanov2019-02-191-1/+1
| | | | | | Udev supports name_to_handle_at. Use /dev/null instead of /bin/cat. llvm-svn: 354402
* [msan] Remove cxa_atexit_race.ccVitaly Buka2019-02-191-35/+0
| | | | | | | | | | | | | | | | | | | | | Summary: The goal of the test to check that msan does not crash when code is racy on __cxa_atexit. Original crash was caused by race condition in the glibc. With the msan patch the msan does not crashes however the race is still there and the test triggers it. Because the test relies on triggering of undefined behavior results are not very predictable and it may occasionally crashes or hangs. I don't see how to reasonably improve the test, so I remove it. Reviewers: eugenis, peter.smith Subscribers: jfb, jdoerfert, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58396 llvm-svn: 354377
* [compiler-rt] Build custom libcxx with libcxxabiJonas Hahnfeld2019-02-171-1/+3
| | | | | | | | | | | | | | | This changes add_custom_libcxx to also build libcxxabi and merges the two into a static and hermetic library. There are multiple advantages: 1) The resulting libFuzzer doesn't expose C++ internals and looks like a plain C library. 2) We don't have to manually link in libstdc++ to provide cxxabi. 3) The sanitizer tests cannot interfere with an installed version of libc++.so in LD_LIBRARY_PATH. Differential Revision: https://reviews.llvm.org/D58013 llvm-svn: 354212
* [msan] Don't delete MSanAtExitRecordVitaly Buka2019-02-141-0/+35
| | | | | | | | | | | | | | | | | | Summary: Pre 2.27 libc can run same atexit handler twice We will keep MSanAtExitRecord and reset fun to mark it as executed. Fix PR40162 Reviewers: eugenis Subscribers: jfb, jdoerfert, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58221 llvm-svn: 354005
* [test] Disable sunrpc tests when rpc/xdr.h is missingMichal Gorny2019-01-143-0/+6
| | | | | | | | | | | | | | | | | Disable tests requiring sunrpc when the relevant headers are missing. In order to accommodate that, move the header check from sanitizer_common to base-config-ix, and define the check result as a global variable there. Use it afterwards both for definition needed by sanitizer_common, and to control 'sunrpc' test feature. While at it, remove the append_have_file_definition macro that was used only once, and no longer fits the split check-definition. Bug report: https://github.com/google/sanitizers/issues/974 Differential Revision: https://reviews.llvm.org/D47819 llvm-svn: 351109
* [test] Detect glibc-2.27+ and XFAIL appropriate testsMichal Gorny2019-01-091-0/+5
| | | | | | | | | | | | XFAIL the tests known to fail with glibc-2.27+. This takes away the burden of handling known failures from users, and ensures that we will be verbosely informed when they actually start working again. Bug report: https://bugs.llvm.org/show_bug.cgi?id=37804 Differential Revision: https://reviews.llvm.org/D56062 llvm-svn: 350717
* Enable test/msan/pthread_getname_np.cc for NetBSDKamil Rytarowski2018-12-151-1/+5
| | | | llvm-svn: 349263
* [sanitizer] Use AT_EXECFN in ReExec() if availableBenjamin Kramer2018-11-061-0/+23
| | | | | | | | | | execve("/proc/self/exe") will not work if the binary relies on $EXEC_ORIGIN in an rpath. Query AT_EXECFN instead, which will give the same string that the current binary was exec'd with. Differential Revision: https://reviews.llvm.org/D54113 llvm-svn: 346215
* Mark 4 MSan tests as XFAIL for NetBSDKamil Rytarowski2018-10-094-0/+12
| | | | | | | | | | Failing ones: - chained_origin_with_signals - dtls_test - ioctl_custom - signal_stress_test llvm-svn: 344041
* Mark MSan fork test as UNSUPPORTED on NetBSDKamil Rytarowski2018-10-091-0/+3
| | | | | | This test sometimes hangs for unknown reason. llvm-svn: 344038
* [Msan] Fix unit test linkage issue on FreeBSDDavid Carlier2018-09-111-1/+1
| | | | | | | | | | | | Fix typical relocation linkage issue. Reviwewers: dim, emaste Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D51681 llvm-svn: 341924
* [MSan] Define %clang_kmsan for KMSAN testsAlexander Potapenko2018-09-071-0/+6
| | | | llvm-svn: 341638
* [MSan] store origins for variadic function parameters in ↵Alexander Potapenko2018-09-061-0/+60
| | | | | | | | | | | | | | | | | __msan_va_arg_origin_tls Add the __msan_va_arg_origin_tls TLS array to keep the origins for variadic function parameters. Change the instrumentation pass to store parameter origins in this array. This is a reland of r341528. test/msan/vararg.cc doesn't work on Mips, PPC and AArch64 (because this patch doesn't touch them), XFAIL these arches. Also turned out Clang crashed on i80 vararg arguments because of incorrect origin type returned by getOriginPtrForVAArgument() - fixed it and added a test. llvm-svn: 341554
* [MSan] revert r341528 to unbreak the botsAlexander Potapenko2018-09-061-55/+0
| | | | llvm-svn: 341541
* [MSan] store origins for variadic function parameters in ↵Alexander Potapenko2018-09-061-0/+55
| | | | | | | | | | __msan_va_arg_origin_tls Add the __msan_va_arg_origin_tls TLS array to keep the origins for variadic function parameters. Change the instrumentation pass to store parameter origins in this array. llvm-svn: 341528
* [msan] Remove XFAIL: freebsd from test/msan/tls_reuse.ccFangrui Song2018-08-181-1/+0
| | | | | | This passes now. llvm-svn: 340132
* [CMake] Use normalized Windows target triplesPetr Hosek2018-08-091-1/+1
| | | | | | | | | | | Changes the default Windows target triple returned by GetHostTriple.cmake from the old environment names (which we wanted to move away from) to newer, normalized ones. This also requires updating all tests to use the new systems names in constraints. Differential Revision: https://reviews.llvm.org/D47381 llvm-svn: 339307
OpenPOWER on IntegriCloud