Commit Graph

4347 Commits

Author SHA1 Message Date
Dmitry Vyukov 0eb1c6f2fb tsan: fix windows build script
llvm-svn: 211422
2014-06-20 23:22:31 +00:00
Dmitry Vyukov 73e1804c21 tsan: add Go build script for freebsd
llvm-svn: 211419
2014-06-20 22:53:43 +00:00
Dmitry Vyukov b820599a3a tsan: port to freebsd
llvm-svn: 211418
2014-06-20 22:51:18 +00:00
Dmitry Vyukov f9c22916d5 tsan: fix freebsd build
freebsd does not have /proc/self/environ

llvm-svn: 211417
2014-06-20 22:49:41 +00:00
Dmitry Vyukov d84ce00f75 tsan: remove unused header include
llvm-svn: 211389
2014-06-20 18:56:11 +00:00
Dmitry Vyukov 5c4a3d3118 tsan: remove unused header include
llvm-svn: 211386
2014-06-20 18:30:06 +00:00
Dmitry Vyukov 3fc095e031 tsan: remove unused header include
llvm-svn: 211385
2014-06-20 18:28:34 +00:00
Kostya Serebryany cd60ed53f6 [asan] when reporting an ODR violation, also print the stack traces where the globals have been registered (thus show the name of shared library or exe to which the global belongs). The reports become a bit too verbose but I do not see any *simple* way to make them more compact. This should be especially helpful when the ODR happens because the same .cc file is used twice in the project in differend DSOs
llvm-svn: 211343
2014-06-20 08:24:12 +00:00
Joerg Sonnenberger 61d5d38e80 Provide mul for IEEE quad. From GuanHong Liu.
Differential Revision: http://reviews.llvm.org/D2799

llvm-svn: 211313
2014-06-19 20:34:03 +00:00
Joerg Sonnenberger 361519f409 Provide add and sub for IEEE quad. From GuanHong Liu.
Differential Revision: http://reviews.llvm.org/D2798

llvm-svn: 211312
2014-06-19 20:24:49 +00:00
Evgeniy Stepanov a2327c3a65 [sanitizer] Intercept pthread_*attr_get*.
This is a resubmit of r211166 reverted due to osx breakage.

llvm-svn: 211264
2014-06-19 10:19:57 +00:00
Arnold Schwaighofer 868050a667 Revert "[sanitizer] Intercept pthread_*attr_get*."
This reverts commit r211166. It broke public mac os x bots.

llvm-svn: 211206
2014-06-18 19:04:47 +00:00
Evgeniy Stepanov b87f1efc5f [sanitizer] Intercept pthread_*attr_get*.
llvm-svn: 211166
2014-06-18 14:16:41 +00:00
Evgeniy Stepanov 2c27df9a33 [msan] Intercept __getdelim.
llvm-svn: 211162
2014-06-18 13:35:13 +00:00
Evgeniy Stepanov 4ea1647e8b [msan] Handle X86 *.psad.* and *.pmadd.* intrinsics.
llvm-svn: 211156
2014-06-18 12:02:29 +00:00
Alexander Potapenko 853a232e66 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time() and frexp()
Add a test for the frexp() interceptor.
Annotate the interceptors that may potentially corrupt stack IDs of freed buffers with FIXME comments.

llvm-svn: 211153
2014-06-18 09:27:40 +00:00
Evgeniy Stepanov df187feae4 [msan] Fix handling of multiplication by a constant with a number of trailing zeroes.
Multiplication by an integer with a number of trailing zero bits leaves
the same number of lower bits of the result initialized to zero.
This change makes MSan take this into account in the case of multiplication by
a compile-time constant.

We don't handle the general, non-constant, case because
(a) it's not going to be cheap (computation-wise);
(b) multiplication by a partially uninitialized value in user code is
    a bad idea anyway.

Constant case must be handled because it appears from LLVM optimization of a
completely valid user code, as the test case in compiler-rt demonstrates.

