Commit Graph

3944 Commits

Author SHA1 Message Date
Dmitry Vyukov 6e2557769c tsan: use stack depot for goroutine creation stacks (as C++ threads do)
llvm-svn: 204326
2014-03-20 10:19:02 +00:00
Dmitry Vyukov 9cf08c46a6 tsan: remove unused declaration
llvm-svn: 204324
2014-03-20 10:13:30 +00:00
Alexey Samsonov 6c3f7fcb8a Mark this test as 64-bit specific
llvm-svn: 204319
2014-03-20 07:37:45 +00:00
Duncan P. N. Exon Smith ecf2256dfe PGO: Implement Darwin linker magic for instrumentation
Use Darwin linker magic to find bounds of instrumentation data sections
at link time instead of runtime.

<rdar://problem/15943240>

llvm-svn: 204302
2014-03-20 03:57:33 +00:00
Duncan P. N. Exon Smith da0de8a237 PGO: Split out initialization of section bounds
Currently we register instrumentation data at runtime to determine the
bounds of the sections where the data lives.  Soon we'll implement
platform-specific linker magic to determine this at link time.

Move this logic to a separate file, so that our build system can choose
the correct platform-specific code.

No functionality change intended.

<rdar://problem/15943240>

llvm-svn: 204299
2014-03-20 03:23:10 +00:00
Duncan P. N. Exon Smith a84dae2c2c PGO: Constify references to instrumentation data
<rdar://problem/15943240>

llvm-svn: 204298
2014-03-20 03:19:15 +00:00
Duncan P. N. Exon Smith d1a3bebeeb PGO: Use past-the-end semantics for pointer range
llvm-svn: 204278
2014-03-19 22:45:28 +00:00
Duncan P. N. Exon Smith fb4447688f PGO: Appease buildbots after r204268
llvm-svn: 204276
2014-03-19 22:28:32 +00:00
Duncan P. N. Exon Smith 8353a26e85 PGO: Splitting implementation files; no functionality change
Split implementation files along a uses-libc/shouldn't-use-libc
boundary.

  - InstrProfiling.h is a shared header.

  - InstrProfiling.c provides an API to extract profiling data from the
    runtime, but avoids the use of libc.  Currently this is a lie:
    __llvm_pgo_write_buffer() uses `FILE*` and related functions.  It
    will be updated soon to write to a `char*` buffer instead.

  - InstrProfilingExtras.c provides a more convenient API for
    interfacing with the profiling runtime, but has logic that does (and
    will continue to) use libc.

<rdar://problem/15943240>

llvm-svn: 204268
2014-03-19 22:10:27 +00:00
Duncan P. N. Exon Smith 61c97335c6 PGO: Fix obviously wrong typedefs for MS
llvm-svn: 204267
2014-03-19 22:10:24 +00:00
Joerg Sonnenberger 0883e48f7e Sort. Fix missing NetBSD.
llvm-svn: 204249
2014-03-19 16:06:36 +00:00
Alexey Samsonov a7b8472397 One more attempt to fix Makefile build
llvm-svn: 204241
2014-03-19 15:26:54 +00:00
Dmitry Vyukov 1af191e1f4 tsan: add test for second_deadlock_stack flag
llvm-svn: 204240
2014-03-19 15:00:38 +00:00
Alexey Samsonov 725122eca3 [Make] Build sanitizer runtimes with -std=c++11
llvm-svn: 204239
2014-03-19 14:50:10 +00:00
Alexey Samsonov a2fdd8e253 [CMake] Fix build of ASan tests on Mac
llvm-svn: 204238
2014-03-19 14:45:40 +00:00
Kostya Serebryany 78f2e7bd62 [sanitizer] use some c++11 to simplify the code (we can now). Fix one place where a mutex acquisition stack trace was not properly remembered
llvm-svn: 204237
2014-03-19 14:19:31 +00:00
Alexey Samsonov 17703c1092 [CMake] Build sanitizer unit tests with -std=c++11
llvm-svn: 204234
2014-03-19 13:57:33 +00:00
Kostya Serebryany 2483acce21 [sanitizer] when recycling deadlock graph nodes, properly recycle edges
llvm-svn: 204233
2014-03-19 13:53:37 +00:00
Dmitry Vyukov cc579aeba6 tsan: use attribute instead of compiler flag for tls-model=initial-exec as asked in comments for r203111
llvm-svn: 204232
2014-03-19 13:24:52 +00:00
Dmitry Vyukov ecc3456fd6 tsan: fix copy-pasted comment
llvm-svn: 204231
2014-03-19 13:19:39 +00:00
Evgeniy Stepanov a57750482f [msan] Fix line numbers in test.
This corresponds to a fix in llvm::SplitBlockAndInsertIfThen.

llvm-svn: 204229
2014-03-19 12:56:38 +00:00
Dmitry Vyukov bbbe6bba8a tsan: preliminary support for Go deadlock detector
llvm-svn: 204228
2014-03-19 12:50:47 +00:00
Dmitry Vyukov 17efa197bf tsan: fix large stack frame in deadlock detector
In member function 'virtual void __sanitizer::DD::MutexBeforeLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool)':
error: the frame size of 544 bytes is larger than 512 bytes [-Werror=frame-larger-than=]

The code is now [arguably] better as well.

