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
Kostya Serebryany
a1a6391d19
[asan] Fix for size_t in Asan's new and delete operators on x64 FreeBSD in 32-bit mode, only for FreeBSD <= 9.2; patch by Viktor Kutuzov
...
llvm-svn: 202124
2014-02-25 08:45:59 +00:00
Kostya Serebryany
8f240ec03f
[tsan] add deadlock detector tests for pthread_spin_lock
...
llvm-svn: 202123
2014-02-25 08:42:34 +00:00
Alexey Samsonov
97c22f79e1
Enable UBSan on FreeBSD. Patch by Viktor Kutuzov.
...
llvm-svn: 202122
2014-02-25 08:29:36 +00:00
Kostya Serebryany
11f4f30fa7
[sanitizer] add support for try_lock in deadlock detector
...
llvm-svn: 202120
2014-02-25 08:24:15 +00:00
Kostya Serebryany
6d54611fd4
[sanitizer] fix epoch handling in deadlock detector (before the fix, we could have had edges from locks in the previous epoch to locks in the current epoch)
...
llvm-svn: 202118
2014-02-25 07:34:41 +00:00
Evgeniy Stepanov
4bf7a268e0
[asan] Add a test for interceptors in shared libraries.
...
llvm-svn: 202037
2014-02-24 14:31:28 +00:00
Kostya Serebryany
cc92c79531
[asan] simplify the code that compute the shadow offset; get rid of two internal flags that allowed to override it. The tests pass, but still this change might break asan on some platform not covered by tests. If you see this, please submit a fix with a test.
...
llvm-svn: 202033
2014-02-24 13:40:24 +00:00
Kostya Serebryany
d77dfcb384
[tsan] one more test for deadlock detector
...
llvm-svn: 202026
2014-02-24 11:45:47 +00:00
Evgeniy Stepanov
c0ae3dfc3a
[asan] A test was reverted, but not "svn rm"-ed in r202016.
...
llvm-svn: 202025
2014-02-24 11:43:47 +00:00
Alexey Samsonov
a2fee5d907
[CMake] Better support for COMPILER_RT_ENABLE_WERROR. Make sure compiler-rt libraries are build by 'make all' command
...
llvm-svn: 202023
2014-02-24 11:32:49 +00:00
Dmitry Vyukov
a661a13c0f
tsan: fix SIGRTMAX handling
...
llvm-svn: 202022
2014-02-24 11:28:59 +00:00
Alexey Samsonov
2f27f0b0ee
[CMake] Introduce COMPILER_RT_ENABLE_WERROR option
...
llvm-svn: 202021
2014-02-24 11:22:39 +00:00
Evgeniy Stepanov
4c32d16c76
Revert r202014.
...
Failing on the bots for an unknown reason.
llvm-svn: 202016
2014-02-24 10:21:44 +00:00
Evgeniy Stepanov
567e0eef4c
[asan] Add a test for interceptors in shared libraries.
...
llvm-svn: 202014
2014-02-24 10:04:42 +00:00
Evgeniy Stepanov
d512234d7e
[asan] Avoid hardcoding library path in test binary.
...
llvm-svn: 202013
2014-02-24 10:03:33 +00:00
Kostya Serebryany
cf5d8e4f29
AdjustStackSizeLinux() is used in Lsan, Tsan and Msan non-Linux-specific code so it seems it should have more generic name and moved to a common scope.
...
Renamed to AdjustStackSize.
Patch by Viktor Kutuzov.
llvm-svn: 202011
2014-02-24 08:53:26 +00:00
Kostya Serebryany
04f2bf0f07
[sanitizer] Interception macros for sanitizers on FreeBSD; patch by Viktor Kutuzov
...
llvm-svn: 202009
2014-02-24 08:37:41 +00:00
Dmitry Vyukov
249cd9af9c
tsan: fix compiler warning
...
error: address of array 'tctx->name' will always evaluate to 'true'
llvm-svn: 202008
2014-02-24 08:19:53 +00:00
Reid Kleckner
324eee45a7
Revert "Replace __FUNCTION__ with __func__, the latter being standard C99/C++11."
...
This reverts commit r201910.
While __func__ may be standard in C++11, it was only recently added to
MSVC in 2013 CTP, and LLVM supports MSVC 2012. __FUNCTION__ may not be
standard, but it's *very* portable.
llvm-svn: 201916
2014-02-22 00:37:45 +00:00
Joerg Sonnenberger
b15779f307
Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.
...
llvm-svn: 201910
2014-02-21 23:55:15 +00:00
Joerg Sonnenberger
938b0df72d
Introduce CRT_HAS_128BIT, currently for all __LP64__ platforms.
...
Use it to enable the various functions for TI mode.
llvm-svn: 201909
2014-02-21 23:53:03 +00:00
Joerg Sonnenberger
e245715fca
Add Matt Thomas and myself.
...
llvm-svn: 201908
2014-02-21 23:51:38 +00:00
Kostya Serebryany
0548c79859
[tsan] add coarse-grained lock around the DeadlockDetector. We can do better than that, but that's a start.
...
llvm-svn: 201861
2014-02-21 15:07:18 +00:00
Tim Northover
23a2fb59b6
Darwin: use the compiler-provided linker
...
When actually compiling we use clang for the final .dylib creation stage, so we
should ask it what linker it'll use when detecting support for our
architectures.
llvm-svn: 201845
2014-02-21 10:19:22 +00:00
Bob Wilson
96e99556ad
Add an environment variable to override the default profile output file.
...
Also rename the default output file from "pgo-data" to "default.profdata".
The ".profdata" suffix is consistent with the name of the new llvm-profdata
tool.
llvm-svn: 201808
2014-02-20 19:52:32 +00:00
Alexey Samsonov
b106f2c0ac
[FreeBSD] Enable building a few runtime libraries on FreeBSD.
...
Patch by Viktor Kutuzov!
llvm-svn: 201783
2014-02-20 13:14:05 +00:00
Alexey Samsonov
04e7ad29ea
[CMake] Introduce check-all command for standalone compiler-rt build
...
llvm-svn: 201780
2014-02-20 12:36:26 +00:00
Alexey Samsonov
35a66d15d4
Move config for sanitizer_common tests under test/ for consistency
...
llvm-svn: 201779
2014-02-20 12:18:08 +00:00
Alexey Samsonov
11705b2f10
[CMake] break dependency between unit tests and runtimes in standalone build
...
llvm-svn: 201778
2014-02-20 12:03:56 +00:00
Evgeniy Stepanov
e0e980c748
[msan] Remove stubs for non-instrumented code from msan interface header.
...
llvm-svn: 201777
2014-02-20 11:43:00 +00:00
Alexey Samsonov
5e6d83258e
[CMake] lit tests shouldn't depend on runtimes in standalone build
...
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Evgeniy Stepanov
0f56a71859
[asan] Changes to asm instrumentation must be done through the generator script.
...
llvm-svn: 201766
2014-02-20 07:56:58 +00:00
Evgeniy Stepanov
8126e76a8a
[asan] Do all calls to __asan_report_* through PLT.
...
This matters when runtime is built as a shared library. Even though calling
code is itself part of the same library, these symbols are public and can
(theoretically) be interposed.
It might be better to declare hidden aliases for asan_report_* and call them
directly, but
(a) they are (noreturn), so performance does not matter, and
(b) it may be potentially less portable.
llvm-svn: 201764
2014-02-20 07:54:29 +00:00
Alexey Samsonov
31043152d3
Add rudimentary support for running compiler-rt lit tests with GCC
...
llvm-svn: 201680
2014-02-19 15:13:14 +00:00
Kostya Serebryany
699b975014
[tsan] improve the test that checks for lock inversion with 3 locks
...
llvm-svn: 201676
2014-02-19 14:24:31 +00:00
Kostya Serebryany
b51f8d4990
[tsan] when printing a mutex, also print its address. Properly print the deadlock report.
...
llvm-svn: 201675
2014-02-19 14:17:25 +00:00
Alexey Samsonov
8067448dfe
[CMake] Use host compiler to run lit tests in standalone mode
...
llvm-svn: 201674
2014-02-19 13:45:49 +00:00
Evgeniy Stepanov
cba008e9c5
[asan] A different way of detectinb stack overflow.
...
Instead of checking stack limits that are not well defined for the main thread,
we rely on siginfo::si_code and distance from SP.
llvm-svn: 201673
2014-02-19 13:40:41 +00:00
Alexey Samsonov
150d62aa2a
[CMake] Use host compiler to build unittests in standalone mode
...
llvm-svn: 201672
2014-02-19 13:01:03 +00:00
Evgeniy Stepanov
cc8e58bc46
[asan] Ensure that stack is limited before attempting to overflow it.
...
Very bad things happen otherwise.
llvm-svn: 201670
2014-02-19 12:43:27 +00:00
Alexey Samsonov
cd8535a96d
[CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
...
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Evgeniy Stepanov
2274ba7716
[asan] Improve stack overflow detection.
...
There are more cases when those manifest as an access below SP.
llvm-svn: 201664
2014-02-19 11:02:46 +00:00
Alexey Samsonov
aa980c760b
[CMake] Add the way to run tests in standalone build.
...
1) Depend on llvm-config (configured in LLVM_CONFIG_PATH) to
get necessary LLVM source/binary directories.
2) Add basic support for running lit tests (check-xsan commands).
For now this "support" is far from what we want:
* unit tests are not built currently.
* lit tests use Clang/compiler-rt from LLVM build directory,
not the host compiler or just-built compiler-rt libraries.
We should make a choice on the way we intend ti run compiler-rt lit testsuite:
a) use either Clang from LLVM build tree, or the host compiler.
b) use either just-built runtimes, or the runtimes shipped with the
host compiler.
Using just-built runtimes is tricky - we have to know where to put them, so that
Clang/GCC driver would pick them up (and not overwrite the existing runtimes).
Using a host compiler instead of Clang from LLVM build tree will give us a chance to
run lit tests under GCC (which already has support for several sanitizers).
That is, I tend to make the following choice: if we're in a standalone compiler-rt
build, use host compiler with its set of runtime libraries to run lit tests.
This will effectively decouple "make compiler-rt" and "make check-compiler-rt" in
a standalone build - the latter wouldn't invoke the former. Note that if we decide
to fix LLVM/Clang/compiler-rt build system so that it would configure/build
compiler-rt with just-built Clang (as we do in Makefile-based build), this will not
be a problem - we can add a dependency to ensure that clang/compiler-rt are rebuilt
before running compiler-rt tests.
llvm-svn: 201656
2014-02-19 10:04:29 +00:00
Evgeniy Stepanov
caaaac8c30
[asan] Disable asm instrumentation and tests on Mac.
...
Move asm tests to their own file.
llvm-svn: 201653
2014-02-19 09:14:39 +00:00
Evgeniy Stepanov
182319f7ba
[asan] Fix build on ARM.
...
llvm-svn: 201652
2014-02-19 09:01:14 +00:00
Evgeniy Stepanov
2169c6bba4
[asan] Added assembly functions for x86/amd64 asan.
...
These are runtime support functions for inline assembly instrumentation.
This is a re-submit of r201402.
Patch by Yuri Gorshenin.
llvm-svn: 201650
2014-02-19 08:30:39 +00:00
Alexey Samsonov
de4ef2a066
[CMake] Rudimentary support for standalone CompilerRT build system.
...
This change allows to build compiler-rt libraries separately from
LLVM/Clang (path to LLVM build directory should be specified at
configure time). Running tests is not yet supported.
llvm-svn: 201647
2014-02-19 07:49:16 +00:00
Timur Iskhodzhanov
cb9dc67a5e
[ASan/Win] Add a couple more DLL thunks
...
llvm-svn: 201580
2014-02-18 15:31:29 +00:00
Kostya Serebryany
37ce26cb16
[sanitizer] when reporting a deadlock also report the lock cycle
...
llvm-svn: 201576
2014-02-18 14:56:19 +00:00
Alexey Samsonov
1181a104e6
[CMake] Rename several variables
...
llvm-svn: 201575
2014-02-18 14:28:53 +00:00
Kostya Serebryany
bd86a29a2a
[sanitizer] make sure the deadlock detector survives the change of epochs; add a test and a comment
...
llvm-svn: 201572
2014-02-18 13:41:49 +00:00
Evgeniy Stepanov
b036778bdb
[asan] Relax stack-overflow test.
...
llvm-svn: 201571
2014-02-18 13:11:40 +00:00
Kostya Serebryany
aa416c39cd
[tsan] in deadlock detector do not register locks on their creation and unregister them on destruction; added a relevant test
...
llvm-svn: 201568
2014-02-18 12:50:31 +00:00
Evgeniy Stepanov
a50abe6656
[asan] Disable stack-overflow test on main thread.
...
Failing on some bots.
llvm-svn: 201567
2014-02-18 12:29:39 +00:00
Alexey Samsonov
1dbe6e071f
[CMake] Don't build ASan for iossim if -mmacosx-version-min is specified
...
llvm-svn: 201566
2014-02-18 12:01:24 +00:00
Evgeniy Stepanov
65b959afad
[asan] Stack overflow detection.
...
Report segmentation faults near or below stack bottom as stack-overflow
(not stack-buffer-overflow!).
llvm-svn: 201565
2014-02-18 11:49:52 +00:00
Evgeniy Stepanov
1b16a9d3b0
[asan] Fix one test on OSX.
...
llvm-svn: 201564
2014-02-18 11:32:24 +00:00
Evgeniy Stepanov
50bef914a6
[asan] Override default sigaltstack setting on Android.
...
Android libc always sets altstack on non-main threads, but it is too small for
our unwinder. With use_sigaltstack=1, override this setting with a larger one.
llvm-svn: 201557
2014-02-18 11:14:30 +00:00
Alexey Samsonov
63a4af7346
[CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.
...
llvm-svn: 201556
2014-02-18 09:33:45 +00:00
Kostya Serebryany
67bf8bd124
[tsan] one more lit test for deadlock detector; more to come
...
llvm-svn: 201554
2014-02-18 09:08:03 +00:00
Alexey Samsonov
2769570556
Simplify lit test configs for LSan and UBSan by using a generic config
...
llvm-svn: 201553
2014-02-18 08:56:49 +00:00
Alexey Samsonov
eb6ef12203
Drop test/asan/GenericConfig directory
...
llvm-svn: 201552
2014-02-18 08:24:28 +00:00
Alexey Samsonov
878a9a5de2
[CMake] Check for -fPIE and -ffreestanding flags for consistency
...
llvm-svn: 201549
2014-02-18 08:07:09 +00:00
Evgeniy Stepanov
77d9ae6c0f
[asan] Replace rand_r with rand in test.
...
llvm-svn: 201548
2014-02-18 08:03:44 +00:00
Alexey Samsonov
b73db72a17
[CMake] Simplify setting compile flag disabling RTTI
...
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Evgeniy Stepanov
2eea2850a4
[asan] Make __cxa_demangle non-weak symbol on Android.
...
This fixes global-demangle.cc test on Android.
https://code.google.com/p/address-sanitizer/issues/detail?id=264
llvm-svn: 201545
2014-02-18 07:34:52 +00:00
Alexey Samsonov
4dcbe7e959
Remove debug print
...
llvm-svn: 201544
2014-02-18 07:30:37 +00:00
Alexey Samsonov
9a1ffce25a
[CMake] Simplify code for detecting/setting compiler flags
...
llvm-svn: 201543
2014-02-18 07:26:58 +00:00
Kostya Serebryany
6774f2241d
[sanitizer] add tests for DeadlockDetector, minor fix in onLock
...
llvm-svn: 201514
2014-02-17 14:57:49 +00:00
Alexey Samsonov
1c9b9bcb5c
Simplify defining Clang compile flags in lit configs
...
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Evgeniy Stepanov
9e629abf1e
[asan] Add a test for stack unwinding in new and delete.
...
llvm-svn: 201511
2014-02-17 11:52:29 +00:00
Evgeniy Stepanov
fba430d299
Update license.txt to point to the new code in third_party/android.
...
Also remove a reference to mach_override code that is long gone.
llvm-svn: 201510
2014-02-17 11:41:22 +00:00
Kostya Serebryany
73325589dc
[sanitizer] implement node removal in Deadlock graph
...
llvm-svn: 201509
2014-02-17 11:21:52 +00:00
Alexey Samsonov
599290e1ca
[compiler-rt] Fix CompilerTargetTriple for non-English locales.
...
When the locale of a shell is set other than English locales or the C locale,
The word 'Target' may be translated. Thus, with e.g. ja_JP locale, compiler-rt
couldn't be built properly. Forcing LANG=C fixes the problem.
Patch by Ogino Masanori.
llvm-svn: 201506
2014-02-17 09:14:01 +00:00
Kostya Serebryany
ec68429c5d
[sanitizer] simplify DeadlockDetectorTLS
...
llvm-svn: 201505
2014-02-17 08:47:48 +00:00
Kostya Serebryany
46177baddb
[sanitizer] add one more test for deadlock detection stuff
...
llvm-svn: 201503
2014-02-17 07:39:44 +00:00
Alexey Samsonov
f1b7d05558
LSan: Print warning about dynamic linker only in verbose mode
...
llvm-svn: 201421
2014-02-14 15:12:46 +00:00
Evgeniy Stepanov
6c34935292
[asan] Replace posix_memalign with memalign in test.
...
Android does not provide posix_memalign.
llvm-svn: 201420
2014-02-14 15:02:36 +00:00
Alexey Samsonov
9a70077b47
[ASan] Rename asan_runtime_libraries to asan. Re-enable tests on Android.
...
llvm-svn: 201417
2014-02-14 14:45:13 +00:00
Evgeniy Stepanov
cbb2d5eee4
[asan] Disabled one more test on Android.
...
llvm-svn: 201416
2014-02-14 14:37:13 +00:00
Evgeniy Stepanov
44f5d8a49f
[asan] Change stack uar test to not use ulimit.
...
Because of how Android test runner is implemented, ulimit in RUN: line
gets executed on the host machine and does not affect the test.
llvm-svn: 201415
2014-02-14 14:36:42 +00:00
Alexey Samsonov
e6a6183e9b
Move TSan lit-tests under test/tsan
...
llvm-svn: 201414
2014-02-14 14:35:48 +00:00
Alexey Samsonov
9f20d67034
Move ASan lit-tests under test/asan
...
llvm-svn: 201413
2014-02-14 14:06:10 +00:00
Alexey Samsonov
8434e60f7e
Move MSan lit-tests under test/msan
...
llvm-svn: 201412
2014-02-14 13:02:58 +00:00
Evgeniy Stepanov
0de2b9b1e2
[asan] Revert r201402, r201404.
...
Test fails in bootstrap build.
llvm-svn: 201411
2014-02-14 12:37:41 +00:00
Evgeniy Stepanov
a21280307f
[sanitizer] Fix getpwuid_r (and similar) interceptors missing one of the arguments.
...
llvm-svn: 201410
2014-02-14 12:32:15 +00:00
Alexey Samsonov
7eeef85bd4
Move LSan test suite under test/
...
llvm-svn: 201408
2014-02-14 12:26:05 +00:00
Kostya Serebryany
a63632a5c6
[tsan] rudimentary support for deadlock detector in tsan (nothing really works yet except for a single tiny test). Also rename tsan's DeadlockDetector to InternalDeadlockDetector
...
llvm-svn: 201407
2014-02-14 12:20:42 +00:00
Alexey Samsonov
127e93e4dc
Delete LSan unit tests
...
llvm-svn: 201406
2014-02-14 12:13:59 +00:00
Kostya Serebryany
e233d8618d
[sanitizer] add iterators to bit vectors; make bit vector operations use little stack; add common flag 'detect_deadlocks'
...
llvm-svn: 201405
2014-02-14 12:08:23 +00:00
Evgeniy Stepanov
d2821f5af0
[asan] Disable assembly on windows.
...
llvm-svn: 201404
2014-02-14 12:07:22 +00:00
Alexey Samsonov
f6cf6ab53b
Move DFSan test suite under test/
...
llvm-svn: 201403
2014-02-14 12:05:41 +00:00
Evgeniy Stepanov
f335bd9c69
[asan] Added assembly functions for x86/amd64 asan.
...
These are runtime support functions for inline assembly instrumentation.
Patch by Yuri Gorshenin.
llvm-svn: 201402
2014-02-14 11:55:53 +00:00
Alexey Samsonov
ba869e79a0
Move UBSan test suite under test/
...
llvm-svn: 201401
2014-02-14 11:42:22 +00:00
Evgeniy Stepanov
05938a23f5
[sanitizer] Use mmap to zero-fill large shadow regions.
...
This is covered by existing ASan test.
This does not change anything for TSan by default (but provides a flag to
change the threshold size).
Based on a patch by florent.bruneau here:
https://code.google.com/p/address-sanitizer/issues/detail?id=256
llvm-svn: 201400
2014-02-14 11:41:26 +00:00
Alexey Samsonov
81a2b466e9
Move shared configs for lit test suites to test/ and unittests/ directories
...
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Evgeniy Stepanov
fb74ea80dc
[msan] Replicate mmap-below-shadow check in mmap64 interceptor.
...
llvm-svn: 201397
2014-02-14 09:49:29 +00:00
Alexey Samsonov
8c1441f860
Move tests for BlocksRuntime and builtins to corresponding directories under test/
...
llvm-svn: 201396
2014-02-14 09:47:31 +00:00
Evgeniy Stepanov
aa9d74cc5d
[asan] Android test runner for ASan lit tests.
...
This change replaces 32- and 64- bit config.in-s with a single config template
that is used to generate both 32 and 64 bits configs as well as the new
arm-android config. Arm-android config is special because it can run tests on
a remote device over adb (android debug bridge).
We replace %clang with a script that run the compiler, upload the result to
the device, and replaces it with another script. The second script runs the
binary on the device and delivers stdout/stderr/exitcode back.
llvm-svn: 201394
2014-02-14 09:22:10 +00:00
Alexey Samsonov
a6b264b51d
Move original compiler-rt functions (libgcc replacement) to lib/builtins directory
...
llvm-svn: 201393
2014-02-14 09:20:33 +00:00
Alexander Potapenko
0b28ea9c47
[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods
...
(needed for SEGV handling in sanitizer_common)
llvm-svn: 201392
2014-02-14 08:59:42 +00:00
Alexey Samsonov
b8665226ec
Move BlocksRuntime to lib/ directory
...
llvm-svn: 201390
2014-02-14 08:38:30 +00:00
Kostya Serebryany
efe2f7e2c8
[sanitizer] replace MostSignificantSetBitIndex with LeastSignificantSetBitIndex in bit vector (to iterate bits in increasing order)
...
llvm-svn: 201339
2014-02-13 15:59:00 +00:00
Kostya Serebryany
67d419736a
[sanitizer] optimize TwoLevelBitVector::intersectsWith, extend tests, fix a check
...
llvm-svn: 201338
2014-02-13 15:45:20 +00:00
Evgeniy Stepanov
5cb24b8ca9
[asan] Disable 1 test on Android.
...
llvm-svn: 201332
2014-02-13 14:37:25 +00:00
Evgeniy Stepanov
4e6096b859
[asan] Remove extra clone() arguments in test.
...
Android headers define clone() as a 4-argument function without ellipsis.
llvm-svn: 201331
2014-02-13 14:37:04 +00:00
Evgeniy Stepanov
f79669a323
[asan] Enable signal and sigaction interceptors on Android.
...
Fixes AddressSanitizer.SignalTest breakage.
llvm-svn: 201330
2014-02-13 14:33:24 +00:00
Evgeniy Stepanov
8978389a32
[asan] Enable SEGV handler on Android by default.
...
Seems stable enough.
Fixes null_deref.cc test.
llvm-svn: 201326
2014-02-13 13:43:47 +00:00
Evgeniy Stepanov
3bec7a9c77
[sanitizer] Fix off-by-one-line in SEGV reports on Android.
...
This will be covered by null_deref.cc test (requires one more fix to pass).
llvm-svn: 201325
2014-02-13 13:32:24 +00:00
Evgeniy Stepanov
391f0234eb
[asan] Fix null_deref test with zero base shadow.
...
With zero base shadow, shadow for near-zero access is itself at near-zero
location. As a result, this test crashes on the shadow access, and not on the
app access.
Relax a check to match this behavior.
llvm-svn: 201324
2014-02-13 13:04:39 +00:00
Kostya Serebryany
07526fb4a0
[sanitizer] address some of the dvyukov's comments on previous commits
...
llvm-svn: 201322
2014-02-13 12:39:21 +00:00
Evgeniy Stepanov
788527d9cd
Remove a check from strerror_r test.
...
It's not always true: on Android, strerror_r with invalid errno
prints "Unknown error ..." to the buffer and returns 0.
This test now only checks that strerror_r does not crash.
llvm-svn: 201321
2014-02-13 12:24:10 +00:00
Kostya Serebryany
f6cb35abb4
[sanitizer] findPath for deadlock detector
...
llvm-svn: 201306
2014-02-13 09:52:15 +00:00
Evgeniy Stepanov
14ca0627d5
[asan] Avoid deadlock in CovDump.
...
llvm-svn: 201304
2014-02-13 08:50:36 +00:00
Kostya Serebryany
c98ce28533
[sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan Roux
...
llvm-svn: 201303
2014-02-13 07:50:20 +00:00
Kostya Serebryany
5e52d48e3a
[sanitizer] more code for deadlock detector, nothing really works yet (except for small unit tests).
...
llvm-svn: 201302
2014-02-13 07:44:51 +00:00
Sergey Matveev
2a01b2f86f
[sanitizer] Intercept capget()/capset().
...
Also, fix incorrect syscall hooks for the corresponding syscalls.
llvm-svn: 201252
2014-02-12 19:29:49 +00:00
Evgeniy Stepanov
8ab205fb74
[asan] Handle OpenFile errors in CovDump.
...
llvm-svn: 201240
2014-02-12 15:29:22 +00:00
Evgeniy Stepanov
254c7636cf
[sanitizer] Fix wait4 interceptor on Android.
...
It's called __wait4 there.
llvm-svn: 201235
2014-02-12 13:05:17 +00:00
Kostya Serebryany
be1d22b631
[sanitizer] added class BVGraph, to be used in a deadlock detector; added more methods to the bit vectors
...
llvm-svn: 201226
2014-02-12 11:28:09 +00:00
Alexey Samsonov
ce9c449a4d
[TSan] Kill tsan_symbolize_addr2line_linux.cc
...
llvm-svn: 201219
2014-02-12 08:37:09 +00:00
Alexey Samsonov
7304b4201f
[Sanitizer] Teach external symbolizer to work with addr2line if llvm-symbolizer is unavailable. Allow this mode in TSan.
...
llvm-svn: 201218
2014-02-12 08:29:42 +00:00
Alexey Samsonov
c34a997669
[UBSan] Parse common runtime flags before using a symbolizer
...
llvm-svn: 201217
2014-02-12 08:21:44 +00:00
Alexey Samsonov
167c15a98f
[Sanitizer] Build sanitizer_common with -Wframe-larger-than=512 flag
...
llvm-svn: 201213
2014-02-12 07:26:40 +00:00
Alexey Samsonov
7e97768f2f
[Sanitizer] Reduce stack frame size of SlowUnwindStackWithContext
...
llvm-svn: 201212
2014-02-12 07:24:11 +00:00
Kostya Serebryany
083d657845
[sanitizer] added a bit vector class to be used in a deadlock detector
...
llvm-svn: 201210
2014-02-12 07:05:24 +00:00
Hans Wennborg
a97442f5fb
Require CMake 2.8.12.1 or later on Windows
...
That version knows to use the /FS flag, which is needed for building
lib/interception with VS2013.
llvm-svn: 201184
2014-02-11 21:46:19 +00:00
Evgeniy Stepanov
e5a447d947
[asan] Fix Windows build.
...
llvm-svn: 201154
2014-02-11 13:57:17 +00:00
Evgeniy Stepanov
2629e575db
[sanitizer] Fix build.
...
llvm-svn: 201152
2014-02-11 13:45:01 +00:00
Evgeniy Stepanov
769d46f373
[sanitizer] Use system unwinder in signal handlers on Android.
...
Because of the way Bionic sets up signal stack frames, libc unwinder is unable
to step through it, resulting in broken SEGV stack traces.
Luckily, libcorkscrew.so on Android implements an unwinder that can start with
a signal context, thus sidestepping the issue.
llvm-svn: 201151
2014-02-11 13:38:57 +00:00
Alexey Samsonov
ca183eed55
[Sanitizer] External symbolizer refactoring: split protocol for communicating with
...
llvm-symbolizer binary and external process handling into separate classes.
No functionality change.
llvm-svn: 201150
2014-02-11 13:03:09 +00:00
Alexey Samsonov
2f1209f851
Remove unused config.llvm_symbolizer_path
...
llvm-svn: 201147
2014-02-11 12:52:26 +00:00
Evgeniy Stepanov
6db97e82a4
Add a copy of missing <ucontext.h> for Android and enable ASan SEGV handler.
...
This change adds a copy of <ucontext.h> for Android found in google-breakpad
that is missing from the official NDK.
ASan SEGV handler is still disabled by default and can be enabled with
ASAN_OPTIONS=handle_segv.
llvm-svn: 201084
2014-02-10 13:34:43 +00:00
Evgeniy Stepanov
791a7e1603
[msan] Return EINVAL instead of crashing from mmap of an invalid address.
...
llvm-svn: 201074
2014-02-10 09:37:03 +00:00
Alexey Samsonov
adcf48fa35
[Sanitizer] Don't #include the same system header twice.
...
llvm-svn: 201071
2014-02-10 08:57:28 +00:00
Evgeniy Stepanov
d1e68a5ce1
[sanitizer] Disable 3 more syscall hooks on Android.
...
llvm-svn: 201070
2014-02-10 08:35:58 +00:00
Alexey Samsonov
dce6dd9d29
[TSan] Fix mismatched mangled names in operator delete interceptors
...
llvm-svn: 201069
2014-02-10 08:34:46 +00:00
Evgeniy Stepanov
c75ef739a1
[sanitizer] struct ustat and a bunch of other definitions are missing on Android.
...
llvm-svn: 201068
2014-02-10 08:00:24 +00:00
Nick Lewycky
af2064f7ab
Add throw() specifiers to more redeclarations of operator delete and operator delete[].
...
llvm-svn: 201016
2014-02-08 01:42:08 +00:00
Nick Lewycky
c0930b808b
Stick to C++98 for this.
...
llvm-svn: 201015
2014-02-08 01:36:21 +00:00
Nick Lewycky
fff46e01fd
Update these declarations of operator delete (and delete[]) to have noexcept,
...
as required per core issue 1552 and warned about with
-Wimplicit-exception-spec-mismatch.
llvm-svn: 201014
2014-02-08 01:29:07 +00:00
Dmitry Vyukov
b2b3e4bd77
tsan: improve the test
...
remove TSAN_OPTIONS from the test, so that it runs in the presubmit script
add a CHECK, so that it can run with FileCheck as well
llvm-svn: 200972
2014-02-07 11:48:06 +00:00
Dmitry Vyukov
c57987c7fb
tsan: run user OnInitialize callback later
...
when global and thread state are initialized,
this allows to do more things in the callback.
llvm-svn: 200966
2014-02-07 09:28:57 +00:00
Sergey Matveev
4a03fa4f60
[sanitizer] Intercept if_indextoname() and if_nametoindex().
...
llvm-svn: 200945
2014-02-06 20:39:33 +00:00
Sergey Matveev
f3a8acf38a
[sanitizer] Fix build.
...
llvm-svn: 200942
2014-02-06 19:36:10 +00:00
Sergey Matveev
544d07f861
[sanitizer] One does not simply intercept getifaddrs().
...
Upgrade the interceptor, and attempt to fix the Android build.
llvm-svn: 200936
2014-02-06 18:48:23 +00:00
Sergey Matveev
07802a090a
[sanitizer] Intercept getifaddrs().
...
llvm-svn: 200926
2014-02-06 17:42:36 +00:00
Sergey Matveev
0c62992d6e
[sanitizer] Intercept getresuid and getresgid.
...
llvm-svn: 200925
2014-02-06 15:12:56 +00:00
Alexander Potapenko
1a0aadcd77
[TSan] Add a regression test for https://code.google.com/p/thread-sanitizer/issues/detail?id=47
...
llvm-svn: 200923
2014-02-06 14:06:12 +00:00
Alexander Potapenko
a1193a50b0
[TSan] Don't flush all file streams on program shutdown to avoid deadlocks on file stream locks.
...
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=47 .
llvm-svn: 200922
2014-02-06 13:37:14 +00:00
Dmitry Vyukov
9ba840865f
tsan: simplify Go build script
...
we don't use assembly files
llvm-svn: 200916
2014-02-06 09:23:12 +00:00
Dmitry Vyukov
447bb46e03
tsan: remove unused functions
...
llvm-svn: 200915
2014-02-06 09:22:50 +00:00
Dmitry Vyukov
a5d1fcfde1
tsan: improve error message for Go
...
llvm-svn: 200914
2014-02-06 09:22:29 +00:00
Kostya Serebryany
1f5d17c57d
[asan] fix testing on Mac
...
llvm-svn: 200910
2014-02-06 07:19:52 +00:00
Kostya Serebryany
1ee681305f
[asan] introduce two functions that will allow implementations of C++ garbage colection to work with asan's fake stack
...
llvm-svn: 200908
2014-02-06 06:56:22 +00:00
Sergey Matveev
efefe5e225
[sanitizer] Fix build.
...
llvm-svn: 200873
2014-02-05 20:04:12 +00:00
Sergey Matveev
c5c84a1d86
[sanitizer] Implement ioctl decoding.
...
When an unknown ioctl is encountered, try to guess the parameter size from the
request id.
llvm-svn: 200872
2014-02-05 19:35:24 +00:00
Kostya Serebryany
9ebd483017
[sanitizer] hide two functions in the __sanitizer namespace to avoid exporting them (gold complained)
...
llvm-svn: 200844
2014-02-05 15:06:32 +00:00
Dmitry Vyukov
93474a9acd
tsan: fix windows alignment check
...
llvm-svn: 200838
2014-02-05 13:41:09 +00:00
Dmitry Vyukov
a54308fc6d
tsan: deflake flaky test
...
llvm-svn: 200833
2014-02-05 12:01:34 +00:00
Dmitry Vyukov
7799eb123b
tsan: ensure proper alignment of mmaps on windows
...
llvm-svn: 200832
2014-02-05 11:37:20 +00:00
Timur Iskhodzhanov
4a25d42a3c
[ASan/Win] Add DLL thunks for __asan_{,un}poison_memory_region
...
llvm-svn: 200809
2014-02-04 23:54:26 +00:00
Timur Iskhodzhanov
aeefb6abce
[ASan/Win] Fall back to stdout if we can't print the reports to stderr
...
llvm-svn: 200804
2014-02-04 23:28:30 +00:00
Dmitry Vyukov
d7fcee8d8c
tsan: add windows native build script
...
llvm-svn: 200780
2014-02-04 17:52:41 +00:00
Dmitry Vyukov
a61c2b0bd5
tsan: fix windows build
...
llvm-svn: 200779
2014-02-04 17:29:44 +00:00
Dmitry Vyukov
a538aac8ce
tsan: fix windows build
...
llvm-svn: 200778
2014-02-04 17:27:29 +00:00
Dmitry Vyukov
2da2cee706
tsan: update Go public interface
...
in preparation for https://codereview.appspot.com/55100044
llvm-svn: 200766
2014-02-04 14:45:54 +00:00
Alexey Samsonov
fafbcb6d4c
[CMake] Fixup for r200753
...
llvm-svn: 200761
2014-02-04 13:24:13 +00:00
Alexander Potapenko
4672bacaef
[ASan] Get rid of asan_mac.h, which contents have been moved to sanitizer_mac.h
...
llvm-svn: 200757
2014-02-04 11:35:59 +00:00
Alexander Potapenko
844a3cf77e
[ASan] Use replace_str=0 and replace_intrin=0 in printf-{2,4}.c to avoid triggering a buffer overflow in strlen and memcpy.
...
This change fixes printf-2.c and printf-4.c under OSX.
llvm-svn: 200756
2014-02-04 11:32:05 +00:00
Dmitry Vyukov
2e1634b69f
tsan: fix darwin Go build
...
llvm-svn: 200755
2014-02-04 11:29:09 +00:00
Justin Bogner
ad560c4c11
CMake: Enable -Werror for the -fno-function-sections check
...
If the -fno-function-sections flag isn't recognized, the compiler
emits a warning. This isn't enough to cause the check to fail, so we
enable -Werror as well.
llvm-svn: 200753
2014-02-04 10:40:46 +00:00
Alexander Potapenko
40fcff653c
[ASan] Fix printf-5.c on OSX: fix a compiler warning, avoid intercepting memcpy (which triggers the error report before printf does).
...
llvm-svn: 200751
2014-02-04 10:36:55 +00:00
Dmitry Vyukov
9244c48b29
tsan: update public Go interface
...
in preparation for https://codereview.appspot.com/55100044
llvm-svn: 200750
2014-02-04 10:35:23 +00:00
Alexander Potapenko
2e7dc60ee3
[ASan] Replace the call to "vname" with "WRAP(vname)" in FORMAT_INTERCEPTOR_IMPL
...
It's incorrect to call the function by its name in the interceptor, because that means WRAP(vname) on Linux and REAL(vname) on OSX.
This patch fixes asan/lit_tests/TestCases/printf-3.c on Mac.
llvm-svn: 200749
2014-02-04 09:35:09 +00:00
Kostya Serebryany
b965a2fa32
[lsan] simplify use_tls_dynamic.cc test
...
llvm-svn: 200748
2014-02-04 09:07:16 +00:00
Dmitry Vyukov
fd0affac37
tsan: add SANITIZER_INTERFACE_ATTRIBUTE to more callbacks
...
so that it's possible to override them from a dynamic library.
llvm-svn: 200747
2014-02-04 08:46:09 +00:00
Alexey Samsonov
d23c79604e
[CMake] Check that compiler supports -fno-function-sections flag
...
llvm-svn: 200746
2014-02-04 08:28:17 +00:00
Dmitry Vyukov
8aaa44c43d
tsan: relax check for errno spoiling more
...
We do not detect errno spoiling for SIGTERM,
because some SIGTERM handlers do spoil errno but reraise SIGTERM,
tsan reports false positive in such case.
It's difficult to properly detect this situation (reraise),
because in async signal processing case (when handler is called directly
from rtl_generic_sighandler) we have not yet received the reraised
signal; and it looks too fragile to intercept all ways to reraise a signal.
llvm-svn: 200742
2014-02-04 07:10:45 +00:00
Kostya Serebryany
f6e085cf89
[sanitizer] make __tls_get_addr interceptor (more) AS-safe. No good test so far, will keep trying.
...
llvm-svn: 200734
2014-02-04 05:22:00 +00:00
Kostya Serebryany
51f135d820
[sanitizer] Handle TLS sizes for glibc < 2.13; As discussed in http://gcc.gnu.org/PR60038 , the hardcoded sizeof(struct thread); patch by Jakub Jelinek
...
llvm-svn: 200733
2014-02-04 04:09:38 +00:00
Alexander Potapenko
f6ff6b0929
[libsanitizer] Workaround for https://code.google.com/p/address-sanitizer/issues/detail?id=261
...
If pthread_get_stacksize_np() returns 512K for the main thread on Mavericks, obtain the stack size from the current stack rlimit.
llvm-svn: 200703
2014-02-03 16:42:29 +00:00
Alexander Potapenko
8d58767b34
[libsanitizer] Follow-up for r200700: add the new header to CMakeLists.txt and make it empty on non-Mac.
...
llvm-svn: 200701
2014-02-03 15:45:03 +00:00
Alexander Potapenko
768e315a74
[ASan] Move GetMacosVersion() to sanitizer_common.
...
llvm-svn: 200700
2014-02-03 15:32:19 +00:00
Evgeniy Stepanov
1fc9e61356
[asan] asan_device_setup.sh: allow overriding adb path.
...
llvm-svn: 200698
2014-02-03 15:12:09 +00:00
Evgeniy Stepanov
756e1c1e4b
[asan] Reinitialize allocator quarantine on activation.
...
This is covered by AddressSanitizer.UAF_* tests in asan_test
with start_deactivated=1.
llvm-svn: 200696
2014-02-03 14:19:08 +00:00
Evgeniy Stepanov
bd2b3177da
[sanitizer] Resubmit r200683: disable -ffunction-sections.
...
llvm-svn: 200686
2014-02-03 11:16:41 +00:00
Evgeniy Stepanov
fe437f0a8f
Revert r200683.
...
-fno-function-sections is broken in Clang.
llvm-svn: 200684
2014-02-03 10:52:53 +00:00
Evgeniy Stepanov
aa0d7dee77
[sanitizer] Disable -ffunction-sections.
...
It breaks when a binary is linked with --gc-sections: parts of sanitizer
interface get thrown away and inaccessible from dlopen-ed libs.
llvm-svn: 200683
2014-02-03 10:15:08 +00:00
Evgeniy Stepanov
04e841c047
[msan] Fix a typo.
...
Spotted by Keno Fischer.
llvm-svn: 200682
2014-02-03 07:27:01 +00:00
Sergey Matveev
c18b36625e
[sanitizer] Partial revert of recent ioctl changes.
...
Some build environments are missing the required headers.
This reverts r200544, r200547, r200551. This does not revert the change that
introduced READWRITE ioctl type.
llvm-svn: 200567
2014-01-31 19:19:45 +00:00
Timur Iskhodzhanov
322ce39e39
Remove /FS as it's auto-added by CMake 2.8.12.1; also, remove /wd4221 as 4221 is a linker warning, not a compiler warning
...
llvm-svn: 200564
2014-01-31 18:25:37 +00:00
Alexander Potapenko
ea4a0dbb8d
[ASan] Implement __sanitizer::InstallDeadlySignalHandlers() and __asan::AsanOnSIGSEGV() on Windows.
...
llvm-svn: 200554
2014-01-31 15:11:11 +00:00
Alexander Potapenko
c6864e9039
[ASan] Add a failing test that demonstrates that ASan currently breaks dead code stripping on Linux.
...
See https://code.google.com/p/address-sanitizer/issues/detail?id=260 for more info.
llvm-svn: 200553
2014-01-31 14:58:54 +00:00
Renato Golin
b760aa6722
Sorting ARM Sources alphabetically
...
llvm-svn: 200552
2014-01-31 14:53:52 +00:00
Evgeniy Stepanov
a78dbe2e6f
[asan] Fix Android build.
...
llvm-svn: 200551
2014-01-31 14:46:37 +00:00
Evgeniy Stepanov
01cd8ae204
[asan] Read extra flags from a system property on activation on Android.
...
llvm-svn: 200550
2014-01-31 14:36:55 +00:00
Alexander Potapenko
36b18dfe64
[libsanitizer] Fix compilation for gotsan.
...
llvm-svn: 200549
2014-01-31 14:30:12 +00:00
Sergey Matveev
dffda4cfec
[sanitizer] Attempt to fix Android build.
...
llvm-svn: 200547
2014-01-31 14:28:32 +00:00
Renato Golin
66e2b70e59
Enable compilation of RT on ARM
...
Adding the ARM RT sources to the CMake files, and enabling some
sanitizers to also build on ARM. This is far from supported or
production quality, but enabling it to build will get us errors
that we can actually fix.
Having said that, the Compiler-RT and the Asan libraries are
know to work on some variations of ARM.
llvm-svn: 200546
2014-01-31 14:25:58 +00:00
Sergey Matveev
6b3397546e
[sanitizer] Support most ioctls from /usr/include/sound/.
...
llvm-svn: 200544
2014-01-31 14:02:21 +00:00
Alexander Potapenko
789e3e1b7c
[ASan] Move the SIGSEGV/SIGBUS handling to sanitizer_common
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
This particular CL moves InstallSignalHandlers() into sanitizer_common (making it InstallDeadlySignalHandlers()), but doesn't enable default signal handlers for any tool other than ASan.
llvm-svn: 200542
2014-01-31 13:10:07 +00:00
Alexey Samsonov
fd99206ee4
[ASan] Run LSan for ASan unit tests only on 64-bit Linux
...
llvm-svn: 200537
2014-01-31 11:44:32 +00:00
Alexander Potapenko
e925e53114
Fix compilation: don't convert NULL to a pointer-incompatible type.
...
llvm-svn: 200536
2014-01-31 11:44:15 +00:00
Alexander Potapenko
d5802fe548
Make signal-related functions use __sanitizer_* structures instead of __sanitizer_kernel_* ones.
...
Also rename internal_sigaction() into internal_sigaction_norestorer(), as this function doesn't fully
implement the sigaction() functionality on Linux.
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200535
2014-01-31 11:29:51 +00:00
Dmitry Vyukov
e63a09adb6
tsan: fix Go build
...
Go linker does not like function-static objects.
llvm-svn: 200534
2014-01-31 11:20:55 +00:00
Timur Iskhodzhanov
00aa75b774
Move /FS to SANITIZER_COMMON_CFLAGS
...
llvm-svn: 200485
2014-01-30 19:48:13 +00:00
Timur Iskhodzhanov
5b56093acc
Quick-fix a typo
...
llvm-svn: 200483
2014-01-30 19:19:47 +00:00
Timur Iskhodzhanov
45849098eb
Add an /FS flag to the lib/interception CMake to make it buildable with VS2013 too
...
llvm-svn: 200482
2014-01-30 19:19:29 +00:00
Timur Iskhodzhanov
272502656e
Add an /FS flag to the sanitizer_common CMake to make it buildable with VS2013
...
llvm-svn: 200480
2014-01-30 18:56:06 +00:00
Joerg Sonnenberger
dde2700cde
Copy&paste errors. Found by Thomas Klausner.
...
llvm-svn: 200477
2014-01-30 18:41:32 +00:00
Timur Iskhodzhanov
a1f31460d8
Add an /FS flag to the ASan RTL CMake to make it buildable with VS2013
...
llvm-svn: 200474
2014-01-30 18:08:41 +00:00
Evgeniy Stepanov
3f6af151df
[sanitizer] Fix typo that breaks shmctl() interceptor.
...
https://code.google.com/p/address-sanitizer/issues/detail?id=259
llvm-svn: 200468
2014-01-30 14:31:26 +00:00
Sergey Matveev
be68311660
[msan] Intercept *getxattr and *listxattr.
...
llvm-svn: 200464
2014-01-30 12:21:12 +00:00
Kostya Serebryany
b22298af9a
[asan] re-enable __tls_get_addr interceptor with a proper fix (use __attribute__((tls_model(initial-exec))))
...
llvm-svn: 200463
2014-01-30 09:25:48 +00:00
Kostya Serebryany
409d26ac5e
[asan] disable __tls_get_addr interceptor while I am investigating why it causes trouble; few more debugging
...
llvm-svn: 200462
2014-01-30 09:00:42 +00:00
Joerg Sonnenberger
ce0f2175d7
Support ARMv4 in the remaining non-VFP routines.
...
llvm-svn: 200397
2014-01-29 13:54:54 +00:00
Joerg Sonnenberger
deeb8dc593
Move JMP/JMPc definition into assembly.h's ARM block.
...
llvm-svn: 200396
2014-01-29 13:54:16 +00:00
Joerg Sonnenberger
d8f7fb94a7
Optimized implementation of __clzdi2 and __clzsi2 for ARM. Written in
...
collaboration with Matt Thomas.
Differential Revision: http://llvm-reviews.chandlerc.com/D2630
llvm-svn: 200394
2014-01-29 13:46:28 +00:00
Evgeniy Stepanov
aeefe8c1bb
Remove -arm-enable-ehabi from Android build rules. It's enabled by default.
...
llvm-svn: 200392
2014-01-29 12:36:45 +00:00
Kostya Serebryany
336d97146a
[asan] increase the buffer size for printing asan legend, add a test for legend
...
llvm-svn: 200387
2014-01-29 11:12:09 +00:00
Kostya Serebryany
cda06acd31
[asan] fix build on Mac (hopefully)
...
llvm-svn: 200386
2014-01-29 10:26:38 +00:00
Kostya Serebryany
71788fac2a
[asan] experimental intercetor for __tls_get_addr. So far it does nothing interesting, actual usage will come later. See https://groups.google.com/forum/#!topic/address-sanitizer/BfwYD8HMxTM for background
...
llvm-svn: 200384
2014-01-29 09:29:16 +00:00
Evgeniy Stepanov
422944fdbd
[asan] Fix asan_device_setup.sh failure on userdebug Android.
...
llvm-svn: 200382
2014-01-29 09:16:48 +00:00
Timur Iskhodzhanov
50672ac9cb
Add support for more instruction prefixes so we can intercept functions in the VS2013 RTL
...
llvm-svn: 200366
2014-01-29 02:00:58 +00:00
Alexander Potapenko
b0930f5c04
[ASan] Reinstate ASAN_LOW_MEMORY, which has nothing to do with signal handling and thus should not be moved to common.
...
llvm-svn: 200319
2014-01-28 14:17:16 +00:00
Alexander Potapenko
31e24962f4
[ASan] Remove an accidentally added include of signal.h
...
llvm-svn: 200318
2014-01-28 14:10:06 +00:00
Joerg Sonnenberger
05d8a22cf6
Cache invalidation for AARCH64. Disabled for Apple for now as requested
...
by Tim Northover. Written by Matt Thomas.
Differential Revision: http://llvm-reviews.chandlerc.com/D2631
llvm-svn: 200317
2014-01-28 14:02:22 +00:00
Sergey Matveev
1394f2da85
[msan] Rewrite strto* interceptors and add a few more.
...
Express the strto* interceptors though macros. This removes a lot of
duplicate code and fixes a couple of copypasto bugs (where "res" was declared of
a different type than the actual return type). Also, add a few more interceptors
for strto*_l.
llvm-svn: 200316
2014-01-28 13:45:58 +00:00
Alexander Potapenko
77f5c20a5b
[ASan] Fix compilation.
...
llvm-svn: 200312
2014-01-28 12:23:14 +00:00
Alexander Potapenko
d8d490ed50
[ASan] Move the sigaltstack() bits to sanitizer_common.
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
Note that this particular change doesn't enable use_sigaltstack support in every tool.
llvm-svn: 200310
2014-01-28 11:12:29 +00:00
Dmitry Vyukov
dc96a0fada
tsan: remove interceptor stats
...
They seems to be unused, but cause maintenance pain.
llvm-svn: 200308
2014-01-28 11:02:04 +00:00
Dmitry Vyukov
7c9621c0be
tsan: relax checking of errno spoiling in signal handlers
...
allow SIGABRT to spoil errno, because some real programs
reset SIGABRT handler in the handler, re-raise SIGABRT and return from the handler
llvm-svn: 200304
2014-01-28 09:49:48 +00:00
Alexander Potapenko
cf4bef3161
[ASan] Move the signal handling-related flags to sanitizer_common.
...
This change is a part of refactoring intended to have common signal handling behavior in all tools.
llvm-svn: 200295
2014-01-28 09:28:57 +00:00
Evgeniy Stepanov
0b09c623c1
[msan] Replace assert() with GTest ASSERT_* in msan_test.
...
llvm-svn: 200293
2014-01-28 08:51:39 +00:00
Joerg Sonnenberger
92ce6e83fc
Rename fabs to local_fabs to not conflict with the builtin.
...
llvm-svn: 200245
2014-01-27 20:09:03 +00:00
Kostya Serebryany
7fe86589f1
[sanitizer] revert r200197: the buggy kernel ( https://bugzilla.kernel.org/show_bug.cgi?id=67651 ) is almost unusable with asan even with this workaround (too slow), so this workaround makes no sense. The asan/msan bootstrap bot was changed to use a non-buggy kernel
...
llvm-svn: 200217
2014-01-27 13:05:09 +00:00
Evgeniy Stepanov
067f54718f
[msan] Disable mmap outside of application address range.
...
llvm-svn: 200200
2014-01-27 09:12:22 +00:00
Evgeniy Stepanov
aecead9d4f
[asan] Android setup: do "adb root" before "adb remount".
...
llvm-svn: 200199
2014-01-27 08:20:28 +00:00
Kostya Serebryany
0a5049b780
[sanitizer] increase the mmap granularity in sanitizer allocator from 2^16 to 2^18. This is a partial workaround for the fresh Kernel bug https://bugzilla.kernel.org/show_bug.cgi?id=67651
...
llvm-svn: 200197
2014-01-27 07:35:32 +00:00
Tim Northover
7449bda3d9
ARM: also remove useless .arm directive from other files
...
llvm-svn: 200044
2014-01-24 22:04:15 +00:00
Tim Northover
5386cae6b7
ARM: remove unnecessary .arm directive
...
It was redundant (since ARM mode is the default) and misleading since
(e.g.) Cortex-A15 would not satisfy the #ifdef but would be in ARM
mode regardless.
llvm-svn: 200043
2014-01-24 21:58:22 +00:00
Bob Wilson
1b39261990
Fix a typo "endi" -> "endif" in r200035.
...
llvm-svn: 200039
2014-01-24 21:04:05 +00:00
Joerg Sonnenberger
2fb149b901
Don't use .arm for ARMv7M, which will use the hwdiv path. Non-hwdiv
...
remains ARM mode only, supporting thumb requires explicit it prefixes
for the predicted adds/subs and adjusting the offset computation for the
different block sizes.
llvm-svn: 200035
2014-01-24 20:45:18 +00:00
Dmitry Vyukov
3ee32e7647
tsan: fix test for -O2
...
otherwise races are suppressed due to "same stack"
llvm-svn: 200015
2014-01-24 16:30:53 +00:00
Dmitry Vyukov
80240acd77
tsan: fix test for -O2
...
llvm-svn: 200012
2014-01-24 15:58:20 +00:00
Evgeniy Stepanov
9504304f2d
[asan] Add an ASan-on-Android installation script.
...
llvm-svn: 200009
2014-01-24 15:24:24 +00:00
Joerg Sonnenberger
db99eee490
Add end-of-function markers.
...
llvm-svn: 200007
2014-01-24 14:42:55 +00:00
Joerg Sonnenberger
2a10033ae7
Add end-of-function markers.
...
llvm-svn: 200006
2014-01-24 14:40:53 +00:00
Joerg Sonnenberger
171e9cfb0e
Mechanically add end-of-function markers.
...
llvm-svn: 200005
2014-01-24 14:33:42 +00:00
Dmitry Vyukov
1b3862ab06
tsan: fix signal handling
...
We left ignore_interceptors>0 when calling signal handlers
from blocking interceptors, this leads to missing synchronization in such signal handler.
llvm-svn: 200003
2014-01-24 14:16:00 +00:00
Dmitry Vyukov
041510b290
tsan: fix test relying on assert
...
llvm-svn: 200002
2014-01-24 14:14:28 +00:00
Joerg Sonnenberger
59611a8b20
Provide support for ARMv4, lacking bx and clz. Unroll the
...
test-and-subtract loop and compute the initial block as address,
shaving off between 5% and 10% on Cortex A9 and 30%+ a Raspberry Pi.
Code written by Matt Thomas and Joerg Sonnenberger.
Differential Revision: http://llvm-reviews.chandlerc.com/D2595
llvm-svn: 200001
2014-01-24 13:43:35 +00:00
Joerg Sonnenberger
1f8cb3ee67
Implement __ARM_ARCH if the compiler lacks it. Add feature tests for bx and clz.
...
llvm-svn: 199998
2014-01-24 13:39:51 +00:00
Tim Northover
5a8af3e136
Darwin: add x86_64h slice for Haswell.
...
llvm-svn: 199996
2014-01-24 13:10:55 +00:00
Dmitry Vyukov
16e7a758b0
tsan: do not deadlock on fork
...
Currently correct programs can deadlock after fork, because atomic operations and async-signal-safe calls are not async-signal-safe under tsan.
With this change:
- if a single-threaded program forks, the child continues running with verification enabled (the tsan background thread is recreated as well)
- if a multi-threaded program forks, then the child runs with verification disabled (memory accesses, atomic operations and interceptors are disabled); it's expected that it will exec soon anyway
- if the child tries to create more threads after multi-threaded fork, the program aborts with error message
- die_after_fork flag is added that allows to continue running, but all bets are off
http://llvm-reviews.chandlerc.com/D2614
llvm-svn: 199993
2014-01-24 12:33:35 +00:00
Kostya Serebryany
e402b431c0
[msan] add __libc_memalign interceptor; add a regression test for the existing bug with dtls support in msan
...
llvm-svn: 199980
2014-01-24 09:14:11 +00:00
Alexey Samsonov
c496eba75f
Don't create check-ubsan and check-dfsan commands if they are not supported on this platform
...
llvm-svn: 199979
2014-01-24 08:06:21 +00:00
Joerg Sonnenberger
25468a2ab4
Add end of function marker, which can be used on ELF to correctly set
...
the function size.
llvm-svn: 199914
2014-01-23 18:31:46 +00:00
Sergey Matveev
9b068a2c06
[lsan] Expand a comment to document our dynamic TLS hack.
...
llvm-svn: 199900
2014-01-23 15:10:35 +00:00
Alexey Samsonov
1d028b8a9f
[Sanitizer] Fix false positive in snprintf interceptor - take the number of actually written symbols from real snprintf call.
...
llvm-svn: 199899
2014-01-23 15:09:38 +00:00
Alexey Samsonov
902bb51612
[Sanitizer] Fix false positive in printf interceptors: properly handle precision for %s
...
llvm-svn: 199895
2014-01-23 14:35:28 +00:00
Evgeniy Stepanov
20513c0937
[asan] More buffering in report printing.
...
llvm-svn: 199888
2014-01-23 11:51:03 +00:00
Evgeniy Stepanov
350fe4b1af
[asan] Android logging.
...
This change duplicates all ASan output to system log on Android.
llvm-svn: 199887
2014-01-23 11:34:41 +00:00
Evgeniy Stepanov
6975704f62
[sanitizer] Replace inline with INLINE.
...
llvm-svn: 199883
2014-01-23 11:22:04 +00:00
Evgeniy Stepanov
04c5a836a2
[sanitizer] Add a sanity check.
...
llvm-svn: 199880
2014-01-23 11:01:07 +00:00
Evgeniy Stepanov
43d1888285
[sanitizer] Fix format string mismatches found by format attributes added in r199874.
...
llvm-svn: 199879
2014-01-23 10:57:08 +00:00
Evgeniy Stepanov
631bd92292
[asan] Print shadow memory and legend as a single printf call.
...
llvm-svn: 199878
2014-01-23 10:52:33 +00:00
Evgeniy Stepanov
4819d28e53
[asan] clang-format part of asan_report.cc
...
llvm-svn: 199877
2014-01-23 10:49:47 +00:00
Evgeniy Stepanov
29b7866c6c
[sanitizer] Add printf format attributes.
...
These were lost in a refactoring a long time ago.
llvm-svn: 199874
2014-01-23 08:58:34 +00:00
Evgeniy Stepanov
b1fa81047a
[msan] Fix GCC warnings.
...
warning: ISO C99 requires rest arguments to be used [enabled by default]
INTERCEPTOR(char *, dlerror) {
warning: invoking macro INTERCEPTOR argument 3: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]
llvm-svn: 199873
2014-01-23 08:43:12 +00:00
Evgeniy Stepanov
1a9f5720d8
[asan] Enable replacement new/delete on Android.
...
New/delete implementations in system libraries almost always are built without
frame pointers. As we switched to frame pointer based unwinder on ARM, they no
longer work for us, resulting in broken allocation/deallocation stacks.
Note that this does not work with statically linked
libstdc++/libc++/libstlport.
llvm-svn: 199872
2014-01-23 08:14:20 +00:00
Dmitry Vyukov
db1ad12ae2
asan: fix atomic operations on ARM
...
implement correct atomic load/store for ARM
add test for atomic load/store
http://llvm-reviews.chandlerc.com/D2582
llvm-svn: 199802
2014-01-22 14:13:37 +00:00
Alexey Samsonov
8c03475f01
[Sanitizer] try harder to fix Werror build break after r199729
...
llvm-svn: 199736
2014-01-21 13:06:38 +00:00
Alexey Samsonov
39dbd7cc2c
[Sanitizer] Update file names now that we intercept both scanf and printf
...
llvm-svn: 199735
2014-01-21 13:01:20 +00:00
Tim Northover
bea1cafde8
Macho-embedded: update build script for newer Clang behaviour.
...
Clang now uses the *-apple-macho triples for embedded targets using MachO. The
environment makes less pretences to be running an actual Mach kernel with all
the support that would imply, so a few changes are needed to the build scripts:
+ The Apple way of detecting endianness applies in all cases so drop the
__MACH__ test.
+ A quick rename since "darwin_embedded" no longer makes any sense. If there's
no Mach going on, there's certainly no Darwin.
+ Change how we test for support for a platform. The functions we build don't
need any SDK support (stdio.h, ...) so we don't need to check for it.
llvm-svn: 199731
2014-01-21 12:38:02 +00:00
Alexey Samsonov
20494ca293
Fix unused function warning from r199729
...
llvm-svn: 199730
2014-01-21 12:16:19 +00:00
Alexey Samsonov
00cd273c46
Sanitize printf functions.
...
Intercept and sanitize arguments passed to printf functions in ASan and TSan
(don't do this in MSan for now). The checks are controlled by runtime flag
(off by default for now).
Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov!
llvm-svn: 199729
2014-01-21 11:58:33 +00:00
Evgeniy Stepanov
e676aadecf
[asan] Enable frame pointer based unwinder on ARM.
...
This code works with AAPCS-style {fp, lr} frames. Unlike linux perf, it does
not unwind through code compiled with -mapcs-frame (which Clang does not
support anyway).
llvm-svn: 199725
2014-01-21 11:04:58 +00:00
Alexey Samsonov
0714b7b31b
[Sanitizer] Support %.*s in internal printf implementation. Patch by Yuri Gribov.
...
llvm-svn: 199724
2014-01-21 10:59:44 +00:00
Kostya Serebryany
9fcb4c4a6e
[asan] one more test for https://code.google.com/p/address-sanitizer/issues/detail?id=258
...
llvm-svn: 199723
2014-01-21 10:57:07 +00:00
Kostya Serebryany
4871067a55
[asan] relax the checks inside __sanitizer_annotate_contiguous_container: they are too optimistic due to https://code.google.com/p/address-sanitizer/issues/detail?id=258 .
...
llvm-svn: 199715
2014-01-21 09:53:49 +00:00