llvm-svn: 211092
2014-06-17 09:23:12 +00:00
Saleem Abdulrasool 8f2efc3a91 builtins: add it blocks for Thumb-2
Add the missing IT-blocks for Thumb-2 compilation for code paths exercised by
older ARM CPUs.  This should fix the buildbots.

llvm-svn: 211035
2014-06-16 16:36:25 +00:00
Saleem Abdulrasool 1b8f1a4430 compiler-rt: prefer thumb over ARM
When possible, use Thumb or Thumb-2 over ARM instructions.  This is particularly
important for pure-Thumb environments (e.g. Windows on ARM).  Although, it is
possible to conditionalise this for that target specifically, this is available
on most newer ARM CPUs, and the code remains compatible with older CPUs with no
adverse effects.  It therefore feels better to always prefer Thumb when
possible.

llvm-svn: 211032
2014-06-16 16:05:24 +00:00
Dan Albert 1236ac388d Swap getdtablesize() for sysconf(_SC_OPEN_MAX).
Bionic is no removing this as it was removed from POSIX 2004.

llvm-svn: 211027
2014-06-16 14:51:11 +00:00
Sergey Matveev 998d991b2d [sanitizer] Support PTRACE_GETEVENTMSG in the ptrace() interceptor.
llvm-svn: 211022
2014-06-16 13:49:13 +00:00
Joerg Sonnenberger 739f4302b5 Add Guan-Hong Liu.
llvm-svn: 211009
2014-06-16 08:38:19 +00:00
Kostya Serebryany 9f5d48c0a0 [asan] initialze varaibles to avoid a (false positive) report from gcc's -Wmaybe-uninitialized
llvm-svn: 211008
2014-06-16 08:32:02 +00:00
Viktor Kutuzov 9101af0612 Fix building InstrProfilingFile.c on FreeBSD
llvm-svn: 210989
2014-06-15 14:01:18 +00:00
Viktor Kutuzov 1f386f0f36 Fix getting IP, BP and SP for address sanitizer's needs on FreeBSD in 32-bit mode
llvm-svn: 210988
2014-06-15 13:56:28 +00:00
Dan Albert 1c71fde161 Exclude Android from the tests for valloc/pvalloc.
These functions are being removed from Android because they were removed
from POSIX 2004.

llvm-svn: 210962
2014-06-14 00:50:03 +00:00
Alexey Samsonov e287ef847a [Sanitizer] Merge AnsiColorDecorator and SanitizerCommonDecorator, use the latter in UBSan
llvm-svn: 210959
2014-06-13 23:46:37 +00:00
Alexey Samsonov 3e61c52352 [UBSan] Respect runtime flag for colorizing reports
llvm-svn: 210950
2014-06-13 22:48:40 +00:00
Alexey Samsonov e595e1ade0 Remove top-level Clang -fsanitize= flags for optional ASan features.
Init-order and use-after-return modes can currently be enabled
by runtime flags. use-after-scope mode is not really working at the
moment.

The only problem I see is that users won't be able to disable extra
instrumentation for init-order and use-after-scope by a top-level Clang flag.
But this instrumentation was implicitly enabled for quite a while and
we didn't hear from users hurt by it.

llvm-svn: 210924
2014-06-13 17:53:44 +00:00
Evgeniy Stepanov dfa5439652 [asan] Fix mmap-ed coverage with coverage=0.
llvm-svn: 210655
2014-06-11 15:11:26 +00:00
Evgeniy Stepanov 9ae3d02193 [asan] Run Android test with asanwrapper.
This better replicates the target environment.

llvm-svn: 210650
2014-06-11 10:37:06 +00:00
Evgeniy Stepanov b2b4c3ab32 [asan] Exclude non-executable mappings from coverage.
llvm-svn: 210649
2014-06-11 10:11:51 +00:00
Evgeniy Stepanov 46fa9f2d9e [asan] One more coverage test.
Test that coverage is dumped correctly (and completely) even when the processed
gets SIGKILL-ed.

llvm-svn: 210647
2014-06-11 09:23:25 +00:00
Evgeniy Stepanov 125a302257 [asan] Fix coverage-android test to avoid name conflict.
And re-enable it.