llvm-svn: 204227
2014-03-19 12:49:46 +00:00
Kostya Serebryany 2ea796e05f [sanitizer] deadlock detector: a) initial support for suppressions, b) be more robust in case we failed to extract a stack trace for one of the locks
llvm-svn: 204225
2014-03-19 12:26:33 +00:00
Timur Iskhodzhanov 364b8b8fe5 [ASan] Print mmap errno/GetLastError in a readable and consistent way
Reviewed at http://llvm-reviews.chandlerc.com/D3107

llvm-svn: 204218
2014-03-19 08:23:00 +00:00
Joerg Sonnenberger 4e08a634e1 Don't take short cuts trying to avoid conditionals. This leads to
negative shift amounts and/or shifts wider than the type. VAX traps on
the former, X86 and other platforms produce incorrect results on the
latter.

llvm-svn: 204193
2014-03-18 22:10:36 +00:00
Justin Bogner bc9c856161 profile: Include the function hash in PGO profiles
llvm-svn: 204185
2014-03-18 21:57:58 +00:00
Joerg Sonnenberger 14743127b7 Use CRT_HAS_128BIT.
llvm-svn: 204182
2014-03-18 21:35:30 +00:00
Joerg Sonnenberger bbc979be52 Spacing
llvm-svn: 204179
2014-03-18 20:41:31 +00:00
Sergey Matveev 34b26458cb [sanitizer] Fix a bug in AdjustStackSize().
If the user requests OS default stack size, do not adjust it to our minimum
stack size (which is usually much less than the OS default).

llvm-svn: 204173
2014-03-18 19:48:48 +00:00
Dmitry Vyukov c5b7c66bc3 tsan: fix malloc/munmap mismatch
llvm-svn: 204154
2014-03-18 14:28:17 +00:00
Evgeniy Stepanov 412d973980 [msan] Origin tracking with history, compiler-rt part.
Compiler-rt part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.

llvm-svn: 204152
2014-03-18 13:45:19 +00:00
Dmitry Vyukov 3cd028c0b2 tsan: deadlock detector: add deadlock detector flags
the first flags is to enable printing of the second stack per edge

llvm-svn: 204150
2014-03-18 13:13:47 +00:00
Dmitry Vyukov b72bc2ec9c tsan: deadlock detector: print 2 stacks per deadlock edge
llvm-svn: 204149
2014-03-18 12:53:05 +00:00
Dmitry Vyukov 7fbceb2a3f tsan: addrhashmap: fix bug with initialization of addresses in add array
llvm-svn: 204148
2014-03-18 12:52:11 +00:00
Dmitry Vyukov 17fff3268d tsan: deadlock detector: add ability to ignore destruction of global mutexes
llvm-svn: 204146
2014-03-18 12:50:41 +00:00
Alexey Samsonov bcce1979e3 [CMake] Build compiler-rt libraries with -std=c++11
llvm-svn: 204145
2014-03-18 12:49:22 +00:00
Dmitry Vyukov 9e5341d64a tsan: lazily initialize deadlock detector runtime
this is necessaary because dlsym can call malloc, which can lock mutexes that we intercept

llvm-svn: 204141
2014-03-18 11:23:51 +00:00
Alexey Samsonov f88f317d35 Fix -Werror build
llvm-svn: 204139
2014-03-18 11:17:01 +00:00
Evgeniy Stepanov 0b5b3295e5 Move Android ucontext.h out of third_party.
Google is re-licensing this code under the standard dual license of
compiler-rt.

llvm-svn: 204128
2014-03-18 08:32:14 +00:00
Dmitry Vyukov 3458425d81 tsan: support up to 1<<20 mutexes in standalone deadlock detector
llvm-svn: 204127
2014-03-18 08:31:11 +00:00
Dmitry Vyukov a3b21b1d14 tsan: better addr->object hashmap
still experimental

llvm-svn: 204126
2014-03-18 08:30:14 +00:00
Dmitry Vyukov 24c833e1a4 tsan: add missing interceptor for embed symbolizer
llvm-svn: 204124
2014-03-18 08:28:39 +00:00
Dmitry Vyukov eac8cc7a42 tsan: fix flaky test
llvm-svn: 204119
2014-03-18 06:37:31 +00:00
Kostya Serebryany 5c0171b811 [sanitizer] a bit more informative deadlock detector report (still lots to improve)
llvm-svn: 204115
2014-03-18 05:56:14 +00:00
Duncan P. N. Exon Smith 1373630bc4 Reapply "PGO: Statically generate data structures"
Reapply r204079 and r204083, this time with stubs for fputc in
compiler-rt.

llvm-svn: 204091
2014-03-17 23:44:56 +00:00
Duncan P. N. Exon Smith ffdfaa6908 Revert r204079, r204083 and r204084 "PGO: Statically generate data structures"
Buildbots are having trouble finding fputc(), and I can't figure out
why.  Reverting to investigate.

llvm-svn: 204088
2014-03-17 23:28:41 +00:00
Duncan P. N. Exon Smith 054f8708b5 Switch from fputc to putc to fix r204079?
llvm-svn: 204084
2014-03-17 22:20:58 +00:00
Duncan P. N. Exon Smith 58d2637f2a Rename __ProfileData to __llvm_pgo_data
<rdar://problem/15943240>

llvm-svn: 204083
2014-03-17 22:08:05 +00:00
Duncan P. N. Exon Smith 77a88e3064 PGO: Statically generate data structures
In instrumentation-based profiling, we need a set of data structures to
represent the counters.  Previously, these were built up during static
initialization.  Now, they're shoved into a specially-named section so
that they show up as an array.

