summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: add support for mingw-w64 in builtinsReid Kleckner2015-07-172-1/+27
| | | | | | | | | | | | | | | | | The is so that we can avoid using libgcc and use compiler-rt with mingw-w64. Related driver patch http://reviews.llvm.org/D11077 I have tested this with mingw-w64 and everything seems to be in order. I also sent this patch to the mingw-w64 mailing list for them to look at. Patch by Martell Malone. Differential Revision: http://reviews.llvm.org/D11085 llvm-svn: 242539
* [msan] Fix open_memstream handling.Evgeniy Stepanov2015-07-171-8/+7
| | | | | | | | For open_memstream() files, buffer pointer is only valid immediately after fflush() or fclose(). Fix the fclose() interceptor to unpoison after the REAL(fclose) call, not before it. llvm-svn: 242535
* [probile] Fix memory leak introduced in r241824.Alexey Samsonov2015-07-151-0/+1
| | | | llvm-svn: 242350
* CFI: Add a default blacklist.Peter Collingbourne2015-07-153-0/+12
| | | | | | Differential Revision: http://reviews.llvm.org/D11095 llvm-svn: 242287
* [Sanitizer] Fix fopencookie() interceptor to work with null hook functions.Alexey Samsonov2015-07-141-7/+9
| | | | llvm-svn: 242193
* sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.Peter Collingbourne2015-07-131-1/+1
| | | | | | Fixes check-ubsan when self hosting on Windows. llvm-svn: 242003
* sanitizer_common: Fix implementation of bit count operations on 64-bit Windows.Peter Collingbourne2015-07-131-11/+9
| | | | llvm-svn: 242002
* [TSan] Fix dl_iterate_phdr callback for the case when info->dlpi_name is ↵Alexey Samsonov2015-07-101-4/+8
| | | | | | overwritten by user. llvm-svn: 241876
* Add support for generating profiles in a given directory.Diego Novillo2015-07-096-27/+65
| | | | | | | | | | When the file is initialized, this patch checks whether the path specifies a directory. If so, it creates the directory tree before truncating the file. Use default.profdata instead of pgo-data for default indexed profile name. llvm-svn: 241824
* UBSan: Simplify logic for locating the RTTI object.Peter Collingbourne2015-07-081-7/+16
| | | | | | | | | The image-relative complete object locator contains a reference to itself, which we can use to compute the image base without using VirtualQuery. Spotted by David Majnemer. llvm-svn: 241758
* CFI: Get check-cfi passing on Windows.Peter Collingbourne2015-07-087-243/+345
| | | | | | | | | | | | | | | | | | | | Specifically: - Start using %expect_crash. - Provide an implementation of __ubsan::getDynamicTypeInfoFromVtable for the Microsoft C++ ABI. This is all that is needed for CFI diagnostics; UBSan's -fsanitize=vptr also requires an implementation of __ubsan::checkDynamicType. - Build the sanitizer runtimes against the release version of the C runtime, even in debug builds. - Accommodate demangling differences in tests. Differential Revision: http://reviews.llvm.org/D11029 llvm-svn: 241745
* [asan] Add OS X 10.11's new dyld interposition supportKuba Brecka2015-07-061-2/+24
| | | | | | | | On OS X 10.11 (which is currently a public beta), the dynamic linker has been improved so that it doesn't require the use of DYLD_INSERT_LIBRARIES in order for interposition/wrappers to work. This patch adds support of this behavior into ASan – we no longer need to re-exec in case the env. variable is not set. Reviewed at http://reviews.llvm.org/D10924 llvm-svn: 241487
* [asan] Fix an OS X startup crash when an empty section is presentKuba Brecka2015-07-061-0/+1
| | | | | | | | On OS X, when the main instrumented binary contains a custom section with zero length, ASan will crash (assert failure) early in the initialization. Reviewed at http://reviews.llvm.org/D10944 llvm-svn: 241474
* UBSan: Enable runtime library tests on Windows, and get most tests passing.Peter Collingbourne2015-07-021-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: - Disable int128 tests on Windows, as MSVC cl.exe does not support int128, so we might not have been able to build the runtime with int128 support. - XFAIL the vptr tests as we lack Microsoft ABI support. - XFAIL enum.cpp as UBSan fails to add the correct instrumentation code for some reason. - Modify certain tests that build executables multiple times to use unique names for each executable. This works around a race condition observed on Windows. - Implement IsAccessibleMemoryRange for Windows to fix the last misaligned.cpp test. - Introduce a substitution for testing crashes on Windows using KillTheDoctor. Differential Revision: http://reviews.llvm.org/D10864 llvm-svn: 241303
* [sanitizer] add #ifdefs around slow unwinder to fix OS X debug buildKuba Brecka2015-07-021-0/+4
| | | | | | | | | | A recent change in slow unwinder causes the OS X build to fail when using COMPILER_RT_DEBUG=On. Let's fix this by #ifdef'ing it with #if SANITIZER_CAN_SLOW_UNWIND. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150622/284294.html Reviewed at http://reviews.llvm.org/D10870 llvm-svn: 241261
* Add declaration of _ReadWriteBarrier. Fixes build of asan tests on Windows.Peter Collingbourne2015-07-021-0/+5
| | | | llvm-svn: 241227
* Re-apply r241217 with build fixes:Peter Collingbourne2015-07-026-20/+47
| | | | | | | - Disable building of the interceptor library on 64-bit Windows. - Mangle names in /alternatename directive for 32-bit Windows. llvm-svn: 241224
* Revert r241217, it breaks the build on Windows.Nico Weber2015-07-025-39/+19
| | | | llvm-svn: 241219
* ubsan: Port runtime library to (32- and 64-bit) Windows.Peter Collingbourne2015-07-025-19/+39
| | | | | | Differential Revision: http://reviews.llvm.org/D10856 llvm-svn: 241217
* tsan: fix handling of condition variable destructionDmitry Vyukov2015-06-301-2/+2
| | | | | | | | | | | | POSIX states that "It shall be safe to destroy an initialized condition variable upon which no threads are currently blocked", and later clarifies "A condition variable can be destroyed immediately after all the threads that are blocked on it are awakened) (in examples section). Tsan reported such destruction as a data race. Fixes https://llvm.org/bugs/show_bug.cgi?id=23616 Reviewed in http://reviews.llvm.org/D10693 llvm-svn: 241082
* [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov2015-06-298-28/+37
| | | | | | | 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). llvm-svn: 240992
* [libsanitizer] Replace ReadBinaryName() with ReadBinaryNameCached(),Alexander Potapenko2015-06-294-3/+16
| | | | | | | | | which caches the executable name upon the first invocation. This is necessary because Google Chrome (and potentially other programs) restrict the access to /proc/self/exe on linux. This change should fix https://code.google.com/p/chromium/issues/detail?id=502974 llvm-svn: 240960
* tsan: implement suppressions for top frame onlyDmitry Vyukov2015-06-292-13/+22
| | | | | | | | | | The new suppression type is called "race_top" and is matched only against top frame in report stacks. This is required for situations when we want to suppress a race in a "thread pool" or "event loop" implementation. If we simply use "race:ThreadPool::Execute" suppression, that can suppress everything in the program. Reviewed in http://reviews.llvm.org/D10686 llvm-svn: 240949
* [msan] Fix infinite recursion when _Unwind_Backtrace calls memcpyJay Foad2015-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On PPC64, half the msan tests fail with an infinite recursion through GetStackTrace like this: #0 __msan::GetStackTrace #1 __msan_memcpy #2 ?? () from /lib64/libgcc_s.so.1 #3 ?? () from /lib64/libgcc_s.so.1 #4 _Unwind_Backtrace #5 __sanitizer::BufferedStackTrace::SlowUnwindStack #6 __sanitizer::BufferedStackTrace::Unwind #7 __msan::GetStackTrace #8 __interceptor_calloc #9 _dl_allocate_tls #10 pthread_create@@GLIBC_2.17 #11 __interceptor_pthread_create #12 main The problem is that we call _Unwind_Backtrace to get a stack trace; but _Unwind_Backtrace calls memcpy, which we intercept and try to get another stack trace. This patch fixes it in __msan_memcpy by skipping the stack trace if IsInSymbolizer(). This works because GetStackTrace already creates a SymbolizerScope to "block reports from our interceptors during _Unwind_Backtrace". Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10762 llvm-svn: 240878
* [asan] Disable glibc-specific code chunk on Android.Evgeniy Stepanov2015-06-261-1/+1
| | | | | | Fixes quarantine_size_mb.cc test on the Android bot. llvm-svn: 240854
* [asan] Link sanitizer_common tests on Android as -pie.Evgeniy Stepanov2015-06-261-0/+4
| | | | llvm-svn: 240825
* [ASan] Clean up obsolete stats.Alexey Samsonov2015-06-264-18/+6
| | | | | | | | Remove stats that we no longer collect after the allocator change. Use proper constant SizeClassMap::kNumClasses to fix potential buffer overflow (https://code.google.com/p/address-sanitizer/issues/detail?id=397). llvm-svn: 240816
* [libsanitizer] Delete the unused GetBinaryName() function.Alexander Potapenko2015-06-262-5/+0
| | | | llvm-svn: 240767
* [asan] Do not unset DYLD_ROOT_PATH before calling atos on DarwinAnna Zaks2015-06-251-3/+0
| | | | | | | | | | | | | | | | | We were unsetting DYLD_ROOT_PATH before calling atos on Darwin in order to address it not working for symbolicating 32 bit binaries. (atos essentiall tries to respawn as a 32 bit binary and it's disallowed to respawn if DYLD_ROOT_PATH is set ... ) However, processes rely on having DYLD_ROOT_PATH set under certain conditions, so this is not the right fix. In particular, this always crashes when running ASanified process under the debugger in Xcode with iOS simulator, which is a very important workflow for us to support. This patch reverts the unsetting of the DYLD_ROOT_PATH. The correct fix to the misbehavior on 32-bit binaries should happen inside atos. http://reviews.llvm.org/D10722 llvm-svn: 240724
* [msan] Teach sanitizers about the PPC64 ptrace syscallJay Foad2015-06-254-9/+19
| | | | | | | | | | | | | | | | | Summary: This fixes test/msan/Linux/syscalls.cc, and should also fix the ppc64 sanitizer buildbots which are currently failing in "make check-sanitizer". Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10734 llvm-svn: 240692
* [msan] Fix SetShadow for mappings at the end of the application address spaceJay Foad2015-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: On PPC64 if you disable ASLR (or run under gdb) you're likely to see mmap returning a mapping right at the end of the application address space region. This caused SetShadow to call MEM_TO_SHADOW() on the last+1 address in the region, which seems wrong to me; how can MEM_TO_SHADOW() distinguish this from the first address in the following region? Fixed by only calling MEM_TO_SHADOW() once, on the start address. Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10735 llvm-svn: 240690
* tsan: fix handling of dup2 Dmitry Vyukov2015-06-253-14/+32
| | | | | | | | | | | | Previously tsan modelled dup2(oldfd, newfd) as write on newfd. We hit several cases where the write lead to false positives: 1. Some software dups a closed pipe in place of a socket before closing the socket (to prevent races actually). 2. Some daemons dup /dev/null in place of stdin/stdout. On the other hand we have not seen cases when write here catches real bugs. So model dup2 as read on newfd instead. llvm-svn: 240687
* tsan: merge function definition and declarationDmitry Vyukov2015-06-251-10/+4
| | | | llvm-svn: 240633
* Enable memory sanitizer for PPC64Jay Foad2015-06-253-0/+30
| | | | | | | | | | | | | | | | | | Summary: This patch adds basic memory sanitizer support for PPC64. PR23219. I have further patches ready to enable it in LLVM and Clang, and to fix most of the many failing tests in check-msan. Reviewers: kcc, willschm, samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: wschmidt, llvm-commits Differential Revision: http://reviews.llvm.org/D10648 llvm-svn: 240623
* [CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.Alexey Samsonov2015-06-251-1/+6
| | | | | | | | | | | | | | | | | | | | Summary: This patch implements step 1 from https://llvm.org/bugs/show_bug.cgi?id=23539#c10 I'd appreciate if you could test it on Mac OS and verify that parts of UBSan runtime that reference C++ ABI symbols are properly excluded, and fix ASan/UBSan builds. Test Plan: regression test suite Reviewers: thakis, hans Subscribers: llvm-commits, zaks.anna, kubabrecka Differential Revision: http://reviews.llvm.org/D10621 llvm-svn: 240617
* One more change required to build the sanitizers for iOS.Chris Bieneman2015-06-242-5/+5
| | | | | | | | | | | | | | Summary: _Unwind_Backtrace is not available on iOS, so we should ifdef out the posix implementations of BufferedStackTrace::SlowUnwindStack and BufferedStackTrace::SlowUnwindStackWithContext on iOS. Reviewers: samsonov Reviewed By: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10696 llvm-svn: 240586
* tsan: fix false positive between dlopen and dl_iterate_phdrDmitry Vyukov2015-06-241-0/+41
| | | | | | | | | We see false reports between dlopen and dl_iterate_phdr. This happens because tsan does not see dynamic linker internal synchronization. Unpoison module names in dl_iterate_phdr callback. llvm-svn: 240576
* SafeStack: Add another missing header to try to fix FreeBSD build.Peter Collingbourne2015-06-241-0/+1
| | | | llvm-svn: 240564
* SafeStack: Add #include of <stdint.h>.Peter Collingbourne2015-06-241-0/+1
| | | | | | Should fix the FreeBSD build. llvm-svn: 240555
* asan: fix 32-bit buildDmitry Vyukov2015-06-241-1/+1
| | | | llvm-svn: 240541
* tsan: don't print external PCs in reportsDmitry Vyukov2015-06-244-6/+8
| | | | | | They are meaningless. llvm-svn: 240539
* tsan: fix unbounded memory consumption for large mallocsDmitry Vyukov2015-06-241-0/+17
| | | | | | | This happens only in corner cases, but we observed this on a real app. See the test for description of the exact scenario that lead to unbounded memory consumption. llvm-svn: 240535
* Update SafeStack TODO in the safestack.ccPeter Collingbourne2015-06-231-24/+32
| | | | | | | | | | | | This patch clarifies the TODO note at the top of safestack.cc and brings it more in sync with what we (the CPI team) actually plan to work on in the future. Patch by Volodymyr Kuznetsov! Differential Revision: http://reviews.llvm.org/D10600 llvm-svn: 240473
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. Darwin doesn't have _Unwind_VRS_Get, instead use _Unwind_GetIP directly. Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, llvm-commits Differential Revision: http://reviews.llvm.org/D10516 llvm-svn: 240470
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-232-4/+20
| | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. This change ifdefs out headers and functionality that aren't available on iOS, and adds support for iOS and the iOS simulator to as an. Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: glider, kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, zaks.anna, llvm-commits Differential Revision: http://reviews.llvm.org/D10515 llvm-svn: 240469
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-233-4/+13
| | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. This change ifdefs out headers and functionality that aren't available on iOS. Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: glider, kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, llvm-commits Differential Revision: http://reviews.llvm.org/D10514 llvm-svn: 240468
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-233-19/+44
| | | | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. This change does the following: - Don't include crt_externs on iOS (it isn't available) - Support ARM thread state objects Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: glider, kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, aemerson, llvm-commits Differential Revision: http://reviews.llvm.org/D10510 llvm-svn: 240467
* Fix incorrect truncation at the overflow boundaryPirama Arumuga Nainar2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes incorrect truncation when the input wider value is exactly 2^dstBits. For that value, the overflow to infinity is not correctly handled. The fix is to replace a strict '>' with '>='. Currently, __truncdfsf2(340282366900000000000000000000000000000.0) returns infinity __truncdfsf2(340282366920938463463374607431768211456.0) returns 0 __truncdfsf2(400000000000000000000000000000000000000.0) returns infinity Likewise, __truncdfhf2 and __truncsfhf2 (and consequently gnu_f2h_ieee) are discontinuous at 65536.0. This patch adds tests for all three cases, along with adding a missing header include to fp_test.h. Reviewers: joerg, ab, srhines Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10594 llvm-svn: 240450
* [Sanitizers] Pass the correct arch to the symbolizer for x86_64hFrederic Riss2015-06-231-1/+3
| | | | | | | | | | | I have no idea how to directly test that as it depends on a particular (micro-)architecure of the host processor. Combined with llvm's r240339 this should fix issues people might have be seeing intermitently on Darwin haswell machines (the symbolizer would use the wrong slice of the binary, thus potentially resolving to the wrong symbol). llvm-svn: 240379
* CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas2015-06-1910-24/+24
| | | | | | | | | | | | | | | | | | | | | Summary: Use CMake's cmake_parse_arguments() instead. It's called in a slightly different way, but supports all our use cases. It's in CMake 2.8.8, which is our minimum supported version. CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc): http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments Since I was already changing these calls, I changed ARCH and LIB into ARCHS and LIBS to make it more clear that they're lists of arguments. Reviewers: eugenis, samsonov, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10529 llvm-svn: 240120
OpenPOWER on IntegriCloud