Commit Graph

709 Commits

Author SHA1 Message Date
Alexey Samsonov 605f2df106 [ASan] Fix test cases: don't assume that fast unwinder can't unwind through libc.
llvm-svn: 227265
2015-01-27 23:06:48 +00:00
Dmitry Vyukov 312ad250ff tsan: properly instrument unaligned accesses
If a memory access is unaligned, emit __tsan_unaligned_read/write
callbacks instead of __tsan_read/write.
Required to change semantics of __tsan_unaligned_read/write to not do the user memory.
But since they were unused (other than through __sanitizer_unaligned_load/store) this is fine.
Fixes long standing issue 17:
https://code.google.com/p/thread-sanitizer/issues/detail?id=17

llvm-svn: 227230
2015-01-27 20:19:12 +00:00
Dmitry Vyukov d6e0f8b6ca tsan: add test for ANNOTATE_HAPPENS_BEFORE/AFTER annotations
llvm-svn: 227190
2015-01-27 13:03:18 +00:00
Kuba Brecka aa772feb8e [ASan] Use rpath in tests that produce a shared library
Modifying Darwin/interception-in-shared-lib-test.cc and suppressions-library.cc
to use rpath instead of linking against the full path to the temporary file.
NFC.

llvm-svn: 227161
2015-01-27 01:29:18 +00:00
David Blaikie b26513950d Fix up test cases to account for improved column fidelity provided by clang
llvm-svn: 227033
2015-01-25 04:39:06 +00:00
Kuba Brecka 9a36b3e147 [compiler-rt] Ensure AsanInitFromRtl is called from a static initializer on OS X by using ASAN_DYNAMIC=1
The idea is to ensure that the ASan runtime gets initialized early (i.e.
before other initializers/constructors) even when DYLD_INSERT_LIBRARIES
is not used. In that case, the interceptors are not installed (on OS X,
DYLD_INSERT_LIBRARIES is required for interceptors to work), and therefore
ASan gets currently initialized quite late -- from the main executable's
module initializer. The following issues are a consequence of this:

  https://code.google.com/p/address-sanitizer/issues/detail?id=363
  https://code.google.com/p/address-sanitizer/issues/detail?id=357

Both of them are fixed with this patch.

Reviewed at http://reviews.llvm.org/D7117

llvm-svn: 226929
2015-01-23 19:29:19 +00:00
Kuba Brecka 405de4ae10 Fix/workaround for OS X truncated stacktraces taken by external tools
This patch is a proposed solution for https://code.google.com/p/address-sanitizer/issues/detail?id=375:

When the stacktraces are captured and printed by ASan itself, they are fine, but when the program has already printed the report (or is just printing it), capturing a stacktrace via other means is broken. "Other means" include OS X CrashReporter, debuggers or calling backtrace() within the program. For example calling backtrace() from a sanitizer_set_death_callback function prints a very truncated stacktrace.

Reviewed at http://reviews.llvm.org/D7103

llvm-svn: 226878
2015-01-22 23:36:47 +00:00
Evgeniy Stepanov 0729053dac [sanitizer] Move sched_getparam test under Linux/.
llvm-svn: 226832
2015-01-22 15:34:50 +00:00
Evgeniy Stepanov 229984947b [sanitizer] Intercept sched_getparam.
llvm-svn: 226827
2015-01-22 14:03:07 +00:00
Evgeniy Stepanov d38af30b74 [msan] Better use-after-free reports.
By attaching an extra integer tag to heap origins, we are able
to distinguish between uninits
 - created by heap allocation,
 - created by heap deallocation (i.e. use-after-free),
 - created by __msan_allocated_memory call,
 - etc.

See https://code.google.com/p/memory-sanitizer/issues/detail?id=35.

llvm-svn: 226821
2015-01-22 13:33:16 +00:00
Timur Iskhodzhanov b4b6b74079 [ASan/Win] Move the shadow to 0x30000000
llvm-svn: 226809
2015-01-22 12:24:21 +00:00
Timur Iskhodzhanov 841572e90a [ASan] Print out the shadow memory range on shadow mapping failures
llvm-svn: 226807
2015-01-22 12:05:27 +00:00
Evgeniy Stepanov a6b279546d [msan] Relax CHECK conditions in 2 tests.
Sometimes malloc/realloc/etc are symbolized as
__interceptor_malloc/realloc/etc.

llvm-svn: 226803
2015-01-22 09:27:00 +00:00
Evgeniy Stepanov 844f5828e9 [msan] Fix origins in realloc.
Fixes 2 issues in origins arising from realloc() calls:
 * In the in-place grow case origin for the new memory is not set at all.
 * In the copy-realloc case __msan_memcpy is used, which unwinds stack from
   inside the MSan runtime. This does not generally work (as we may be built
   w/o frame pointers), and produces "bad" stack trace anyway, with several
   uninteresting (internal) frames on top.