As a consequence of the reorganizing symbols, instrumentation data
structures for linkonce functions are now correctly coalesced.

This is the first step in a larger project to minimize runtime overhead
and dependencies in instrumentation-based profilng.  The larger picture
includes removing all initialization overhead and making the dependency
on libc optional.

<rdar://problem/15943240>

llvm-svn: 204079
2014-03-17 21:18:24 +00:00
Kostya Serebryany e7846206e8 [sanitizer] fix the deadlock detector build
llvm-svn: 204044
2014-03-17 15:16:25 +00:00
Kostya Serebryany f01c094cdd [sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph)
llvm-svn: 204043
2014-03-17 14:56:04 +00:00
Kostya Serebryany 8976539627 [sanitizer] make the deadlock detector print 2*N stack traces on lock-order-inversion with N locks (i.e. print stack traces for both lock acquisitions in every edge in the graph). More improvements to follow
llvm-svn: 204042
2014-03-17 14:41:36 +00:00
Kostya Serebryany a0eb97a50b [sanitizer] allow to store the lock context (stack trace id) with all currently held locks in a thread. This will allow the deadlock detector to provide better warnings (more changes to go)
llvm-svn: 204039
2014-03-17 12:27:42 +00:00
Kostya Serebryany bd7563eee2 [tsan] fox the GO build
llvm-svn: 204037
2014-03-17 10:37:44 +00:00
Kostya Serebryany 779ccf3b2c [sanitizer] one more output test for the deadlock detector
llvm-svn: 204036
2014-03-17 09:32:48 +00:00
Kostya Serebryany b9cb473fb8 [sanitizer] fix build warnings; add an output test for the deadlock detecor
llvm-svn: 204035
2014-03-17 09:21:41 +00:00
Kostya Serebryany d674e6bdde [sanitizer] print more stack traces when reporting a deadlock (even more to come)
llvm-svn: 204034
2014-03-17 09:07:24 +00:00
Dmitry Vyukov 3b37e8bf18 tsan: yet another attempt to fix pthread_cond interceptors
Make behavior introduced in r202820 conditional (under legacy_pthread_cond flag).
The new issue that we've hit with the satellite pthread_cond_t struct is
that pthread_condattr_getpshared does not work (satellite data is not shared between processes).
The idea is that most processes do not use pthread 2.2.5.
The rare ones that use (2.2.5 is dated by 2002) must specify legacy_pthread_cond=1
on their own risk.

llvm-svn: 204032
2014-03-17 07:51:53 +00:00
Kostya Serebryany c98564c3aa [sanitizer] make real_pthread_attr_getstack extern "C"
llvm-svn: 204029
2014-03-17 05:00:35 +00:00
Alexander Potapenko b76ea32834 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=274
by ignoring globals from __TEXT,__cstring,cstring_literals during instrumenation.
Add a regression test.

llvm-svn: 203916
2014-03-14 10:41:49 +00:00
Alexander Potapenko 9c97e0de24 [ASan] Remove the unneeded ASAN_RUNTIME_LDFLAGS.
llvm-svn: 203913
2014-03-14 10:16:59 +00:00
Alexey Samsonov 7a3d806c31 [CMake] Add trailing newline to test source file to make sure -Wnewline-eof doesn't fire
llvm-svn: 203911
2014-03-14 09:22:29 +00:00
Kostya Serebryany 8ecd7a2171 [sanitizer] fully implement racy fast path in bitset-based deadlock detector
llvm-svn: 203910
2014-03-14 09:22:01 +00:00
Kostya Serebryany 61a0f1c564 [sanitizer] partially implement racy fast path in bitset-based deadlock detector
llvm-svn: 203904
2014-03-14 08:06:15 +00:00
Kostya Serebryany c067864b6f [sanitizer] in bitset-based deadlock detector collect edge's stack trace when an edge is added to the graph (in following CLs these stack traces will be added to the report)
llvm-svn: 203902
2014-03-14 07:09:01 +00:00
Alexey Samsonov cbc68521b3 [CMake] More fixes for Windows build
llvm-svn: 203798
2014-03-13 13:37:07 +00:00
Kostya Serebryany 65dbf46950 [sanitizer] in bitvector-based deadlock detector split onLock into onLockBefore and onLockAfter hooks
llvm-svn: 203796
2014-03-13 13:21:30 +00:00
Evgeniy Stepanov 9fa9a49853 [msan] Test for aggregates passing through ellipsis.
llvm-svn: 203795
2014-03-13 13:18:15 +00:00
Alexey Samsonov 13f21af177 [TSan] Hide message about re-execing under verbosity flag
llvm-svn: 203793
2014-03-13 13:14:19 +00:00
Alexey Samsonov f97f07b1b8 [CMake] Attempt to fix standalone compiler-rt build on Windows
llvm-svn: 203789
2014-03-13 11:55:27 +00:00
Alexey Samsonov fe7e28c41f [CMake] Use /W3 instead of -Wall on Windows. Remove add_definitions abuse.
llvm-svn: 203786
2014-03-13 11:31:10 +00:00
Dmitry Vyukov a02fac7bec tsan: update the test since the bug is fixed
http://llvm.org/bugs/show_bug.cgi?id=19113 is fixed, so enable the better CHECK

