summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] Tweak gen_dynamic_list.py to work with both Py2 and Py3.Evgeniy Stepanov2015-10-011-1/+1
| | | | llvm-svn: 249051
* [asan] Tune down SizeClassAllocator tests.Evgeniy Stepanov2015-10-011-1/+1
| | | | | | | This should make the Android/x86 bot (running on a Nexus Player) less flaky. llvm-svn: 249044
* [compiler-rt] Fix build by wrapping lines to 80 chars (NFC)Vedant Kumar2015-10-013-3/+6
| | | | llvm-svn: 248973
* [sanitizer_common] Apply modernize-use-nullptr, other minor fixesVedant Kumar2015-09-3018-143/+153
| | | | | | | | | | | | - Trim spaces. - Use nullptr in place of 0 for pointer variables. - Use '!p' in place of 'p == 0' for null pointer checks. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13310 llvm-svn: 248964
* [sanitizer] Fix Clang-tidy modernize-use-nullptr warnings in ↵Kostya Serebryany2015-09-2915-94/+104
| | | | | | lib/sanitizer_common headers, unify closing inclusion guards. Patch by Eugene Zelenko llvm-svn: 248816
* sanitizer: fix -pedantic warningsSaleem Abdulrasool2015-09-261-3/+3
| | | | | | Silence a few "warning: extra ';'" warnings from GCC. llvm-svn: 248653
* [MSan] Enable MSAN for aarch64Adhemerval Zanella2015-09-165-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 247809
* Support inline functions symbolization in Addr2Line symbolizer.Alexey Samsonov2015-09-142-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Maxim Ostapenko! Summary: Right now, Addr2Line symbolizer in asan_symbolize.py doesn't support inline functions symbolization. This might be a useful feature for using ASan on embedded systems. Test results: $ cat test.c static inline void FooBarBaz() { __sanitizer_print_stack_trace(); } int main() { FooBarBaz(); return 0; } $ clang test.c -fsanitize=address -g -O2 -o test.x && ./test.x &> /tmp/test.log $ ./projects/compiler-rt/lib/asan/scripts/asan_symbolize.py -l /tmp/test.log #0 0x42095e in __sanitizer_print_stack_trace _asan_rtl_ #1 0x4cec07 in FooBarBaz /home/max/build/llvm/asan/test.c:4 #2 0x4cec07 in main /home/max/build/llvm/asan/test.c:8 #3 0x7f89f0891ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287 Reviewers: glider, samsonov Subscribers: jevinskie, llvm-commits, ygribov Differential Revision: http://reviews.llvm.org/D12153 llvm-svn: 247642
* [compiler-rt] [sanitizers] Add VMA size check at runtimeAdhemerval Zanella2015-09-113-0/+22
| | | | | | | | | This patch adds a runtime check for asan, dfsan, msan, and tsan for architectures that support multiple VMA size (like aarch64). Currently the check only prints a warning indicating which is the VMA built and expected against the one detected at runtime. llvm-svn: 247413
* Unbreak building on FreeBSD.Roman Divacky2015-09-101-1/+3
| | | | llvm-svn: 247347
* [msan] Unpoison dlpi_phdr in dl_iterate_phdr.Evgeniy Stepanov2015-09-082-0/+6
| | | | | | | | | | | In some cases, PHDR table is allocated with malloc() by the linker instead of being mapped from file. It needs to be unpoisoned in the dl_iterate_phdr callback then. This happens when program headers are not part of any loadable ELF segment. llvm-svn: 247100
* [asan] Disable ThreadSelfTest on Android.Evgeniy Stepanov2015-09-082-2/+2
| | | | | | | | Also #ifdef out the implementation of ThreadSelf() and ThreadSelfOffset() helper functions that are broken and unused on Android. llvm-svn: 247053
* [asan] Delay syslog use on Android until the end of __asan_init.Evgeniy Stepanov2015-09-041-6/+9
| | | | | | | | Due to a slightly different initialization order, syslog on android/x86 calls vsnprintf, which can not be handled until interceptors are initialized at least. llvm-svn: 246831
* tsan: speed up race deduplicationDmitry Vyukov2015-09-033-5/+20
| | | | | | | | | | | | | | | | | | | | | | | Race deduplication code proved to be a performance bottleneck in the past if suppressions/annotations are used, or just some races left unaddressed. And we still get user complaints about this: https://groups.google.com/forum/#!topic/thread-sanitizer/hB0WyiTI4e4 ReportRace already has several layers of caching for racy pcs/addresses to make deduplication faster. However, ReportRace still takes a global mutex (ThreadRegistry and ReportMutex) during deduplication and also calls mmap/munmap (which take process-wide semaphore in kernel), this makes deduplication non-scalable. This patch moves race deduplication outside of global mutexes and also removes all mmap/munmap calls. As the result, race_stress.cc with 100 threads and 10000 iterations become 30x faster: before: real 0m21.673s user 0m5.932s sys 0m34.885s after: real 0m0.720s user 0m23.646s sys 0m1.254s http://reviews.llvm.org/D12554 llvm-svn: 246758
* [asan] Fix the freopen interceptor to allow NULL instead of a filenameKuba Brecka2015-08-311-2/+2
| | | | | | | | According to `man freopen`, passing NULL instead of a filename is valid, however the current implementation of the interceptor assumes this parameter is non-NULL. Let's fix that and add a test case. Differential Revision: http://reviews.llvm.org/D11389 llvm-svn: 246435
* [compiler-rt] [tsan] Enable TSan for AArch64/42-bit VMAAdhemerval Zanella2015-08-282-0/+6
| | | | | | | | | | | This patch adds support for tsan on aarch64-linux with 42-bit VMA (current default config for 64K pagesize kernels). The support is enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time for both clang/llvm and compiler-rt. The default VMA is 39 bits. It also enabled tsan for previous supported VMA (39). llvm-svn: 246330
* [CMake] Unify build rules for sanitizer_common for Apple and non-Apple ↵Alexey Samsonov2015-08-272-24/+22
| | | | | | | | | platforms. Additionally, link safestack runtime on OS X with nolibc version of sanitizer_common runtime, as we do on Linux. llvm-svn: 246227
* [CMake] Delete unused variable and target.Alexey Samsonov2015-08-271-12/+1
| | | | llvm-svn: 246221
* [Sanitizers] Make abort_on_error common flag.Alexey Samsonov2015-08-273-1/+10
| | | | | | | | | | | | | | Summary: Teach all sanitizers to call abort() instead of _exit() after printing an error report, if requested. This behavior is the default on Mac OS. Reviewers: kcc, kubabrecka Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12332 llvm-svn: 246205
* [Sanitizer] Use internal_memmove instead of the one implicitly generated by ↵Alexey Samsonov2015-08-271-2/+3
| | | | | | compiler. llvm-svn: 246198
* [sanitizer] Disable sem_* interceptors on Mac.Evgeniy Stepanov2015-08-271-1/+1
| | | | llvm-svn: 246190
* [sanitizer] Move sem_* to common interceptors.Evgeniy Stepanov2015-08-272-0/+87
| | | | llvm-svn: 246184
* Unit test the CRLF change to suppression parsingReid Kleckner2015-08-271-2/+3
| | | | | | It's a simpler, faster, and more portable. llvm-svn: 246171
* [compiler-rt] [tsan] Fix GetTls for aarch64Adhemerval Zanella2015-08-271-2/+2
| | | | | | | | This patch fix the function GetTls for aarch64, where it assumes it follows the x86_64 way where the TLS initial address is at the end of TLS. Instead aarch64 set the TLS address as the thread pointer. llvm-svn: 246148
* Handle suppression files ending in CRLF (\r\n)Reid Kleckner2015-08-261-1/+2
| | | | | | | The gnuwin32 version of 'echo' appears to produce such files, causing a test failure that only reproduced with gnuwin32. llvm-svn: 246096
* [compiler-rt] Add common interceptor for wcrtomb. Eric Fiselier2015-08-262-1/+26
| | | | | | | | | | | | 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
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-241-0/+6
| | | | | | | | | | | 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-243-36/+55
| | | | | | | | | | | | | | | | | 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
* [autoconf] Properly exclude sanitizer_common nolibc sources from build.Alexey Samsonov2015-08-241-1/+2
| | | | llvm-svn: 245865
* Revert r245770 and r245777.Alexey Samsonov2015-08-225-16/+6
| | | | | | | These changes break both autoconf Mac OS X buildbot (linker errors due to wrong Makefiles) and CMake buildbot (safestack test failures). llvm-svn: 245784
* Try to fix Mac build.Alexey Samsonov2015-08-221-4/+4
| | | | llvm-svn: 245777
* [asan] Don't apply glibc-specific TLS calculations on Android.Evgeniy Stepanov2015-08-221-1/+4
| | | | | | | This fixes an infinite recursion between GetTls and GetTlsSize on Android-x86. llvm-svn: 245773
* [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().Alexey Samsonov2015-08-224-2/+12
| | | | | | | 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
* [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across ↵Alexey Samsonov2015-08-212-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [compiler-rt] [sanitizers] Add aarch64 syscall optimization supportAdhemerval Zanella2015-08-213-0/+141
| | | | | | | This patch adds the inline syscall support for aarch64 instead of relying on the syscall runtime function. llvm-svn: 245702
* [asan] Fix build issue from r245596Adhemerval Zanella2015-08-201-4/+3
| | | | | | | | This patch fixes the build issue for: sanitizer_platform.h:88:4: error: #error "invalid SANITIZER_AARCH64_VMA size" llvm-svn: 245614
* [asan] Enable ASan for AArch64/42-bit VMAAdhemerval Zanella2015-08-201-3/+18
| | | | | | | | | | | This patch adds support for asan on aarch64-linux with 42-bit VMA (current default config for 64K pagesize kernels). The support is enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time for both clang/llvm and compiler-rt. The default VMA is 39 bits. For 42-bit VMA aarch64 uses SANITIZIER_CAN_USER_ALLOCATOR64. llvm-svn: 245596
* [CMake] Fix building unit tests on DarwinChris Bieneman2015-08-201-0/+3
| | | | | | | | | | | | | | | | 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 llvm-svn: 245580
* [Sanitizer] Initialize common flags to default values in unit tests.Alexey Samsonov2015-08-181-0/+2
| | | | llvm-svn: 245363
* Add more error logging to win/asanReid Kleckner2015-08-131-2/+8
| | | | llvm-svn: 244940
* Same fix as r244908 for sanitizer_win.cc instead of asan_win.ccReid Kleckner2015-08-131-1/+1
| | | | | | | I forgot to audit lib/sanitizer_common for the same issue. This fixes writing out coverage files on exit. llvm-svn: 244910
* [windows] Fix deadlock on mmap failure due to CHECK recursionReid Kleckner2015-08-124-21/+23
| | | | | | | | | | | | | | | | | | | Summary: Printing a stacktrace acquires a spinlock, and the sanitizer spinlocks aren't re-entrant. Avoid the problem by reusing the logic we already have on Posix. This failure mode is already exercised by the existing mmap_limit_mb.cc test case. It will be enabled in a forthcoming change, so I didn't add standalone tests for this change. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11999 llvm-svn: 244840
* Include sanitizer_posix.h to try to fix the mac buildReid Kleckner2015-08-111-0/+1
| | | | | | Linux must pick it up transitively. llvm-svn: 244645
* Speculative fix for Mac buildReid Kleckner2015-08-111-1/+1
| | | | llvm-svn: 244623
* [Windows] Use llvm-symbolizer before using dbghelpReid Kleckner2015-08-118-418/+562
| | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-symbolizer understands both PDBs and DWARF, so it's a better bet if it's available. It prints out the function parameter types and column numbers, so I needed to churn the expected test output a bit. This makes most of the llvm-symbolizer subprocessing code target-independent. Pipes on all platforms use fd_t, and we can use the portable ReadFromFile / WriteToFile wrappers in symbolizer_sanitizer.cc. Only the pipe creation and process spawning is Windows-specific. Please check that the libcdep layering is still correct. I don't know how to reproduce the build configuration that relies on that. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11791 llvm-svn: 244616
* [sanitizers] Use portable file read/write wrappers on process pipesReid Kleckner2015-08-112-9/+11
| | | | | | | This fixes a minor error checking bug around calling internal_read/write, and makes the code more portable for D11791. llvm-svn: 244546
* [Windows] Implement FileExists, ReadFromFile, and FindPathToBinaryReid Kleckner2015-08-105-48/+96
| | | | | | | | | | | | Summary: These are needed to talk to llvm-symbolizer on Windows. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11920 llvm-svn: 244533
* -Wdeprecated: Use noexcept rather than throw() where supportedDavid Blaikie2015-08-102-2/+17
| | | | | | | | | | 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
* [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to ↵Kostya Serebryany2015-08-063-0/+5
| | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM) llvm-svn: 244234
* Revert "[sanitizer] Add the flag handle_sigfpe that is default true to ↵Renato Golin2015-08-063-5/+0
| | | | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski" This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline. llvm-svn: 244210
OpenPOWER on IntegriCloud