This change also makes realloc() honor "zeroise" and "poison_in_malloc" flags.

See https://code.google.com/p/memory-sanitizer/issues/detail?id=73.

llvm-svn: 226674
2015-01-21 16:48:29 +00:00
Dmitry Vyukov 3ab6b2347e tsan: remove sleeps from tests
Even sleep(1) lead to episodical flakes on some machines.
Use an invisible by tsan barrier to enforce required execution order instead.
This makes the tests deterministic and faster.

llvm-svn: 226659
2015-01-21 13:50:02 +00:00
Evgeniy Stepanov 79ca0fd1a0 [msan] Update origin for the entire destination range on memory store.
Previously we always stored 4 bytes of origin at the destination address
even for 8-byte (and longer) stores.

This should fix rare missing, or incorrect, origin stacks in MSan reports.

llvm-svn: 226658
2015-01-21 13:21:31 +00:00
Alexander Potapenko cb273921de [ASan] Fix the test expectations for dyld_insert_libraries_reexec.cc
llvm-svn: 226651
2015-01-21 10:04:41 +00:00
Kostya Serebryany c6338ac943 [asan] use MADV_NOHUGEPAGE for shadow to reduce the actual memory usage
llvm-svn: 226636
2015-01-21 02:05:31 +00:00
Evgeniy Stepanov f074b3c2de [asan] Allow changing verbosity in activation flags.
This change removes some debug output in asan_flags.cc that
was reading the verbosity level before all the flags were parsed.

llvm-svn: 226566
2015-01-20 13:21:20 +00:00
Evgeniy Stepanov fbeb7e65d9 [asan] Warn if unsupported flags are used at activation.
llvm-svn: 226563
2015-01-20 12:19:14 +00:00
Evgeniy Stepanov a2edd9159a [sanitizer] Make unrecognized flags not fatal.
Print a warning at verbosity=1 and higher instead of dying immediately.

llvm-svn: 226458
2015-01-19 12:22:57 +00:00
Evgeniy Stepanov 141c5a9ae0 [sanitizer] Move options-related tests to sanitizer_common.
And handle help=1 in standalone LSan.

llvm-svn: 226438
2015-01-19 09:21:44 +00:00
David Blaikie 4da5edbebe Update for tests failing due to improvements in clang's column information for aggregate expressions
llvm-svn: 226393
2015-01-18 02:17:55 +00:00
Evgeniy Stepanov 4448007885 [asan] More verbose output from one of the tests.
Trying to debug a buildbot-only failure.

llvm-svn: 226270
2015-01-16 12:08:32 +00:00
Evgeniy Stepanov 82d3ef1617 [asan] Fix asan_options-include test.
Wrong include order.

llvm-svn: 226268
2015-01-16 10:30:53 +00:00
Hal Finkel e67f32aa99 [asan] Loosen test for upcoming ppc64 change
This test casts 0x4 to a function pointer and calls it. Unfortunately, the
faulting address may not exactly be 0x4 on PPC64 ELFv1 systems. The LLVM PPC
backend used to always generate the loads "in order", so we'd fault at 0x4
anyway. However, at upcoming change to loosen that ordering, and we'll pick a
different order on some targets. As a result, as explained in the comment, we
need to allow for certain nearby addresses as well.

llvm-svn: 226202
2015-01-15 20:48:38 +00:00
Evgeniy Stepanov bc14dd46f2 [sanitizer] Implement include= option.
Allows loading sanitizer options from file.

llvm-svn: 226175
2015-01-15 16:26:59 +00:00
Evgeniy Stepanov f294d5b829 [sanitizer] Flag parser rewrite.
The new parser is a lot stricter about syntax, reports unrecognized
flags, and will make it easier to implemented some of the planned features.

llvm-svn: 226169
2015-01-15 15:13:43 +00:00
Evgeniy Stepanov 1a1a7d0f30 [lsan] Fix a typo in a test.
llvm-svn: 226168
2015-01-15 15:00:49 +00:00
David Blaikie baaaa67819 Reapply debug info changes now that more precise column information is available.
llvm-svn: 225959
2015-01-14 07:59:48 +00:00
Rafael Espindola c7e4fb209e Another try at handling LD_LIBRARY_PATH not being defined.
llvm-svn: 225932
2015-01-14 02:23:27 +00:00
Rafael Espindola a9782ecfb0 Handle LD_LIBRARY_PATH not being defined.
Should fix the bots after r225890.