llvm-svn: 203784
2014-03-13 10:54:16 +00:00
Timur Iskhodzhanov 28bc2f7a14 Work around PR19125: -Wconstant-logical-operand false positive
llvm-svn: 203782
2014-03-13 10:43:02 +00:00
Kostya Serebryany de3f20cf4b [sanitizer] support recursive rwlocks in bitset-based deadlock detector
llvm-svn: 203779
2014-03-13 10:26:03 +00:00
Timur Iskhodzhanov 5c40cc3549 Disable fast shadow zero'ing on Windows
llvm-svn: 203778
2014-03-13 10:15:10 +00:00
Timur Iskhodzhanov e8bd672d31 FastPoisonShadow: check for MmapFixedNoReserve failures
llvm-svn: 203776
2014-03-13 10:08:45 +00:00
Alexey Samsonov 32956d651a [CMake] Make append_if semantics similar to those used in LLVM
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Joerg Sonnenberger 361a553ace Preserve constness for intermediate pointers.
llvm-svn: 203743
2014-03-13 00:44:37 +00:00
Justin Bogner 8b77f351a8 Revert "profile: Use a simple binary format for profiling"
This will break without the corresponding change in clang, which I've
reverted until I figure out how to get it to link properly.

This reverts commit r203710.

llvm-svn: 203713
2014-03-12 21:07:26 +00:00
Justin Bogner ac7c599254 profile: Use a simple binary format for profiling
llvm-svn: 203710
2014-03-12 20:52:34 +00:00
Daniel Sanders f90e78a48d Implement Android versions of __clear_cache for arm32 & mips.
The MIPS version was reviewed by myself. The ARM version was reviewed by JF
Bastien.

Patch by Narayan Kamath <narayan@google.com>.

llvm-svn: 203674
2014-03-12 16:38:27 +00:00
Dmitry Vyukov 22196e777c tsan: fix deadlock in deadlock detector
forget to unlock a mutex on one of the paths

llvm-svn: 203663
2014-03-12 14:55:20 +00:00
Timur Iskhodzhanov c3687e7bf3 Fix MSVS warnings in the sanitizers RTL
llvm-svn: 203661
2014-03-12 14:09:25 +00:00
Viktor Kutuzov ebb00e1553 Add FreeBSD 9.2 support to asan_linux.cc
llvm-svn: 203658
2014-03-12 12:44:36 +00:00
Dmitry Vyukov 8c0f86e307 tsan: fix handling of pthread_cond_wait in presence of pthread_cancel
if the thread is cancelled in pthread_cond_wait, it locks the mutex before
processing pthread_cleanup stack
but tsan was missing that, thus reporting false double-lock/wrong-unlock errors
see the test for details

llvm-svn: 203648
2014-03-12 09:48:14 +00:00
Dmitry Vyukov 4076b3481a tsan: add interceptors for fopen64, freopen64, tmpfile, tmpfile64
llvm-svn: 203647
2014-03-12 08:26:43 +00:00
Dmitry Vyukov 47fd6179b1 tsan: add disabled test for http://llvm.org/bugs/show_bug.cgi?id=19113
llvm-svn: 203646
2014-03-12 08:24:49 +00:00
Hans Wennborg 9f74f15682 Revert "[asan] Make __cxa_demangle non-weak symbol on Android."
stlport doesn't include __cxa_demangle.

This reverts r201545.

llvm-svn: 203601
2014-03-11 20:23:59 +00:00
Alexander Potapenko a0c5a6763a [ASan] Don't build the ASan runtime with -undefined dynamic_lookup, which isn't necessary anymore.
Fixes https://code.google.com/p/address-sanitizer/issues/detail?id=266.

llvm-svn: 203572
2014-03-11 14:04:09 +00:00
Evgeniy Stepanov 14cd8e900f [sanitizer] Fix a typo.
llvm-svn: 203568
2014-03-11 13:35:41 +00:00
Viktor Kutuzov f31e53661f A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
llvm-svn: 203470
2014-03-10 16:50:53 +00:00
Tim Northover 65fe9377f0 ARM: fix file's header comment
llvm-svn: 203247
2014-03-07 14:56:29 +00:00
Alexey Samsonov 18adbc361a Remove sanitizer_linux_libcdep.cc from TSan-Go build
llvm-svn: 203238
2014-03-07 13:17:32 +00:00
Alexey Samsonov f3f3b9e5b6 [FreeBSD] Add support for sanitizer_linux_libcdep.cc
Patch by Viktor Kutuzov!

llvm-svn: 203235
2014-03-07 11:47:32 +00:00
Alexey Samsonov 78a6d2073f [FreeBSD] Port sanitizers' syscalls.
Patch by Viktor Kutuzov!

llvm-svn: 203227
2014-03-07 10:03:54 +00:00
Dmitry Vyukov f852f08fb1 tsan: fix pthread_cond_destroy interceptor on android
llvm-svn: 203226
2014-03-07 10:01:16 +00:00
Alexey Samsonov fefeecc7b0 [ASan] Better way to disable tests for functions unavailable on certain platforms
llvm-svn: 203224
2014-03-07 09:39:01 +00:00
Dmitry Vyukov dd419aee00 tsan: update Go windows build script
llvm-svn: 203121
2014-03-06 14:49:21 +00:00
Evgeniy Stepanov 72a9d25060 [sanitizer] Simplify interceptors with user callbacks.
Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE.
Get rid of all the thread-local contexts in interceptors.

