Commit Graph

2853 Commits

Author SHA1 Message Date
Dmitry Vyukov 2ea2d9cb29 tsan: remove unneeded ___chkstk_ms function from Go runtime
llvm-svn: 191161
2013-09-22 02:49:56 +00:00
Dmitry Vyukov a2c6e1e80f tsan: allow symbolization of non-native PCs, e.g. coming from JIT/JAVA/etc
llvm-svn: 191157
2013-09-22 00:14:57 +00:00
Dmitry Vyukov 76ec1910ac tsan: ignore malloc/free/strdup when called from libjvm
llvm-svn: 191153
2013-09-21 23:44:19 +00:00
Dmitry Vyukov 150406bbf3 tsan: ignore all interceptors coming directly from JVM
llvm-svn: 191152
2013-09-21 23:06:00 +00:00
Dmitry Vyukov 017015c9ed tsan: improve diagnostics for incorrect usages of mutexes
llvm-svn: 191151
2013-09-21 22:43:27 +00:00
Dmitry Vyukov 4e9c091dd7 tsan: allow to obtain code range for a particular module
this is required to ignore interceptors when called from the module

llvm-svn: 191149
2013-09-21 21:41:08 +00:00
Dmitry Vyukov 1da6b4d5c8 tsan: intercept fork syscall
llvm-svn: 191144
2013-09-21 20:59:04 +00:00
Dmitry Vyukov 3d15bcca1d tsan: do not try to use builtin atomic operations
see the comment in code

llvm-svn: 191132
2013-09-21 04:59:02 +00:00
Dmitry Vyukov a182592aa0 tsan: intercept close syscall
llvm-svn: 191129
2013-09-21 03:47:35 +00:00
Alexander Potapenko 6c49695e7a [ASan] Remove a complex multiline comment that baffles lint.
That comment is repeated in another function below.