llvm-svn: 210646
2014-06-11 09:09:09 +00:00
Alexander Potapenko 14f8ac04e3 Add detection of OS X relocatable SDK to compiler-rt as a lit.util function
Clang's lit cfg already detects the currently selected SDK via
"xcrun --show-sdk-path". The same thing should be done for compiler-rt tests,
to make them work on recent OS X versions. Instead of duplicating the detection
code, this patch extracts the detection function into a lit.util method.

Patch by Kuba Brecka (kuba.brecka@gmail.com),
reviewed at http://reviews.llvm.org/D4072

llvm-svn: 210534
2014-06-10 14:22:00 +00:00
Evgeniy Stepanov 9cc3ebdd3b [sanitizer] Relax sanity checks in ioctl decoding.
Standard KVM ioctls don't pass currect ioctl_decode().

llvm-svn: 210533
2014-06-10 13:54:15 +00:00
Evgeniy Stepanov 48eccb7fb3 [asan] Disable a flaky test.
llvm-svn: 210517
2014-06-10 08:32:01 +00:00
Alexey Samsonov f0d1fd6b32 [TSan] Exclude blacklist tests from manual test runner
llvm-svn: 210494
2014-06-09 22:02:14 +00:00
Evgeniy Stepanov b22b963669 [asan] Remove dependency of tests on runtime library in standalone build.
llvm-svn: 210465
2014-06-09 11:17:37 +00:00
Evgeniy Stepanov 9959915890 [msan] Intercept __strto*_internal.
This should fix strtoimax/strtoumax on newer glibc.
https://code.google.com/p/memory-sanitizer/issues/detail?id=36

llvm-svn: 210463
2014-06-09 10:41:22 +00:00
Evgeniy Stepanov 2be29929be Fix line numbers for code inlined from __nodebug__ functions.
Instructions from __nodebug__ functions don't have file:line
information even when inlined into no-nodebug functions. As a result,
intrinsics (SSE and other) from <*intrin.h> clang headers _never_
have file:line information.

With this change, an instruction without !dbg metadata gets one from
the call instruction when inlined.

Fixes PR19001.

llvm-svn: 210459
2014-06-09 09:09:19 +00:00
Evgeniy Stepanov 66c6a18d39 [msan] Add a test for mmx.packuswb.
llvm-svn: 210458
2014-06-09 08:58:41 +00:00
Evgeniy Stepanov aaaf74f9fb [msan] Simplify tests.
llvm-svn: 210457
2014-06-09 08:57:40 +00:00
Evgeniy Stepanov 63ece03c57 [asan] Add malloc_usable_size to android malloc dispatch.
llvm-svn: 210452
2014-06-09 08:36:14 +00:00
Alexey Samsonov 2c8dda4e53 [TSan] Make lit-tests more self-contained
llvm-svn: 210370
2014-06-06 21:04:55 +00:00
Dmitry Vyukov 9ff85e9674 tsan: fix argument passing in Go interface
Go calling convention does not support bools (it probably works, but uptrs are safer)

llvm-svn: 210365
2014-06-06 18:53:52 +00:00
Greg Fitzgerald e124a30fbe Un-xfail passing ARM Android tests
llvm-svn: 210360
2014-06-06 18:06:58 +00:00
Dmitry Vyukov 13793e5121 tsan: fix CurrentStackId
FuncEnter adds FuncEnter entry to trace that nobody removes later

llvm-svn: 210359
2014-06-06 18:05:12 +00:00
Dmitry Vyukov d858fa77d6 tsan: fix mutex in Go mode
In Go it's legal to unlock from a different goroutine.

llvm-svn: 210358
2014-06-06 18:04:05 +00:00
Dmitry Vyukov fc9b5d67a6 tsan: disable reporting of mutex misuses in Go
llvm-svn: 210353
2014-06-06 17:23:27 +00:00
Dmitry Vyukov 9546afec62 tsan: minor optimizations for Go runtime
llvm-svn: 210351
2014-06-06 16:06:19 +00:00
Dmitry Vyukov 75f5cf657e tsan: fix out-of-bounds access in Go runtime
FuncEntry can resize the shadow stack, while "thr->shadow_stack_pos[0] = pc" writes out-of-bounds.

