Commit Graph

652 Commits

Author SHA1 Message Date
Kostya Serebryany 422ea24d45 [asan] make print_memory_profile_test more reliable by using large allocation sizes. Hoping to fix the llvm-clang-lld-x86_64-debian-fast bot
llvm-svn: 272020
2016-06-07 16:08:59 +00:00
Kuba Brecka 2e26d9faac [asan] Reenable ASan tests in "check-all"
Somehow, in r271049, ASan lit tests and unit tests were removed from “check-all”. Doesn’t seem intentional, let’s fix it.

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

llvm-svn: 271905
2016-06-06 16:24:47 +00:00
Chandler Carruth 7573cfe2b3 It really helps to not randomly delete one of the closing brackets. =/
llvm-svn: 271787
2016-06-04 09:06:59 +00:00
Chandler Carruth b330dcab19 Ok, now I know why I kept getting confused and not making progress
fixing tis test. There are different configurations running, and they
have subtly different backtraces. I didn't notice that the configs
changed and so I kept occilating between the two.

Now I've looked at two different configs at the same time, and so this
should be much more likely to work.

llvm-svn: 271786
2016-06-04 08:54:57 +00:00
Chandler Carruth 9ef4243824 Fix the test for printing the memory profile. This fuctionality is only
available along side the leak checking, so use the REQUIRES for that.

Also, use %run as other tests do when launching the built binary.

This fixes check-asan for me on Linux and looks like it should fix the
linux sanitizer bots as well.

llvm-svn: 271785
2016-06-04 08:45:32 +00:00
Chandler Carruth ece6d7bf2e Update this test yet again, this time based on a nice consecutive pair
of lines provided with the filecheck output from the previous run. I'll
probably give up after this and get someone with a Windows build to help
me out.

llvm-svn: 271784
2016-06-04 08:24:56 +00:00
Chandler Carruth 4f785dc1f6 I didn't actually get this right, but now I have frame #0 and frame #2.
This should fail on frame #1 and show what that should actually be.

llvm-svn: 271783
2016-06-04 08:09:24 +00:00
Chandler Carruth d26defd57e Amazingly, my guess was correct for the top two frames here. Hopefully
with this, the Windows sanitizer bot will go green!

llvm-svn: 271782
2016-06-04 07:29:10 +00:00
Chandler Carruth 79abce39bb Temporary hack to this test to try and get the sanitizer-windows bot to
show enough information for me to fix the patterns used here.

llvm-svn: 271779
2016-06-04 06:16:49 +00:00
Kostya Serebryany 5a7159c416 [asan] add an interface function __sanitizer_print_memory_profile (a basic memory profiler; asan/Linux-only for now)
llvm-svn: 271463
2016-06-02 01:21:52 +00:00
Etienne Bergeron 00f3f6e296 This patch is activating the build of Asan on Windows 64-bits.
It's fixing compilation errors. The runtime is not yet working.

Missing features:

OverrideFunction for x64
an equiv function for inline asm (atomic_compare_exchange_strong)
shadow memory offset needs to be adjusted
RoundUpToInstrBoundary for x64
They will be implemented by subsequent patches.

Patch by Wei Wang.

Differential revision: http://reviews.llvm.org/D20455

llvm-svn: 271049
2016-05-27 21:29:31 +00:00
Bill Seurer a143aed23c [powerpc] mark static_tls.cc test as UNSUPPORTED on powerpc64
An upcoming change for ld in binutils 2.26 causes this test to
always fail.

llvm-svn: 270223
2016-05-20 14:54:37 +00:00
Daniel Sanders 962b2cda9c [mips][ias] Two XFAIL's now pass on 32-bit MIPS.
llvm-svn: 269571
2016-05-14 16:18:16 +00:00
Kuba Brecka 7a947b6c6d Update test expectations after r269291 (Fix a crash when demangling Swift symbols).
llvm-svn: 269311
2016-05-12 17:08:25 +00:00
Marcin Koscielnicki 1598698fcd [ASan] [SystemZ] Add -mbackchain to test cflags.
This is needed for proper operation of the fast unwinder, see the discussion
on D18895.

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

llvm-svn: 269277
2016-05-12 08:49:34 +00:00
Maxim Ostapenko 6dccd5bc1f [asan] Bail out on stack overflow in recovery mode.
In recovery mode, when ASan detects stack overflow (say, when infinite recursion detected),
it tries to continue program execution and hangs on repetitive error reports. There isn't any
sense to do it, we can just bail out on stack overflow error, because the program would crash soon anyway.

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

llvm-svn: 268713
2016-05-06 07:09:22 +00:00
Vitaly Buka 8742943cb0 Relax stack check as on some platforms demanglers fail
Summary:
  On Windows (already fixed) and FreeBSD we have stacks traces without
  operator().

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 268332
2016-05-02 23:34:40 +00:00
Vitaly Buka 9102fc20f8 Add another failing use-after-scope test
Summary:
  Use after scope is not detected if array larger then 8 bytes.