llvm-svn: 203119
2014-03-06 13:26:09 +00:00
Dmitry Vyukov 350e7ddd34 tsan: update interface for Go
this is required to fix:
https://code.google.com/p/go/issues/detail?id=7460

llvm-svn: 203116
2014-03-06 13:17:28 +00:00
Alexey Samsonov 4a7e96e642 [CMake] Build compiler-rt libraries with -Wall
llvm-svn: 203113
2014-03-06 12:25:02 +00:00
Dmitry Vyukov 2516974e83 tsan: weaken concurrency guarantees in deadlock detector mutex hashmap
read locking on every access is too expensive

llvm-svn: 203112
2014-03-06 12:04:26 +00:00
Dmitry Vyukov 119aa0ea7c tsan: add -ftls-model=initial-exec to deadlock detector flags
one way or another it must present in the process from the beginning

llvm-svn: 203111
2014-03-06 12:03:39 +00:00
Dmitry Vyukov 69bd9ca91c tsan: better error message wording in deadlock reports
llvm-svn: 203109
2014-03-06 12:02:17 +00:00
Alexey Samsonov 5ec35b75ef [FreeBSD] Provide FreeBSD-specific things for ASan.
Patch by Viktor Kutuzov!

llvm-svn: 203100
2014-03-06 09:05:52 +00:00
Alexey Samsonov d52b9ba38d [FreeBSD] Enable procmaps on FreeBSD.
This is not the final patch for procmaps, but it's enough for building
sanitizers and tests on FreeBSD.

Patch by Viktor Kutuzov!

llvm-svn: 203099
2014-03-06 08:58:24 +00:00
Alexey Samsonov 921f5a529e asan_symbolize.py: use llvm-symbolizer results even if it returned function name w/o file/line info
llvm-svn: 202983
2014-03-05 15:18:50 +00:00
Alexey Samsonov 8ad7a05bb4 Improve llvm-symbolizer discovery in asan_symbolize.py
llvm-svn: 202982
2014-03-05 15:00:36 +00:00
Alexey Samsonov e062e4c7eb Enable memrchr interceptor only on Linux
llvm-svn: 202981
2014-03-05 14:07:19 +00:00
Dmitry Vyukov 792d4b1559 tsan: add missing header file to sanitizer_common cmake file
llvm-svn: 202979
2014-03-05 13:55:32 +00:00
Dmitry Vyukov e73e0a04d7 tsan: fix deadlock detector build for SANITIZER_DEADLOCK_DETECTOR_VERSION=2
llvm-svn: 202977
2014-03-05 13:53:29 +00:00
Dmitry Vyukov 9b410fb627 tsan: implement new version of standalong deadlock detector
intercept pthread_cond (it is required to properly track state of mutexes)
detect cycles in mutex graph

llvm-svn: 202975
2014-03-05 13:41:21 +00:00
Dmitry Vyukov cd3583a4c7 tsan: include what you use
VPrintf uses common_flags()

llvm-svn: 202974
2014-03-05 13:40:05 +00:00
Alexey Samsonov 6dece3c99f Add common interceptors for memchr/memrchr
llvm-svn: 202972
2014-03-05 13:25:32 +00:00
Alexey Samsonov 1464b5966d [CMake] Minor fix to llvm-config discovery
llvm-svn: 202954
2014-03-05 09:21:49 +00:00
Alexey Samsonov c8c38dbb18 Increase threshold in StackTrace::LocatePcInTrace
llvm-svn: 202950
2014-03-05 08:29:56 +00:00
Dmitry Vyukov 19126f9075 tsan: add interceptors for pthread_spinlock_t and ptread_rwlock_t for deadlock detector
llvm-svn: 202947
2014-03-05 08:10:27 +00:00
Dmitry Vyukov 30076b0244 tsan: add another missing windows atomic operation
llvm-svn: 202852
2014-03-04 14:21:42 +00:00
Dmitry Vyukov 0a650fe711 tsan: attempt to fix darwin build
everything except linux does not need this hackery with pthread_cond

llvm-svn: 202850
2014-03-04 14:16:28 +00:00
Alexey Samsonov 359c105c92 Fix StackTrace::LocatePcInTrace, add more unit tests for generic StackTrace
llvm-svn: 202849
2014-03-04 14:06:11 +00:00
Alexey Samsonov d964e7cd81 [CMake] Test for libdl and libpthread presence
llvm-svn: 202847
2014-03-04 13:28:21 +00:00
Sergey Matveev 8bf42919e6 [msan] Make up for missing interceptor in getxattr() test.
llvm-svn: 202846
2014-03-04 13:13:34 +00:00
Alexey Samsonov 3d9adc0a73 [ASan] Speed up stack trace unwinding for stacks of size 2.
Summary:
We don't need to do any work in this case - just take
the current PC and caller PC.

Reviewers: eugenis, ygribov

Reviewed By: eugenis

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2936

llvm-svn: 202845
2014-03-04 13:12:25 +00:00
Dmitry Vyukov d1d8653742 tsan: add dynamic library target for standalone deadlock detector
it's LD_PRELOAD-able