llvm-svn: 210349
2014-06-06 15:56:08 +00:00
Dmitry Vyukov 32336152af tsan: fix mapping of meta shadow for Go
Go maps heap and data+bss, these regions are not adjacent.
data+bss is mapped first.

llvm-svn: 210348
2014-06-06 15:54:49 +00:00
Dmitry Vyukov ff194daead tsan: flush metamap per-thread cache when thread finishes
llvm-svn: 210347
2014-06-06 15:52:10 +00:00
Dmitry Vyukov feb4ede8ac tsan: fix clang warning:
comparison of unsigned expression >= 0 is always true

llvm-svn: 210346
2014-06-06 15:51:20 +00:00
Dmitry Vyukov 4f6de1d684 tsan: fix Go build with TSAN_COLLECT_STATS
Go does not have cur_thread function.

llvm-svn: 210345
2014-06-06 15:50:29 +00:00
Dmitry Vyukov 8744b1c1e3 tsan: allow to build Go runtime with clang + enable SSE3
llvm-svn: 210344
2014-06-06 15:49:49 +00:00
Evgeniy Stepanov ee98fb197b [msan] Fix wrong endianness when printing shadow.
llvm-svn: 210335
2014-06-06 14:06:14 +00:00
Evgeniy Stepanov 3e810b01c3 [msan] Partial revert of r210331.
Bots did not like it.

llvm-svn: 210332
2014-06-06 13:35:25 +00:00
Evgeniy Stepanov 9438bf1f62 [msan] Better diagnostic for invalid origin id.
llvm-svn: 210331
2014-06-06 12:58:44 +00:00
Dmitry Vyukov 909b7490a3 sanitizer: document missing macro
llvm-svn: 210329
2014-06-06 12:16:26 +00:00
Evgeniy Stepanov e5c34ace7f [asan] Make ReplaceSystemMalloc optional on Android.
Don't fail if __libc_malloc_dispatch is missing; continue running
with normal linux interceptors instead.

