summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/tests
AgeCommit message (Collapse)Author
2016-01-27using /system/bin/sh on android in tests.Mike Aizatsky
Subscribers: tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D16654 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259001 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26[sanitizers] extracted process management functionsMike Aizatsky
Differential Revision: http://reviews.llvm.org/D16546 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258849 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25Revert "[sanitizers] extracted process management functions"Mike Aizatsky
This reverts commit e5b34d5a2bf4c882bc647dd26a8cea2adc76f63c. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258713 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25[sanitizers] extracted process management functionsMike Aizatsky
Differential Revision: http://reviews.llvm.org/D16542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258710 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-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-04[libsanitizer] Fix bugs and wiki links to point to GitHub.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20[compiler-rt] Do not pull in min and max macros from windows.hAnna Zaks
This should fix Windows buildbot breakage triggered by r253690. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20[compiler-rt] Add internal implementations for strlcat and strlcpyAnna Zaks
The compiler-rt should make use of strlcpy() rather than strncpy(). Using internal_strncpy() may be fine with appropriate bounds checking or enforcement of nul-termination elsewhere, but it's just good practice these days to avoid using strncpy() in new code. A patch by Jeremy Sequoia! Differential Revision: http://reviews.llvm.org/D14714 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253690 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20Reapply: [asan] On OS X, log reports to syslog and os_traceAnna Zaks
When ASan currently detects a bug, by default it will only print out the text of the report to stderr. This patch changes this behavior and writes the full text of the report to syslog before we terminate the process. It also calls os_trace (Activity Tracing available on OS X and iOS) with a message saying that the report is available in syslog. This is useful, because this message will be shown in the crash log. For this to work, the patch makes sure we store the full report into error_message_buffer unconditionally, and it also strips out ANSI escape sequences from the report (they are used when producing colored reports). I've initially tried to log to syslog during printing, which is done on Android right now. The advantage is that if we crash during error reporting or the produced error does not go through ScopedInErrorReport, we would still get a (partial) message in the syslog. However, that solution is very problematic on OS X. One issue is that the logging routine uses GCD, which may spawn a new thread on its behalf. In many cases, the reporting logic locks threadRegistry, which leads to deadlocks. Reviewed at http://reviews.llvm.org/D13452 (In addition, add sanitizer_common_libcdep.cc to buildgo.sh to avoid build failures on Linux.) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253688 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04Revert "Reapply: [asan] On OS X, log reports to syslog and os_trace"Juergen Ributzka
Looks like this commit is deadlocking the ASAN tests on the green dragon bot (http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA/). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28Reapply: [asan] On OS X, log reports to syslog and os_traceAnna Zaks
When ASan currently detects a bug, by default it will only print out the text of the report to stderr. This patch changes this behavior and writes the full text of the report to syslog before we terminate the process. It also calls os_trace (Activity Tracing available on OS X and iOS) with a message saying that the report is available in syslog. This is useful, because this message will be shown in the crash log. For this to work, the patch makes sure we store the full report into error_message_buffer unconditionally, and it also strips out ANSI escape sequences from the report (they are used when producing colored reports). I've initially tried to log to syslog during printing, which is done on Android right now. The advantage is that if we crash during error reporting or the produced error does not go through ScopedInErrorReport, we would still get a (partial) message in the syslog. However, that solution is very problematic on OS X. One issue is that the logging routine uses GCD, which may spawn a new thread on its behalf. In many cases, the reporting logic locks threadRegistry, which leads to deadlocks. Reviewed at http://reviews.llvm.org/D13452 (In addition, add sanitizer_common_libcdep.cc to buildgo.sh to avoid build failures on Linux.) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251577 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27Revert "[asan] On OS X, log reports to syslog and os_trace"Anna Zaks
This reverts commit 251447. (Which caused failures on a Linux bot.) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27[asan] On OS X, log reports to syslog and os_traceAnna Zaks
When ASan currently detects a bug, by default it will only print out the text of the report to stderr. This patch changes this behavior and writes the full text of the report to syslog before we terminate the process. It also calls os_trace (Activity Tracing available on OS X and iOS) with a message saying that the report is available in syslog. This is useful, because this message will be shown in the crash log. For this to work, the patch makes sure we store the full report into error_message_buffer unconditionally, and it also strips out ANSI escape sequences from the report (they are used when producing colored reports). I've initially tried to log to syslog during printing, which is done on Android right now. The advantage is that if we crash during error reporting or the produced error does not go through ScopedInErrorReport, we would still get a (partial) message in the syslog. However, that solution is very problematic on OS X. One issue is that the logging routine uses GCD, which may spawn a new thread on its behalf. In many cases, the reporting logic locks threadRegistry, which leads to deadlocks. Reviewed at http://reviews.llvm.org/D13452 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01[asan] Tune down SizeClassAllocator tests.Evgeniy Stepanov
This should make the Android/x86 bot (running on a Nexus Player) less flaky. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249044 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08[asan] Disable ThreadSelfTest on Android.Evgeniy Stepanov
Also #ifdef out the implementation of ThreadSelf() and ThreadSelfOffset() helper functions that are broken and unused on Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247053 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27[CMake] Unify build rules for sanitizer_common for Apple and non-Apple ↵Alexey Samsonov
platforms. Additionally, link safestack runtime on OS X with nolibc version of sanitizer_common runtime, as we do on Linux. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27Unit test the CRLF change to suppression parsingReid Kleckner
It's a simpler, faster, and more portable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20[CMake] Fix building unit tests on DarwinChris Bieneman
Summary: There are a number of issues with unit tests on Darwin. These patches address the following: * Unit tests should be passed -arch (-m32/-m64 isn't sufficient) * Unit tests should be passed ${DARWIN_osx_CFLAGS} because they're being built for OS X * Test architectures should be filtered based on base system capabilities (i.e. don't try running x86_64h tests on pre-haswell hardware). Reviewers: bogner, filcab, kubabrecka Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12174 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18[Sanitizer] Initialize common flags to default values in unit tests.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245363 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10[Windows] Implement FileExists, ReadFromFile, and FindPathToBinaryReid Kleckner
Summary: These are needed to talk to llvm-symbolizer on Windows. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11920 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244533 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31[Sanitizer] Try to fix sanitizer_libc_test on FreeBSD.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24[asan] Only link liblog on Android when it exists.Evgeniy Stepanov
With r242975, liblog is only used on certain older platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243139 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23[sanitizer] Implement logging to syslog.Evgeniy Stepanov
Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. This is a second attempt. I believe I've fixed all the issues that prompted the revert: Mac build, and all kinds of non-CMake builds (there are 3 of those). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23Revert r242975.Evgeniy Stepanov
Breaks Mac build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22[sanitizer] Implement logging to syslog.Evgeniy Stepanov
Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-17[asan] Fix sanitizer_allocator_test on AArch64.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29[asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov
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). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-26[asan] Link sanitizer_common tests on Android as -pie.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04[sanitizer_common] Added VS-style output for source locationsFilipe Cabecinhas
Summary: With this patch, we have a flag to toggle displaying source locations in the regular style: file:line:column or Visual Studio style: file(line,column) This way, they get picked up on the Visual Studio output window and one can double-click them to get to that file location. Reviewers: samsonov, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10113 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@239000 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.Evgeniy Stepanov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@238621 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05Disable exceptions with Clang on Windows in lib/sanitizer-common/testsReid Kleckner
While I'm here, fix a copy-paste bug so we get debug info for these tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236505 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portableTimur Iskhodzhanov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09Move more POSIX-specific functions to sanitizer_posix.hTimur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09Introduce CloseFile to be used instead of internal_close on non-POSIXTimur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08Move some POSIX-specific functions from sanitizer_libc.h to a new ↵Timur Iskhodzhanov
sanitizer_posix.h git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234418 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08[Sanitizers] Make OpenFile more portableTimur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06[ASan] Unify handling of loaded modules between POSIX and WindowsTimur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D8805 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23[sanitizer] Fix file access modes in SanitizerCommon.InternalMmapWithOffset ↵Alexander Potapenko
and SanitizerCommon.FileOps git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23[ASan] Distinguish between read, write and read-write file access modes in ↵Alexander Potapenko
OpenFile. This is to fix mapping coverage files into memory on OSX. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12Adding the implementation of atos and dladdr symbolizers for OS X.Kuba Brecka
They are currently still *not* used, "llvm-symbolizer" is still the default symbolizer on OS X. Reviewed at http://reviews.llvm.org/D6588 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232026 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03[asan] more fixes for x32, patches by H.J. LuKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231174 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02Symbolizer refactoring: ExtractToken and friendsKuba Brecka
Reviewed at http://reviews.llvm.org/D7867 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231027 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02asan: fix signal handling during stoptheworldDmitry Vyukov
The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler. Add SA_RESTORER flag when setting up handlers. Add a test that causes SIGSEGV in stoptheworld callback. Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread. http://reviews.llvm.org/D8005 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20[Sanitizer] Refactor SuppressionContext class.Alexey Samsonov
SuppressionContext is no longer a singleton, shared by all sanitizers, but a regular class. Each of ASan, LSan, UBSan and TSan now have their own SuppressionContext, which only parses suppressions specific to that sanitizer. "suppressions" flag is moved away from common flags into tool-specific flags, so the user now may pass ASAN_OPTIONS=suppressions=asan_supp.txt LSAN_OPIONS=suppressions=lsan_supp.txt in a single invocation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230026 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19[LSan] [MIPS] adding support of LSan for mips64/mips64el archMohit K. Bhakkad
Patch by Sagar Thakur Reviewers: petarj, earthdok, kcc. Subscribers: samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits. Differential Revision: http://reviews.llvm.org/D7013 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-31Revert "Remove unused function."Alexey Samsonov
This reverts commit r227633. SetEnv was prematurely deleted. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30Remove unused function.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19[sanitizer] Make unrecognized flags not fatal.Evgeniy Stepanov
Print a warning at verbosity=1 and higher instead of dying immediately. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226458 91177308-0d34-0410-b5e6-96231b3b80d8