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