Subscribers: kubabrecka

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

llvm-svn: 268330
2016-05-02 23:12:04 +00:00
Kuba Brecka a90528bb89 [sanitizer] Fix a crash in SizeClassAllocator32 with an out-of-range pointer
This happens on a 64-bit platform that uses SizeClassAllocator32 (e.g. ASan on AArch64). When querying a large invalid pointer, `__sanitizer_get_allocated_size(0xdeadbeefdeadbeef)`, an assertion will fail.  This patch changes PointerIsMine to return false if the pointer is outside of [kSpaceBeg, kSpaceBeg + kSpaceSize).

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

llvm-svn: 268243
2016-05-02 15:23:01 +00:00
Marcin Koscielnicki ee587cba0e [ASan] Add shadow offset for SystemZ.
This is the compiler-rt counterpart to D19650.

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

llvm-svn: 268162
2016-04-30 10:02:12 +00:00
Filipe Cabecinhas 30cba35a84 Finally fix invalid-pointer-pairs.cc. This time the demangle on the Windows buildbot.
llvm-svn: 268160
2016-04-30 08:34:40 +00:00
Filipe Cabecinhas 486c5d6ae9 Fix test's memory leaks.
llvm-svn: 268138
2016-04-29 23:42:34 +00:00
Filipe Cabecinhas dd754ef857 Try to fix clang-cmake-aarch64-42vma by removing a memory leak (have a global var capture it).
llvm-svn: 268114
2016-04-29 21:33:12 +00:00
Filipe Cabecinhas 04d61050ea [asan] Assert in __sanitizer_ptr_{sub,cmp} if one of the pointers was freed.
Summary:
This (partially) implements the check mentioned at
http://kristerw.blogspot.co.uk/2016/04/dangling-pointers-and-undefined-behavior.html
(via John Regehr)

Quoting:
"That the behavior is undefined follows from C11 6.2.4 "Storage
durations of objects"
  The lifetime of an object is the portion of program execution during
  which storage is guaranteed to be reserved for it. An object exists, has
  a constant address, and retains its last-stored value throughout its
  lifetime. If an object is referred to outside of its lifetime, the
  behavior is undefined. The value of a pointer becomes indeterminate when
  the object it points to (or just past) reaches the end of its lifetime.
and 7.22.3 "Memory management functions" that says that free ends the
lifetime of objects
  The lifetime of an allocated object extends from the allocation until
  the deallocation.
"

We can probably implement this for stack variables too, but I think this
is a good start to see if there's interest in this check.
We can also hide this behind a flag, too.

Reviewers: samsonov, kcc, rsmith, regehr

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 268097
2016-04-29 20:37:34 +00:00
Marcin Koscielnicki a0193ecfe1 [ASan] [SystemZ] Mark segv_read_write.c as UNSUPPORTED.
On s390*-linux, sigcontext just doesn't contain any information that could
be used to recover the type of access, so there's no way to fix this, short
of emulating the faulting instruction.

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

llvm-svn: 267960
2016-04-29 00:43:20 +00:00
Vedant Kumar 6a2ec9fc57 [test/asan] Update a test case to work with old Darwin SDK's
On Darwin, MAP_ANONYMOUS is a synonym for MAP_ANON. However, some SDK's
don't define MAP_ANONYMOUS. Use MAP_ANON to work around this.

(As a point of interest, the situation is exactly reversed on Linux.)

llvm-svn: 267907
2016-04-28 17:48:35 +00:00
Mike Aizatsky ccd318dc7e [sanitizers] read/write page fault detection on mac.
Summary: Resubmit of http://reviews.llvm.org/D19495 enabled only on intel.

Subscribers: kubabrecka

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

llvm-svn: 267750
2016-04-27 18:02:21 +00:00
Reid Kleckner a16ef7633b Un-XFAIL tests on Windows after fixing PR27492
Private symbols in PDBs do not have parameter types in their names so we
have to drop the parens from the lambda call operator.

llvm-svn: 267735
2016-04-27 16:38:03 +00:00
Mike Aizatsky a3060c1159 [sanitizers] rewriting test assuming assert() changes coverage.
Summary:
On windows platform assert() call creates two distinct CFG edges
which are coverage-instrumented. Simply calling assert would
change coverage numbers on the platform.

Subscribers: kubabrecka

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

llvm-svn: 267610
2016-04-26 21:56:14 +00:00
Marcin Koscielnicki 7ecdeb7ac3 [sanitizer] [SystemZ] Add ptrace support bits.
Differential Revision: http://reviews.llvm.org/D19134