llvm-svn: 210322
2014-06-06 10:57:21 +00:00
Kostya Serebryany 558b3363a7 [asan] initialize fake_stack_ to 0 before we call SetThreadStackAndTls, because that may actually try to use fake_stack_ (still don't know how). Yet another case where we desperately want https://sourceware.org/glibc/wiki/ThreadPropertiesAPI
llvm-svn: 210315
2014-06-06 07:35:35 +00:00
Alexey Samsonov f251e0051c [TSan] Reduce the stack frame size of ReportDeadlock
llvm-svn: 210301
2014-06-05 23:24:46 +00:00
Evgeniy Stepanov 38c228a842 [asancov] Faster coverage in memory-mapped mode.
Use caller pc of __sanitizer_cov_module_init to figure out
when 2 sequential calls are from the same module; skip
.sancov.map file update in this case.

llvm-svn: 210267
2014-06-05 14:38:53 +00:00
Evgeniy Stepanov 57eba53a01 [asan] asan_device_setup: extend search path
In standalone build asan-rt is stored in yet another path.

llvm-svn: 210259
2014-06-05 12:49:35 +00:00
Evgeniy Stepanov 474e70aeb7 [asan] Add 'asan' to asan test deps.
This sound like a good idea in general.
Also, without this on Android we get add_lit_testsuite() with empty DEPENDS
list, and it does not work well.

llvm-svn: 210257
2014-06-05 12:31:22 +00:00
Evgeniy Stepanov 785108b0fc [asan] Fix lit tests setup on Android.
Pass cflags in a way that's compatible with standalone compiler-rt build.

llvm-svn: 210256
2014-06-05 12:29:47 +00:00
Evgeniy Stepanov 3641cd43b2 [asan] Use -pthread instead of -lpthread in tests.
llvm-svn: 210255
2014-06-05 12:22:37 +00:00
Dan Albert f4239c7707 Remove's uses of sys/timeb.h for Android.
Android is removing sys/timeb.h because it was removed in POSIX 2008.

llvm-svn: 210235
2014-06-05 02:00:24 +00:00
Alexey Samsonov 1c9a921a04 [Deadlock detector] Fix CMake build rules for shared runtime
llvm-svn: 210232
2014-06-05 00:58:28 +00:00
Greg Fitzgerald a1b620051f [asan] Add install rule for Android runtime
llvm-svn: 210216
2014-06-04 21:05:01 +00:00
Peter Collingbourne 8501e39a85 [dfsan] Fix the declaration of dfsan_add_label.
llvm-svn: 210202
2014-06-04 17:54:51 +00:00
Sergey Matveev dcd9bba602 [sanitizer] Make LSan/MSan/TSan honor the "color" flag.
Based on a patch by Stephan Bergmann.

llvm-svn: 210199
2014-06-04 16:57:03 +00:00
Evgeniy Stepanov fe18102649 [sancov] Handle fork.
Reset coverage data on fork().
For memory-mapped mode (coverage_direct=1) this helps avoid loss of data
(before this change two processes would write to the same file simultaneously).
For normal mode, this reduces coverage dump size, because PCs from the parent
process are no longer inherited by the child.

llvm-svn: 210180
2014-06-04 12:13:54 +00:00
Greg Fitzgerald 547f536bcf Disable unstable test on ARM
llvm-svn: 210140
2014-06-04 00:06:41 +00:00
Evgeniy Stepanov ce98452516 [sancov] Delay opening dump file until the first module constructor.
llvm-svn: 210109
2014-06-03 15:27:15 +00:00
Evgeniy Stepanov 937afa1fbb [sancov] Handle spaces in module name.
llvm-svn: 210108
2014-06-03 15:25:43 +00:00
Kostya Serebryany 7d4fc2c6a7 [asan] enable detect_odr_violation=2; https://code.google.com/p/address-sanitizer/wiki/OneDefinitionRuleViolation . This feature has been working quite well so far, found a few bugs and zero false positives. The main problem is that there could be lots of true positives and users will have to disable this checking until the bugs are fixed.
llvm-svn: 210106
2014-06-03 15:06:13 +00:00
Evgeniy Stepanov bb2fc7e4bb [sancov] Fix map update logic on Android.
dlopen()/dlclose() are not interceptable on Android,
so we update .sancov.map in module constructor callbacks.

llvm-svn: 210098
2014-06-03 12:15:43 +00:00
Greg Fitzgerald 796fba4cd9 Fix Android build after r210053
llvm-svn: 210069
2014-06-03 04:29:46 +00:00
Greg Fitzgerald 0f7f731966 Cleanup Android build and provide better diagnostics
No longer need to set ANDROID if COMPILER_RT_TEST_TARGET_TRIPLE is
arm-linux-androideabi.

No need to set ANDROID_COMMON_FLAGS.  These flags are already in
CMAKE_CXX_FLAGS which are used in try_compile().

llvm-svn: 210053
2014-06-02 23:11:24 +00:00
Timur Iskhodzhanov b1415c46fb [ASan Win] Manually call __asan_init early in the DLL initialization process to avoid a null function call in cout/cerr constructors
llvm-svn: 210030
2014-06-02 14:40:07 +00:00
Timur Iskhodzhanov cbee13e04c [Sanitizer/interception Win] Break into the debugger on unknown instructions
llvm-svn: 210028
2014-06-02 13:40:41 +00:00
Timur Iskhodzhanov 51fadc387a [ASan Win] Fix memset interception in DLLs
llvm-svn: 210027
2014-06-02 13:23:42 +00:00
Evgeniy Stepanov 96f8edc720 [asan] Default to memory-mapped coverage on Android.
The alternative (writing coverage at process exit) is nearly useless there.

llvm-svn: 210024
2014-06-02 13:06:33 +00:00
Evgeniy Stepanov d425a2b169 [msan] Handle x86 vector pack intrinsics.
llvm-svn: 210020
2014-06-02 12:31:44 +00:00
Kostya Serebryany 5181dd3a56 [asan] Improve vDSO check in AsanCheckDynamicRTPrereqs; patch by Yuri Gribov
llvm-svn: 210012
2014-06-02 10:39:40 +00:00
Evgeniy Stepanov 2fcc427741 [sancov] Remove debug leftovers and update usage text.
llvm-svn: 210009
2014-06-02 09:04:45 +00:00
Saleem Abdulrasool 2fd910dc72 compiler-rt: prefer .rodata for non MachO targets
Place constants into .rdata if targeting ELF or COFF/PE.  This should be
functionally identical, however, the data would be placed into a different
section.  This is purely a cleanup change.

llvm-svn: 209986
2014-06-01 04:07:07 +00:00
Saleem Abdulrasool 57aa97f53a compiler-rt: whitespace and uniformity for arm
Make the whitespace a bit more uniform in the various assembly routines.  This
also makes the assembly files a bit more uniform on the ARM side by explicitly
stating that it is using the unified syntax and that the contents of the code is
in the text section (or segment).  No functional change.

llvm-svn: 209985
2014-06-01 04:07:03 +00:00
Alexey Samsonov 5c8ce21a6c [TSan] Add a test case for r209939
llvm-svn: 209940
2014-05-31 00:12:20 +00:00
Greg Fitzgerald 52f61086ab Disable stack-overflow test on ARM
llvm-svn: 209925
2014-05-30 22:44:35 +00:00
Dmitry Vyukov dee68ba6e3 tsan: add a test from data-race-test suite:
https://code.google.com/p/data-race-test/source/browse/trunk/unittest/racecheck_unittest.cc

llvm-svn: 209900
2014-05-30 14:27:31 +00:00
Dmitry Vyukov 233f401c2b tsan: make positive tests more robust
Add a script that is used to deflake inherently flaky tsan tests.
It is invoked from lit tests as:
%deflake %run %t
The script runs the target program up to 10 times,
until it produces a tsan warning.

llvm-svn: 209898
2014-05-30 14:08:51 +00:00
Dmitry Vyukov afdcc96d9f tsan: optimize memory access functions
The optimization is two-fold:
First, the algorithm now uses SSE instructions to
handle all 4 shadow slots at once. This makes processing
faster.
Second, if shadow contains the same access, we do not
store the event into trace. This increases effective
trace size, that is, tsan can remember up to 10x more
previous memory accesses.

Perofrmance impact:
Before:
[       OK ] DISABLED_BENCH.Mop8Read (2461 ms)
[       OK ] DISABLED_BENCH.Mop8Write (1836 ms)
After:
[       OK ] DISABLED_BENCH.Mop8Read (1204 ms)
[       OK ] DISABLED_BENCH.Mop8Write (976 ms)
But this measures only fast-path.
On large real applications the speedup is ~20%.

Trace size impact:
On app1:
Memory accesses                   :       1163265870
  Including same                  :        791312905 (68%)
on app2:
Memory accesses                   :        166875345
  Including same                  :        150449689 (90%)
90% of filtered events means that trace size is effectively 10x larger.

llvm-svn: 209897
2014-05-30 13:36:29 +00:00
Timur Iskhodzhanov 1b42b81549 [Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable
Reviewed at http://reviews.llvm.org/D3952

llvm-svn: 209889
2014-05-30 12:42:57 +00:00
Timur Iskhodzhanov 8f655fc0fb [ASan Win] Fix a couple of warnings in tests and enable -WX
llvm-svn: 209887
2014-05-30 11:58:32 +00:00
Joerg Sonnenberger 9ed1beb20a Implement __divtf3 for IEEE quad precision.
Patch by: GuanHong Liu
Differential Revision: http://reviews.llvm.org/D2800

llvm-svn: 209886
2014-05-30 11:08:18 +00:00
Evgeniy Stepanov 3a0486b1e9 [sanitizer] Fix build on ARM.
llvm-svn: 209884
2014-05-30 10:50:17 +00:00