llvm-svn: 202843
2014-03-04 12:52:20 +00:00
Sergey Matveev e7b3e4c2ae [msan] Add missing line to getxattr() test.
llvm-svn: 202841
2014-03-04 12:41:18 +00:00
Alexey Samsonov 3e8467b8b9 Avoid doing any work when unwinding stack traces with 0 or 1 frame
llvm-svn: 202837
2014-03-04 12:21:28 +00:00
Dmitry Vyukov 9e3a217adb tsan: fix windows build
llvm-svn: 202831
2014-03-04 11:57:25 +00:00
Dmitry Vyukov 54a0303fa8 tsan: add concurrent hashmap for standalone deadlock detector
llvm-svn: 202826
2014-03-04 11:39:56 +00:00
Dmitry Vyukov e69df1f928 tsan: fix pthread_cond interceptors
currently tsan hangs when linked with a shared library linked against an old version of pthread
this change is another attempt to fix pthread_cond interceptors in different scenarios
see the comment for implementation details

llvm-svn: 202820
2014-03-04 11:11:40 +00:00
Tim Northover d3405cbb5d ARM: fix built-bots trying to use Thumb2 code on armv6m
llvm-svn: 202819
2014-03-04 11:10:58 +00:00
Dmitry Vyukov 975b02ad71 tsan: move all pthread_cond interceptors into sanitizer_common
llvm-svn: 202813
2014-03-04 10:17:40 +00:00
Tim Northover 1683caab3a ARM: implement __sync_fetch_and_* operations
Since these are primarily useful for deeply embedded targets where code size is
very important, they are each in a separate file making use of infrastructure
in sync-ops.h. This allows a linker to include just the functions that are
actually used.

rdar://problem/14736665

llvm-svn: 202812
2014-03-04 10:10:17 +00:00
Alexey Samsonov a7c602ac29 A set of trivial changes to support sanitizers on FreeBSD.
Patch by Viktor Kutuzov!

llvm-svn: 202801
2014-03-04 08:55:41 +00:00
Alexey Samsonov a79696d9bf [CMake] Port add_sanitizer_rt_symbols to CMake 3.0
Patch by Brad King.

Our add_sanitizer_rt_symbols macro reads the LOCATION property of a
library to compute the location of the "lib<name>.a.syms" file to
generate next to the corresponding "lib<name>.a" library file.  CMake
3.0 introduces policy CMP0026 to disallow reading of the LOCATION target
property from non-imported targets in favor of the more powerful
$<TARGET_FILE> generator expression.

Teach add_sanitizer_rt_symbols to use the $<TARGET_FILE> generator
expression to compute the location of the symbols file to generate
with a custom command.  CMake 3.0 also adds support for generator
expressions to install(FILES) so use it when available to simplify
installation of the symbols file of the proper configuration.

llvm-svn: 202797
2014-03-04 08:32:43 +00:00
Alexey Samsonov 72f17afd48 [CMake] Fix add_sanitizer_rt_symbols on multi-config CMake generators.
Patch by Brad King.

When using a multi-config generator with CMake, such as for VS or Xcode,
the LOCATION target property value contains a placeholder such as
"$(Configuration)" that is meant for substitution by the native build
tool. The install(FILES) command does not understand this name and will
not install the symbols file correctly when using these generators.

Teach add_sanitizer_rt_symbols to read the more-specific target property
LOCATION_<CONFIG> that has a per-configuration value and no placeholder.
On single-configuration generators (Makefile, Ninja), CMAKE_BUILD_TYPE
contains the name of the one configuration to be built.  On multi-config
generators (VS, Xcode), CMAKE_CONFIGURATION_TYPES contains the list of
possible configurations.  In the latter case, loop over the configs and
add a configuration-specific install(FILES) rule for each one.

Place the code block inside an if(TRUE) block so it can be made
conditional in a following change without updating indentation.

llvm-svn: 202796
2014-03-04 08:28:43 +00:00
Evgeniy Stepanov 2821fb7d18 [asan] Fix Android configure/make build.
Mirror recent cmake changes in the configure/make build system.

llvm-svn: 202793
2014-03-04 07:17:38 +00:00
Evgeniy Stepanov f7abc8dff6 [msan] Tests for X86 SIMD bitshift intrinsic support.
llvm-svn: 202713
2014-03-03 13:52:36 +00:00
Dmitry Vyukov 530fb9414b tsan: replace deadlock detector custom build script with cmake file
llvm-svn: 202708
2014-03-03 13:15:12 +00:00
Dmitry Vyukov 0df3a5688c tsan: remove autogenerated file
llvm-svn: 202704
2014-03-03 12:46:02 +00:00
Joerg Sonnenberger 7e6a314d7c Move __clzti2 into 128bit fragment.
llvm-svn: 202593
2014-03-01 15:57:30 +00:00
Joerg Sonnenberger 31a6db3eab Avoid type pruning.
llvm-svn: 202592
2014-03-01 15:32:05 +00:00
Joerg Sonnenberger 6e99daab4c Consistently use COMPILER_RT_ABI for all public symbols.
Move prototypes into headers and fix a few inconsistencies.

llvm-svn: 202591
2014-03-01 15:30:50 +00:00
Dmitry Vyukov 512a18e518 tsan: add standalone deadlock detector
llvm-svn: 202505
2014-02-28 14:52:20 +00:00
Dmitry Vyukov 9cffc9550b tsan: allow to force use of __libc_malloc in sanitizer_common
llvm-svn: 202504
2014-02-28 14:46:53 +00:00
Dmitry Vyukov 7210cdd473 tsan: add include guards
llvm-svn: 202503
2014-02-28 14:46:05 +00:00
Dmitry Vyukov 811d16c953 tsan: prevent actual deadlock in deadlock detector test
llvm-svn: 202502
2014-02-28 14:34:25 +00:00
Kostya Serebryany eae464f911 [sanitizer] speedup deadlock detector for the case when we acquire the first lock in a thread
llvm-svn: 202492
2014-02-28 11:56:14 +00:00
Kostya Serebryany afc4f2af76 [sanitizer] speedup deadlock detector for the case when we destroy a mutex that has never been locked
llvm-svn: 202487
2014-02-28 10:59:33 +00:00
Dmitry Vyukov 6cfab724ec tsan: refactor deadlock detector
Introduce DDetector interface between the tool and the DD itself.
It will help to experiment with other DD implementation,
as well as reuse DD in other tools.