llvm-svn: 267548
2016-04-26 10:41:30 +00:00
Mehdi Amini 9163f4997a Revert "[sanitizers] read/write page fault detection on mac."
This reverts commit r267477.
It broke our bots that enables the AArch64 backends, it seems that
this code is using a Darwin *X86 specific* field.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 267526
2016-04-26 07:03:11 +00:00
Mike Aizatsky f2bee298a0 [sanitizers] read/write page fault detection on mac.
Subscribers: kubabrecka

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

llvm-svn: 267477
2016-04-25 21:44:43 +00:00
Evgeniy Stepanov 988ebe9f34 [asan] Disable one test on windows.
Patch by Vitaly Buka.

llvm-svn: 267088
2016-04-22 00:34:10 +00:00
Evgeniy Stepanov 4c0f6afbab Enable stack-use-after-scope tests.
Fix and enable working stack-use-after-scope tests.
Add more failing tests for the feature, for fix later.

PR27453.

Patch by Vitaly Buka.

llvm-svn: 267084
2016-04-22 00:10:23 +00:00
Evgeniy Stepanov 0e97e036d3 [asan] Mark strdup test as unsupported on arm/linux.
llvm-svn: 267028
2016-04-21 18:18:09 +00:00
Evgeniy Stepanov 5d71bc5252 [asan] Add __strdup interceptor.
This happens on Linux when building as C (not C++) with optimization.

llvm-svn: 266931
2016-04-20 22:45:23 +00:00
Mandeep Singh Grang 04ccbd4053 [compiler-rt] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Summary:
Removed unwanted --check-prefix=CHECK from the following unit tests:
      test/asan/TestCases/Posix/start-deactivated.cc
      test/tsan/Darwin/ignored-interceptors.mm

 Patch by: Mandeep Singh Grang (mgrang)

Reviewers: samsonov, kcc, dvyukov, eugenis

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

llvm-svn: 266813
2016-04-19 20:29:59 +00:00
Kostya Serebryany d8ce87f850 Additional test for use-after-scope
Summary: Test that asan detects access to the dead variable captured by lambda.

Reviewers: aizatsky, kcc

Subscribers: llvm-commits

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

llvm-svn: 266676
2016-04-18 21:36:34 +00:00
Alex Denisov a3f5c4c047 Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266520
2016-04-16 07:03:45 +00:00
Evgeniy Stepanov b70a2dd157 [asan] Prefer alloc-dealloc-mismatch to new-delete-type-mismatch.
With -fsized-deallocation, new[] vs delete mismatch is reported as
new-delete-type-mismatch. This is technically true, but
alloc-dealloc-mismatch describes it better.

llvm-svn: 266246
2016-04-13 21:04:27 +00:00
Mike Aizatsky 87b30a0ef2 [sancov] updaing android test after enabling cc edge pruning
llvm-svn: 265714
2016-04-07 20:21:21 +00:00
Mike Aizatsky 66505137eb [sancov] updaing android test
llvm-svn: 265692
2016-04-07 16:22:34 +00:00
Mike Aizatsky 5d4d715b99 [sancov] removing flaky test case (win)
llvm-svn: 265627
2016-04-07 00:23:02 +00:00
Mike Aizatsky 49a68258f5 [sancov] enabling coverage edge pruning by default.
Differential Revision: http://reviews.llvm.org/D18845

llvm-svn: 265614
2016-04-06 23:24:16 +00:00
Reid Kleckner 80fc4bc68a Apply suggestion from HJ Lu to avoid misaligned stack in test
Fixes PR27191

llvm-svn: 265322
2016-04-04 18:27:32 +00:00
Kuba Brecka 428a9f95a4 [asan,tsan] Make Darwin-specific tests more stable (use ignore_interceptors_accesses=1 for GCD tests and printf instead of NSLog).
llvm-svn: 265300
2016-04-04 14:54:05 +00:00
Ryan Govostes e0f41da049 [asan] Mark the initialization-bug.cc unsupported on OS X Yosemite and older
This test should fail on OS X Yosemite and older, and pass on OS X El Capitan
and newer as well as on other platforms.

llvm-svn: 264938
2016-03-30 22:21:58 +00:00
Ryan Govostes 89daa29fa6 [asan] Make the Darwin/dead-strip.c test require El Capitan or newer
llvm-svn: 264766
2016-03-29 18:54:29 +00:00
Ryan Govostes dc91fe5d8b [asan] Add runtime support for __asan_(un)register_image_globals
This change introduces routines that register and unregister all
instrumented globals in a loaded executable image.

These routines are only implemented on Darwin, where globals metadata
is expected to be placed in the __DATA,__asan_globals section.

Review: http://reviews.llvm.org/D16841
llvm-svn: 264644
2016-03-28 20:28:17 +00:00
Kostya Serebryany b48f8f09b1 [asan] bump the scariness score of read-after-frees (based on feedback from the Chrome security team)
llvm-svn: 264481
2016-03-26 00:00:19 +00:00