llvm-svn: 225919
2015-01-14 01:28:08 +00:00
Alexey Samsonov f3b61be2ee Update test cases for new -fsanitize-recover= semantics.
llvm-svn: 225725
2015-01-12 23:02:42 +00:00
Timur Iskhodzhanov 00ede84084 [ASan] Move the shadow on Windows 32-bit from 0x20000000 to 0x40000000
llvm-svn: 225641
2015-01-12 17:38:58 +00:00
Evgeniy Stepanov 5975243955 [asan] Pass activation options in the android test runner.
llvm-svn: 225636
2015-01-12 17:10:05 +00:00
Jay Foad 335c08e56c [ASan] Handle SIGBUS on Linux.
Summary:
On Linux in some situations we can get SIGBUS instead of SIGSEGV on
stack overflow, so asan should handle SIGBUS as well as SIGSEGV.

https://code.google.com/p/address-sanitizer/issues/detail?id=369

Reviewers: samsonov, glider

Reviewed By: glider

Subscribers: glider, llvm-commits

Differential Revision: http://reviews.llvm.org/D6923

llvm-svn: 225630
2015-01-12 13:46:37 +00:00
David Blaikie 9098487213 Revert "Reapply debug info changes now that more precise column information is available."
While the clang patch is reverted pending investigation/fixes.

This reverts commit r225001.

llvm-svn: 225560
2015-01-09 23:27:12 +00:00
Kuba Brecka 1a03ccd848 [asan] Adding a regression test for https://code.google.com/p/address-sanitizer/issues/detail?id=368
llvm-svn: 225484
2015-01-09 00:26:45 +00:00
Kostya Serebryany 8cc4002df2 [asan] make a test consume 2x less RAM (we observe flaky bot failures that seem like OOMs)
llvm-svn: 225478
2015-01-08 23:37:09 +00:00
Renato Golin ea56f08b3f XFAIL AArch64 UBsan test, just like ARM
llvm-svn: 225370
2015-01-07 20:03:47 +00:00
Kostya Serebryany 7ad02fca09 [asan] add flag quarantine_size_mb, deprecate quarantine_size
llvm-svn: 225337
2015-01-07 02:37:52 +00:00
Kostya Serebryany 7e85a9216e [asan] add a flag soft_rss_limit_mb
llvm-svn: 225323
2015-01-06 23:53:32 +00:00
Kostya Serebryany 4e781371d1 [ubsan] disable coverage-levels.cc on darwin until we can investigate what's wrong there.
llvm-svn: 225281
2015-01-06 18:48:49 +00:00
Jay Foad a566693334 [asan] Bump the self-imposed stack limit from 128k to 256k. PowerPC64
Linux has 64k pages, so the old limit was only two pages. With ASLR the
initial sp might be right at the start of the second page, so the stack
will immediately grow down into the first page; and if you use all pages
of a limited stack then asan hits a kernel bug to do with how stack
guard pages are reported in /proc/self/maps:
http://lkml.iu.edu//hypermail/linux/kernel/1501.0/01025.html

We should still fix the underlying problems, but in the mean time this
patch makes the test work with 64k pages as well as it does with 4k
pages.

llvm-svn: 225261
2015-01-06 10:01:15 +00:00
Kostya Serebryany fb42a5a292 [ubsan] partially enable -fsanitize-coverage=N with ubsan. It will work as usual in most cases but will not dump coverage on error with -fno-sanitize-recover (that'll be a separate fix)
llvm-svn: 225234
2015-01-06 01:31:23 +00:00
Saleem Abdulrasool 6e6c1c3ef2 tests: correct builtins test if built under -mthumb on ARM
The clear_cache and enable_execute_stack tests attempt to memcpy the definition
of a function into a buffer before executing the function.  The problem with
this approach is that on some targets (ARM with thumb mode compilation, MIPS
with MIPS16 codegen or uMIPS), you would use a pointer which is incorrect (it
would be off-by-one) due to the ISA selection being encoded into the address.
This ensures that the function address is retrieved correctly in all cases.

llvm-svn: 225215
2015-01-05 21:54:50 +00:00
Kostya Serebryany 0f53d9a2ee [asan/tracing] extend the test a bit more, simplify the tracing code, add a guard page to trace array, fix the trace IDs before dumping
llvm-svn: 225108
2015-01-03 02:07:58 +00:00
Kostya Serebryany 86ced092f4 [asan] extend coverage-tracing.cc test
llvm-svn: 225107
2015-01-03 01:41:11 +00:00
Kostya Serebryany d421db05bb [asan] simplify the tracing code, make it use the same guard variables as coverage
llvm-svn: 225103
2015-01-03 00:54:43 +00:00
Kostya Serebryany 77c5c1a66d [asan] fix coverage between fork() and exec(): reinitialize the guards after fork()
llvm-svn: 225016
2014-12-30 23:16:12 +00:00