llvm-svn: 202485
2014-02-28 10:48:13 +00:00
Dmitry Vyukov 371639ea1f tsan: deflake test
llvm-svn: 202484
2014-02-28 10:47:07 +00:00
Kostya Serebryany 261993ad1a [sanitizer] a test for recursive rwlock and deadlock detector (currently fails)
llvm-svn: 202480
2014-02-28 10:03:51 +00:00
Kostya Serebryany b86b56c0db [tsan] one more test for deadlock detector
llvm-svn: 202476
2014-02-28 09:17:16 +00:00
Alexey Samsonov 6c282b4149 [CMake] Fix PR18987: discard /MD flag if we're adding /MT
llvm-svn: 202472
2014-02-28 08:04:30 +00:00
Dmitry Vyukov 6403c34c2a tsan: add new line at the end of error message
llvm-svn: 202470
2014-02-28 06:29:42 +00:00
Alexander Potapenko e8c311a40c [ASan] Make sure IOC_DIRMASK is undefined before redefining it.
llvm-svn: 202410
2014-02-27 16:46:06 +00:00
Dmitry Vyukov d8c2fbd57f tsan: another attempt to fix the tls_get_addr crash
llvm-svn: 202405
2014-02-27 15:07:45 +00:00
Dmitry Vyukov 46ebecc1fe tsan: work around known bug in libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

llvm-svn: 202403
2014-02-27 14:43:31 +00:00
Alexey Samsonov 247eb8e52e Rewrite compiler-rt.llvm.org to make it relevant
llvm-svn: 202402
2014-02-27 14:39:48 +00:00
Kostya Serebryany 2ff42d98fa [sanitizer] do not acquire a global mutex in deadlock detector when dealing with Unlock (it is essentially a thread-local operation)
llvm-svn: 202401
2014-02-27 14:38:42 +00:00
Dmitry Vyukov a12923e265 tsan: intercept vfork
this fixes obscure false positives
see the comments and the test for details

llvm-svn: 202400
2014-02-27 14:36:16 +00:00
Kostya Serebryany 796f6557bf [asan] *experimental* implementation of invalid-pointer-pair detector (finds when two unrelated pointers are compared or subtracted). This implementation has both false positives and false negatives and is not tuned for performance. A bug report for a proper implementation will follow.
llvm-svn: 202389
2014-02-27 12:45:36 +00:00
Timur Iskhodzhanov a0091be449 Add myself as a c-rt owner of ASan/Win
llvm-svn: 202380
2014-02-27 12:07:43 +00:00
Dmitry Vyukov 17ca4d06c7 tsan: 2 more deadlock detector benchmarks
llvm-svn: 202379
2014-02-27 12:05:17 +00:00
Alexey Samsonov 6482bfedf2 Fix Howard's e-mail
llvm-svn: 202378
2014-02-27 11:00:21 +00:00
Alexey Samsonov 929a3080e9 Add CODE_OWNERS.TXT
llvm-svn: 202377
2014-02-27 10:51:48 +00:00
Evgeniy Stepanov 037c271f41 [sanitizer] Fix iOS build.
llvm-svn: 202374
2014-02-27 10:09:21 +00:00
Dmitry Vyukov 8a0813d944 tsan: fix deadlock detector lit test output
llvm-svn: 202368
2014-02-27 09:18:08 +00:00
Dmitry Vyukov 511118c762 tsan: add another deadlock detector benchmark
llvm-svn: 202366
2014-02-27 09:05:07 +00:00
Dmitry Vyukov 6fd67f9c7a tsan: fix internal deadlock detector for external deadlock detector
we must go deeper!

llvm-svn: 202365
2014-02-27 09:02:58 +00:00
Evgeniy Stepanov a16f327c27 [sanitizer] Sizes and layouts for sanitizers on FreeBSD.
Patch by Viktor Kutuzov.

llvm-svn: 202364
2014-02-27 09:02:08 +00:00
Evgeniy Stepanov 322e89c4e2 [asan] Install asan_device_setup to bin/ when targetting Android.
asan_device_setup is a utility that prepares a device to run code built with
ASan. Essentially, it installs ASan runtime library into the system. For this
reason, it has to be at a predictable relative path from the runtime library
itself. We also plan to distribute this utility, packaged with runtime library
and maybe llvm-symbolizer, to the users.

llvm-svn: 202362
2014-02-27 08:41:40 +00:00
Dmitry Vyukov 794500ae4e tsan: add recursive deadlock detector benchmark
llvm-svn: 202361
2014-02-27 08:33:52 +00:00
Evgeniy Stepanov 6edfad4811 [asan] Don't disable SEGV handler on Android by default.
This is done mostly for consistency, because this setting is normally overridden in cmake.

