Commit Graph

1131 Commits

Author SHA1 Message Date
Alexander Potapenko ae49e8c34a [ASan] Fix GCD tests by spinning forever in the main thread.
Since the error is always reported by one of the GCD workers, this will help avoid premature program termination with exit code 0.

llvm-svn: 191294
2013-09-24 12:42:25 +00:00
Kostya Serebryany 01ff028814 [asan] remove -fsanitize=use-after-return from the tests (this flag now comes with asan by default)
llvm-svn: 191204
2013-09-23 14:34:06 +00:00
Timur Iskhodzhanov 7f92aa687a [ASan/Win] Slightly optimize the DLL thunk
llvm-svn: 191190
2013-09-23 11:40:58 +00:00
Timur Iskhodzhanov e2b207cfd2 [ASan] Fix a compile-time warning
llvm-svn: 191189
2013-09-23 11:19:43 +00:00
Timur Iskhodzhanov d6c93c7b4d [ASan] Add DLL thunks for the new stack UAR interface
llvm-svn: 191188
2013-09-23 11:05:41 +00:00
Alexander Potapenko 92b566b0e4 [ASan] Fix the interface test on Darwin.
llvm-svn: 191187
2013-09-23 10:38:23 +00:00
Kostya Serebryany b997c543fc [asan] disable the detect_stack_use_after_return run-time flag by default and enable it explicitly in tests. This is done in preparation to enabling the -fsanitize=use-after-return compile-time flag by default when -fsanitize=address is present.
llvm-svn: 191184
2013-09-23 08:58:14 +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 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
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
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
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
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
Kostya Serebryany 096413ba3b [asan] use TLS on Linux to get the FakeStack. Saves 15% performance
llvm-svn: 190661
2013-09-13 06:04:18 +00:00
Kostya Serebryany 77caab4d7b [asan] inline PoisonShadow in FakeStack to get ~10% speedup
llvm-svn: 190660
2013-09-13 05:57:58 +00:00
Kostya Serebryany 7638aa135e [asan] a bit of performance improvement in fake stack, generalized one test, fixed android build of another test
llvm-svn: 190606
2013-09-12 14:41:10 +00:00
Kostya Serebryany 627ea6391e [asan] add a test for use-after-return and exceptions and fix it. Not 100% sure this is a complete fix, will keep looking for harder cases.
llvm-svn: 190603
2013-09-12 13:25:29 +00:00
Alexander Potapenko 9caa10d0c7 [ASan] Do not build asan_fake_stack_test.cc on OSX until https://code.google.com/p/address-sanitizer/issues/detail?id=222 is fixed.
llvm-svn: 190597
2013-09-12 09:46:56 +00:00
Kostya Serebryany 79d98a851b [asan] limit the size of the fake stack with a reasonable constant. This fixes a failure when the main thread's stack is considered unlimited (very large).
llvm-svn: 190596
2013-09-12 09:08:13 +00:00
Kostya Serebryany 44441cc34b [asan] (part 2) don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
llvm-svn: 190594
2013-09-12 08:47:00 +00:00
Kostya Serebryany 736bd08e05 [asan] don't lazy-init fake_stack if we only need to check that fake_stack exists (should fix 32-bit builds)
llvm-svn: 190593
2013-09-12 08:43:44 +00:00
Kostya Serebryany 628cda7367 [asan] hopefully make the FakeStack async-signal safe, enable the related test
llvm-svn: 190592
2013-09-12 08:34:50 +00:00
Evgeniy Stepanov 58dbe06230 [asan] Fix deadlock in stack unwinder on android/x86.
Fixes PR17116.
Patch by 林作健 (manjian2006 at gmail.com).

llvm-svn: 190590
2013-09-12 08:16:28 +00:00
Kostya Serebryany e8f961e847 [asan] use xchg instead of CAS in FakeStack::Allocate (5% faster for this case)
llvm-svn: 190589
2013-09-12 07:28:42 +00:00
Kostya Serebryany 729c8dc65b [asan] fully re-implement the FakeStack (use-after-return) to make it faster and async-signal-safe. The implementation is not yet complete (see FIXMEs) but the existing tests pass.
llvm-svn: 190588
2013-09-12 07:11:58 +00:00
Timur Iskhodzhanov 92702d8401 [ASan] Remove the explicit function prototypes for intercepted functions on Windows
llvm-svn: 190411
2013-09-10 14:42:15 +00:00
Alexey Samsonov 7a36e6126b [Sanitizer] Refactor symbolization interface: use class instead of several functions. Move some code around to get rid of extra source files
llvm-svn: 190410
2013-09-10 14:36:16 +00:00
Kostya Serebryany 8fc35ca008 [asan] refactor the use-after-return API so that the size class is computed at compile time instead of at run-time. compiler-rt part
llvm-svn: 190406
2013-09-10 13:16:26 +00:00
Timur Iskhodzhanov 190784b21b [ASan] Don't crash in DescribeHeapAddress if we don't know the current thread's ID
Also make DescribeThread easier to use.
This was firing on Dr.ASan runs, not sure how to repro InvalidTID in a simple test.

llvm-svn: 190392
2013-09-10 08:36:21 +00:00
Evgeniy Stepanov cf02f171a9 [sanitizer] Fix PR17138.
strerror_r on OSX returns a positive error code when the errno value is
unknown. Buffer contents are initialized in any case.

llvm-svn: 190295
2013-09-09 08:58:54 +00:00
Alexey Samsonov 77029be19a [ASan] fix one more memory leak in test case
llvm-svn: 190277
2013-09-08 14:01:07 +00:00
Alexey Samsonov 071cc9e89d [ASan] turn on leak checking for ASan tests and fix a few discovered leaks
llvm-svn: 190274
2013-09-08 13:23:29 +00:00
Evgeniy Stepanov 5c1035e7fa [sanitizer] A bunch of linux system call handlers.
llvm-svn: 190157
2013-09-06 14:20:01 +00:00
Alexander Potapenko 2a54274c25 [ASan] make the check for NULL more portable.
llvm-svn: 190139
2013-09-06 12:04:37 +00:00
Alexey Samsonov 6985f3f67b Fix compiler warning introduced in r190022
llvm-svn: 190137
2013-09-06 11:08:12 +00:00
Alexey Samsonov 16516b9b00 Migrate ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS to new spelling - ATTRIBUTE_NO_SANITIZE_ADDRESS
llvm-svn: 190136
2013-09-06 11:07:33 +00:00