llvm-svn: 191085
2013-09-20 11:33:14 +00:00
Alexander Potapenko d1bae72e39 [libsanitizer] Pass an explicit template to mktemp. Running mktemp without a template doesn't work on Darwin.
llvm-svn: 191084
2013-09-20 11:29:44 +00:00
Alexander Potapenko bff7e64a3f [ASan] Fix compilation of asan_str_test.cc on non-Darwin.
llvm-svn: 191083
2013-09-20 11:03:27 +00:00
Alexander Potapenko 7be1a632b2 [ASan] Enforce the memmove semantics for both memcpy() and memmove() interceptors on Darwin.
Due to bugs in the interposition of resolver functions on 10.7 and 10.8 both memcpy() and memmove()
were previously intercepted by INTERCEPTOR(memcpy), which led to false positives and crashes (see http://llvm.org/bugs/show_bug.cgi?id=16362)
We choose to use a memmove-like function in both cases. This effectively disables the overlap checks in memcpy(), but the overlaps
aren't possible in practice, because memcpy() and memmove() are the same function on Darwin.

Once the interposition is fixed in 10.9, we'll need to revisit this issue, see https://code.google.com/p/address-sanitizer/issues/detail?id=226

llvm-svn: 191081
2013-09-20 10:56:34 +00:00
Kostya Serebryany 2ab5a48dbe [asan] nuke yet another async-signal-safety bug in UAR (oh, my)
llvm-svn: 191080
2013-09-20 09:16:21 +00:00
Alexey Samsonov 29d7be1f68 [Sanitizer] Add pthread_cond_init to the list of versioned functions
llvm-svn: 191078
2013-09-20 08:37:57 +00:00
Dmitry Vyukov 481d90c480 tsan: handle memory read/write in syscalls
llvm-svn: 191074
2013-09-20 06:54:14 +00:00
Dmitry Vyukov c7547d0527 tsan: allow to ignore memory accesses in malloc and free
llvm-svn: 191072
2013-09-20 05:37:36 +00:00
Dmitry Vyukov 20f6ff1e66 tsan: do not crash when user intercepts fopen()
llvm-svn: 191066
2013-09-20 02:01:38 +00:00
Dmitry Vyukov b523b9c8d4 tsan: fix linking of tsan runtime into dynamic libraries
versioned symbols can not be linked into dynamic library w/o linker script
also simplifies code as side effect

llvm-svn: 191056
2013-09-19 23:44:51 +00:00
Alexander Potapenko 8f5d907aea [ASan] Fix init-order-dlopen.cc test to not depend on the -Wl,-undefined,dynamic_lookup being passed to the linker.
llvm-svn: 191012
2013-09-19 17:12:45 +00:00
Kostya Serebryany f8bbdfaf95 [asan] fix one more async-signal-safety issue with use-after-return
llvm-svn: 191004
2013-09-19 14:59:52 +00:00
Alexey Samsonov 786ee9b1ad [MSan] Fix -Wempty-body warning
llvm-svn: 190994
2013-09-19 08:35:16 +00:00
Alexey Samsonov 1c5cd7516f [TSan] Fix -Wempty-body warning
llvm-svn: 190993
2013-09-19 07:59:18 +00:00
Dmitry Vyukov d78bc3aa11 asan/tsan/msan: use builtin atomic operations when available
this should fix episodic crashes on ARM/PPC
x86_32 is still broken

llvm-svn: 190991
2013-09-19 06:02:56 +00:00
Dmitry Vyukov f54631dcfe tsan: prevent the following false positive due to __cxa_atexit
WARNING: ThreadSanitizer: data race (pid=29103)
  Write of size 8 at 0x7d64003bbf00 by main thread:
    #0 free tsan_interceptors.cc:477
    #1 __run_exit_handlers <null>:0 (libc.so.6+0x000000050cb7)

  Previous write of size 8 at 0x7d64003bbf00 by thread T78 (mutexes: write M9896):
    #0 calloc tsan_interceptors.cc:449
    #1 ...

llvm-svn: 190989
2013-09-19 04:48:59 +00:00
Dmitry Vyukov c2437ffc23 tsan: consistently use thr instead of cur_thread() in annotations implementation
llvm-svn: 190988
2013-09-19 04:42:25 +00:00
Dmitry Vyukov 1a7ca92006 tsan: refactor internal IgnoreCtl interface
llvm-svn: 190987
2013-09-19 04:39:04 +00:00
Evgeniy Stepanov 91375fd66e [tsan] No-op implementation of AnnotateMemoryIsInitialized.
llvm-svn: 190933
2013-09-18 11:20:31 +00:00
Kostya Serebryany c3d43ca3ec [asan] add a run-time option detect_stack_use_after_return, add verbosity output for fake stack
llvm-svn: 190932
2013-09-18 10:35:12 +00:00
Alexey Samsonov c947eb08b5 [ASan] Don't add SANITIZER_INTERFACE_ATTRIBUTE for internal ASan functions
llvm-svn: 190860
2013-09-17 09:42:03 +00:00
Alexey Samsonov a7f35c06dc [ASan] Enable fake stack test on Mac and Android, as no-instrumentation tests are now fixed
llvm-svn: 190856
2013-09-17 08:40:32 +00:00
Alexey Samsonov 676c109c24 [ASan] Link tests with -pie if ASan runtime uses zero-base shadow
llvm-svn: 190853
2013-09-17 07:50:12 +00:00
Kostya Serebryany 2f5c2be6bd [asan] further speedup use-after-return: simplify deallocation of fake frames. ~ 20% speedup.
llvm-svn: 190852
2013-09-17 07:42:54 +00:00
Nick Lewycky 885136d3b6 Check the function we just called for errors, not an incoming argument. Noticed
by inspection.

llvm-svn: 190828
2013-09-17 00:23:28 +00:00
Alexey Samsonov f71c88910c [ASan] Don't link with pthread on Android
llvm-svn: 190794
2013-09-16 16:51:49 +00:00
Alexey Samsonov 036a5bef2d [ASan] Split ASan unit tests into two different binaries:
(1) instrumented, i.e. compiled and linked with -fsanitize=address
(2) not instrumented, compiled w/o -fsanitize=address and linked with ASan runtime statically.

llvm-svn: 190788
2013-09-16 15:50:53 +00:00
Alexey Samsonov 48e256466a [ASan] Check that getSymbolizer() is defined. Turn magic mapping constants into named variables
llvm-svn: 190787
2013-09-16 15:45:06 +00:00
Alexey Samsonov ad7925e0c1 Minor enhancements for sanitizer_common build rules
llvm-svn: 190786
2013-09-16 15:43:23 +00:00
Evgeniy Stepanov 08d649c024 [msan] Check return value of main: compiler-rt tests.
llvm-svn: 190783
2013-09-16 13:25:26 +00:00
Evgeniy Stepanov 65562f5281 [msan] Fix origin of deallocated memory.
MSan poisons deallocated memory but it used to give it an invalid origin value,
resulting in confusing reports. This change associates deallocation stack trace
with such memory.

Note that MSan does not have quarantine, and use-after-free detection is very
limited.

llvm-svn: 190781
2013-09-16 11:03:31 +00:00
Evgeniy Stepanov 0da35401ce [msan] Add source file:line to stack origin reports.
Test.

llvm-svn: 190690
2013-09-13 12:55:07 +00:00
Evgeniy Stepanov ac5ac34cf7 [msan] Add source file:line to stack origin reports.
Runtime library part.

llvm-svn: 190686
2013-09-13 12:49:13 +00:00
Evgeniy Stepanov 9be91e970e [msan] Intercept tzset.
llvm-svn: 190682
2013-09-13 11:27:38 +00:00
Evgeniy Stepanov 8f0b7feb4c [msandr] Add debugging instructions to README.txt.
llvm-svn: 190680
2013-09-13 11:00:50 +00:00
Kostya Serebryany 3bee8efc95 [asan] Android does not have TLS
llvm-svn: 190669
2013-09-13 08:58:22 +00:00
Alexey Samsonov 70c93d3b1c [ASan] Temporary disable UAR unit test on Android due to https://code.google.com/p/address-sanitizer/issues/detail?id=222
llvm-svn: 190667
2013-09-13 08:07:21 +00:00
Kostya Serebryany 9583b87077 [asan] don't record the class_id in FakeFrame (scratching the last bits of performance)
llvm-svn: 190666
2013-09-13 07:50:44 +00:00
Kostya Serebryany 4117bdbbbc [asan] more performance to FakeStack: a) don't used atomic exchange, instead rely on regular load and store and other signal-safe logic; b) remove allocated_from_size_class_mask_ which is not helping much anyway; Another 10% speedup
llvm-svn: 190664
2013-09-13 07:20:35 +00:00
Kostya Serebryany 43c4493b44 [asan] second attempt to use TLS with fake stack. This time it looks (more) async-signal safe.
llvm-svn: 190663
2013-09-13 06:32:26 +00:00
Kostya Serebryany c19851ab6c [asan] undo the previous commit since TLS hack breaks with signals... :(
llvm-svn: 190662
2013-09-13 06:15:02 +00:00