llvm-svn: 202359
2014-02-27 08:23:00 +00:00
Dmitry Vyukov c546943b6a tsan: improve deadlock detector test
- allow to specify which test to run
- allow to specify number of iterations
- specify number of threads required in the test itself

llvm-svn: 202358
2014-02-27 08:04:20 +00:00
Alexey Samsonov 4cced3e19b [CMake] Make sure add_compiler_rt_resource_file doesn't do unnecessary work
llvm-svn: 202356
2014-02-27 07:22:59 +00:00
Alexey Samsonov 8c4c09786a Add accidentally removed -D
llvm-svn: 202355
2014-02-27 07:03:32 +00:00
Alexey Samsonov e3e2a11ad9 Move COMPILER_RT_HAS_FUNC check from r202303 to config-ix.cmake
llvm-svn: 202353
2014-02-27 06:52:41 +00:00
Reid Kleckner 0140ce483f Append -D__func__=__FUNCTION__ to SANITIZER_COMMON_CFLAGS
This way it gets picked up for all sanitizer libs, both sanitizer_common
and asan.  I believe those are the only libs that build with asan.
There should be no need to set the __func__ definition inside
clang_compile.

llvm-svn: 202303
2014-02-26 21:54:39 +00:00
Joerg Sonnenberger 3d7afbb945 Undef helper macros after using them.
llvm-svn: 202298
2014-02-26 20:38:24 +00:00
Joerg Sonnenberger 9d09e2fe90 Reapply r201910. MSVC gets __func__ defined explicitly, even though it
can't build anything here.

llvm-svn: 202297
2014-02-26 20:33:22 +00:00
Joerg Sonnenberger 2b41390c89 Emulate C99/C++11 __func__ for Visual C++.
llvm-svn: 202296
2014-02-26 20:31:17 +00:00
Dmitry Vyukov 0f34a3ba8c tsan: fix deadlock detector test so that it does not force contention in runtime
llvm-svn: 202278
2014-02-26 17:06:58 +00:00
Alexey Samsonov 14e061d7cc Support 'q' length modifier in scanf/printf interceptors
llvm-svn: 202268
2014-02-26 14:42:38 +00:00
Alexander Potapenko 4b1a7fe33a [ASan] Split interception-in-shared-lib-test.cc into two tests with platform-specific RUN commands.
Get rid of a TestCases/SharedLibs/shared-lib-test-so.cc dependency in these tests.

llvm-svn: 202267
2014-02-26 14:05:57 +00:00
Kostya Serebryany 78443cfda6 [asan] remove UB (comparison of two unrelated pointers) from a test
llvm-svn: 202266
2014-02-26 13:53:23 +00:00
Evgeniy Stepanov f4dcf77623 [asan] Fix printing of long reports to logcat on Android.
__android_log_write has an implicit message length limit.
Print one line at a time.

llvm-svn: 202250
2014-02-26 09:39:55 +00:00
Evgeniy Stepanov e23add20ae [sanitizer] Add a flag to enable/disable report colorization.
llvm-svn: 202249
2014-02-26 09:06:59 +00:00
Evgeniy Stepanov 3ff723f373 [asan] asan_device_setup: fix a typo in usage text
llvm-svn: 202246
2014-02-26 08:12:28 +00:00
Evgeniy Stepanov 84610ed7bf [asan] Remove .sh extension from asan_device_setup.
llvm-svn: 202245
2014-02-26 08:10:03 +00:00
Alexey Samsonov 10d0003a21 Revert r201783 until all FreeBSD fixes are submitted.
llvm-svn: 202244
2014-02-26 07:50:28 +00:00
NAKAMURA Takumi 9cd9ad6b9d [CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).
For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

llvm-svn: 202239
2014-02-26 06:45:11 +00:00
Richard Trieu a170f08109 Remove 'tctx->name' from a logical statement since it is a pointer and always
is converted to a true value.  Detected by Clang's improved -Wbool-conversion

llvm-svn: 202223
2014-02-26 03:12:51 +00:00
Evgeniy Stepanov 6697dc6aa3 [asan] Remove extra sonames from libraries in tests.
llvm-svn: 202156
2014-02-25 15:25:37 +00:00
Kostya Serebryany 67968cbf93 [sanitizer] minimal support for recursive locks indeadlock detector
llvm-svn: 202153
2014-02-25 14:02:01 +00:00
Evgeniy Stepanov e4d8577c69 [asan] Reenable waitid test on Android.
waitid() is present since API level 9 (Android 2.3). That's old enough.

llvm-svn: 202149
2014-02-25 13:24:42 +00:00
Alexey Samsonov 98aa08c0e9 Update sanitizers' bash scripts.
* Fix bash scripts to work on FreeBSD (patch by Viktor Kutuzov)
* Update locations of lit tests in check_lint script.

llvm-svn: 202145
2014-02-25 12:09:25 +00:00
Alexander Potapenko 2d4b60f9a3 [ASan] Don't set rpath when building ASan runtime libraries.
This should fix the issues with `make check-asan` on OS X.

llvm-svn: 202144
2014-02-25 11:54:25 +00:00
Kostya Serebryany 01be296dbb [sanitizer] support pthread_rwlock_rd* in deadlock detector
llvm-svn: 202132
2014-02-25 10:33:37 +00:00
Kostya Serebryany fd88edfddb [sanitizer] partially support pthread_rwlock_* (no rd* form yet)
llvm-svn: 202128
2014-02-25 09:33:10 +00:00