Commit Graph

3877 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith ae2f0bbcf1 InstrProf: Add simple compiler-rt test
Add the test infrastructure for testing lib/profile and a single test.
This initial commit only enables the tests on Darwin, but they'll be
enabled on Linux soon after.

<rdar://problem/16458307>

llvm-svn: 205256
2014-03-31 22:45:37 +00:00
Evgeniy Stepanov 3c95744de8 [msan] Remove an extra top frame from track-origins=2 reports.
llvm-svn: 205192
2014-03-31 14:18:55 +00:00
Evgeniy Stepanov ff127bff89 [sanitizer] Test that we can compile C++ code on the target platform.
llvm-svn: 205184
2014-03-31 13:50:13 +00:00
Alexey Samsonov 78a8435fd6 [CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.

llvm-svn: 205183
2014-03-31 13:45:36 +00:00
Alexander Potapenko 0315b52444 [TSan] Follow-up for r205175: typo fix in the test.
llvm-svn: 205176
2014-03-31 10:51:13 +00:00
Alexander Potapenko 0426176940 [TSan] Replace several Printf() calls with Report() to ease debugging.
llvm-svn: 205175
2014-03-31 10:46:07 +00:00
Kostya Serebryany 683d55f50e [sanitizer] speed up the bitvector-based deadlock detector by ~15% (iterate over the currently held locks using the array, not the bitvector. Bitvector is not the best data structure to iterate over)
llvm-svn: 205168
2014-03-31 07:23:50 +00:00
Evgeniy Stepanov 6f34082590 [sanitizer] Fix Mac build.
llvm-svn: 205006
2014-03-28 14:01:40 +00:00
Evgeniy Stepanov 86a4d2c32b [sanitizer] Intercept fgetpwent / fgetgrent.
These interceptors require deep unpoisoning of return values.
While at it, we do the same for all other pw/gr interceptors to
reduce dependency on libc implementation details.

llvm-svn: 205004
2014-03-28 13:03:55 +00:00
Evgeniy Stepanov 163ee4efb5 [sanitizer] Intercept setpwent/endpwent.
It's hard to write a reliable test for this code because they
work with unpredictable memory locations. But this change should
fix current failures in getpwent() tests on the sanitizer bots.

llvm-svn: 205002
2014-03-28 11:46:35 +00:00
Evgeniy Stepanov 92bee36b3e [sanitizer] Intercept rand_r.
llvm-svn: 205001
2014-03-28 11:21:45 +00:00
Evgeniy Stepanov 74e77756ef [sanitizer] Intercept getpwent/getgrent.
llvm-svn: 205000
2014-03-28 10:56:07 +00:00
Joerg Sonnenberger ea1f8fb775 Add instrastructure for IEEE quad precision.
Based on patch from GuanHong Liu.

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

llvm-svn: 204999
2014-03-28 10:29:31 +00:00
Evgeniy Stepanov 2e972f63b5 [sanitizer] Intercept mktime.
llvm-svn: 204994
2014-03-28 09:02:57 +00:00
Evgeniy Stepanov 7b44e1ad42 [sanitizer] Intercept ftime.
llvm-svn: 204991
2014-03-28 08:33:32 +00:00
Evgeniy Stepanov a6eb1bb59e [sanitizer] Intercept __bzero on Mac.
This should make memset_test pass on Mac.

llvm-svn: 204929
2014-03-27 14:20:34 +00:00
Evgeniy Stepanov 1189734413 [sanitizer] Fix Android build.
llvm-svn: 204927
2014-03-27 14:06:15 +00:00
Evgeniy Stepanov 89602651e8 [msan] Implement __msan_set_death_callback.
llvm-svn: 204926
2014-03-27 14:04:58 +00:00
Timur Iskhodzhanov e6303d1224 Add support for _expand[_dbg] so we don't crash when _aligned_* allocation functions are used
llvm-svn: 204925
2014-03-27 14:01:11 +00:00
Evgeniy Stepanov 9dcd5a353a [msan] Intercept several malloc-related functions.
llvm-svn: 204923
2014-03-27 13:29:29 +00:00
Kostya Serebryany d093b5ac43 [asan] add a test case for r204897.
llvm-svn: 204903
2014-03-27 08:51:32 +00:00
Kostya Serebryany 88d0eac412 [asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri Gribov
llvm-svn: 204897
2014-03-27 07:36:26 +00:00
Greg Fitzgerald ffa4b7993f Revert r204877 "Allow the user to override the compiler used for testing"
Unbreak the sanitizer-x86_64-linux bot.

Change-Id: Ie03f1b93fae45c54b142003731ff4f5d4f6b62f8
llvm-svn: 204886
2014-03-27 01:11:12 +00:00
Greg Fitzgerald 6ff4f89af3 Allow the user to override the compiler used for testing
Change-Id: Ida62c2d85f541260f505c3dbd5d71a4b2a6004f4
llvm-svn: 204877
2014-03-26 23:51:44 +00:00
Peter Collingbourne 5d167dae7d Add function to get the number of DFSan labels allocated.
Expose the number of DFSan labels allocated by adding function dfsan_get_label_count().

Patch by Sam Kerner!

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

llvm-svn: 204854
2014-03-26 21:09:53 +00:00
Dmitry Vyukov e31dd3473e tsan: deflake test
llvm-svn: 204824
2014-03-26 15:51:11 +00:00
Rafael Espindola 5e46070516 Avoid aliases to weak aliases in interceptors.
The interceptors had code that after macro expansion ended up looking like

extern "C" void memalign()
    __attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
    __attribute__((alias("memalign")));

That is,
* __interceptor_memalign is a function
* memalign is a weak alias to __interceptor_memalign
* __interceptor___libc_memalign is an alias to memalign

Both gcc and clang produce assembly that look like

__interceptor_memalign:
...
        .weak   memalign
memalign = __interceptor_memalign
        .globl  __interceptor___libc_memalign
__interceptor___libc_memalign = memalign

What it means in the end is that we have 3 symbols pointing to the
same position in the file, one of which is weak:

     8: 0000000000000000     1 FUNC    GLOBAL DEFAULT    1
__interceptor_memalign
     9: 0000000000000000     1 FUNC    WEAK   DEFAULT    1 memalign
    10: 0000000000000000     1 FUNC    GLOBAL DEFAULT    1
__interceptor___libc_memalign

In particular, note that __interceptor___libc_memalign will always
point to __interceptor_memalign, even if we do link in a strong symbol
for memalign. In fact, the above code produces exactly the same binary
as

extern "C" void memalign()
    __attribute__((weak, alias("__interceptor_memalign")));
extern "C" void __interceptor_memalign() {}
extern "C" void __interceptor___libc_memalign()
    __attribute__((alias("__interceptor_memalign")));

If nothing else, this patch makes it more obvious what is going on.

llvm-svn: 204823
2014-03-26 15:48:59 +00:00
Dmitry Vyukov 4bfb4cb1e7 tsan: add pthread_barrier_t test
llvm-svn: 204810
2014-03-26 14:13:49 +00:00
Dmitry Vyukov 5da31e03bf tsan: fix deadlock during fork
ReportRace takes the two mutexes in the opposite order

llvm-svn: 204809
2014-03-26 14:13:31 +00:00
Dmitry Vyukov b979a55607 tsan: fix another compiler-injected memset
newer gcc inserts memset here

llvm-svn: 204808
2014-03-26 14:13:00 +00:00
Evgeniy Stepanov 16d89fc356 [sanitizer] Intercept __aeabi_mem(set|cpy|move).
llvm-svn: 204800
2014-03-26 12:14:34 +00:00
Viktor Kutuzov 9068dfa6a7 Define uintptr_t in the profiling sources on x86_64 FreeBSD in 32-bit mode
llvm-svn: 204799
2014-03-26 12:00:44 +00:00
Alexander Potapenko 7caa0b9e36 [ASan] Fix a thinko spotted by Evgeniy Stepanov: use REAL(memcpy) on non-OSX systems.
llvm-svn: 204794
2014-03-26 11:18:25 +00:00
Evgeniy Stepanov 1382fabd97 [msan] Enable SelectPartial test.
Fixed in r204716.

llvm-svn: 204717
2014-03-25 13:09:14 +00:00
Evgeniy Stepanov 1611ed8879 [tsan] Fix more warnings in TSan tests.
llvm-svn: 204715
2014-03-25 13:01:32 +00:00
Evgeniy Stepanov 0f08043aeb [tsan] Fix compiler warnings in TSan tests.
llvm-svn: 204712
2014-03-25 11:17:14 +00:00
Evgeniy Stepanov 517ff05ffb [msan] Fix compiler warning in msan_test.cc.
llvm-svn: 204708
2014-03-25 10:03:39 +00:00
Evgeniy Stepanov 90384ad60e [msan] A disabled test for inexact "select" instrumentation.
llvm-svn: 204707
2014-03-25 09:36:15 +00:00
Duncan P. N. Exon Smith 21b98a6c83 InstrProf: Change the extension of the default profile
Change the name of the default profile dumped by compiler-rt to
default.profraw.  This distinguishes it more clearly from the
(incompatible) format output by llvm-profdata that is read by clang
-fprofile-instr-use.

llvm-svn: 204676
2014-03-24 21:53:42 +00:00
Dmitry Vyukov d23118c3b2 tsan: optimize vector clock operations
Make vector clock operations O(1) for several important classes of use cases.
See comments for details.
Below are stats from a large server app, 77% of all clock operations are handled as O(1).

Clock acquire                     :         25983645
  empty clock                     :          6288080
  fast from release-store         :         14917504
  contains my tid                 :          4515743
  repeated (fast)                 :          2141428
  full (slow)                     :          2636633
  acquired something              :          1426863
Clock release                     :          2544216
  resize                          :             6241
  fast1                           :           197693
  fast2                           :          1016293
  fast3                           :             2007
  full (slow)                     :          1797488
  was acquired                    :           709227
  clear tail                      :                1
  last overflow                   :                0
Clock release store               :          3446946
  resize                          :           200516
  fast                            :           469265
  slow                            :          2977681
  clear tail                      :                0
Clock acquire-release             :           820028

llvm-svn: 204656
2014-03-24 18:54:20 +00:00
Dmitry Vyukov f49921ba53 tsan: reorder SyncVar members to reduce contention
llvm-svn: 204655
2014-03-24 18:51:37 +00:00
Dmitry Vyukov 781eca5f71 tsan: use read lock instead of write in atomic operations when possible
llvm-svn: 204654
2014-03-24 18:51:13 +00:00
Dmitry Vyukov 775b11cc53 tsan: reduce default number of threads in benchmarks
buildbots seem to OOM with that many threads

llvm-svn: 204610
2014-03-24 15:23:05 +00:00
Dmitry Vyukov 238bd23534 tsan: add benchmarks for synchronization handling
llvm-svn: 204608
2014-03-24 14:32:59 +00:00
Alexey Samsonov c41ca6d31a [CMake] Rename the variable
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Timur Iskhodzhanov 59ce9e07a4 Fix a VS compile-time warning
warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized

llvm-svn: 204597
2014-03-24 10:47:37 +00:00
Viktor Kutuzov 276fefb8d9 A fix for sanitizers' TLS support on FreeBSD
llvm-svn: 204595
2014-03-24 10:01:54 +00:00
Alexey Samsonov 1847401332 [CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Alexey Samsonov 8c956460d3 Make MSan unittest -Werror=sign-compare clean
llvm-svn: 204592
2014-03-24 09:41:11 +00:00
Evgeniy Stepanov ce002ad3b2 [asan] Disable setjmp/sigsetjmp tests.
Failing due to PR19207.

llvm-svn: 204590
2014-03-24 08:30:59 +00:00