Commit Graph

1483 Commits

Author SHA1 Message Date
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
Marcin Koscielnicki 9135ff9247 [MSan] Use COMMON_INTERCEPTOR_ENTER in libdl interceptors.
This fixes fails in test/msan/dlerror.cc - when real dlerror calls strcmp,
our strcmp interceptor now skips poison checking, since it's called in
interceptor context.  Strictly speaking, only the dlerror change is
necessary to fix the fail, but let's also change the other two just in case.

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

llvm-svn: 267486
2016-04-25 22:25:49 +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
Derek Bruening 8d97011eb2 [esan] EfficiencySanitizer libc interceptors
Summary:
Adds libc interceptors to the runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The interceptors cover
the memory operations in most common library calls and will be shared
among all esan tools.

Reviewers: aizatsky

Subscribers: zhaoqin, tberghammer, danalbert, srhines, llvm-commits, vitalybuka, eugenis, kcc

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

llvm-svn: 267293
2016-04-23 16:41:24 +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
Derek Bruening af7aaae1bc [esan] EfficiencySanitizer base runtime library
Summary:
Adds the initial version of a runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The library includes:

+ Slowpath code via callouts from the compiler instrumentation for
  each memory access.

+ Registration of atexit() to call finalization code.

+ Runtime option flags controlled by the environment variable
  ESAN_OPTIONS.  The common sanitizer flags are supported such as
  verbosity and log_path.

+ An initial simple test.

Still TODO: common code for libc interceptors and shadow memory mapping,
and tool-specific code for shadow state updating.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267060
2016-04-21 21:32:25 +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
Kuba Brecka bf8b5f8dd2 [tsan] Rename ReportThread->pid to ReportThread->os_id
The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it.

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

llvm-svn: 266994
2016-04-21 14:49:25 +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
Renato Golin 1f42286364 [TSAN] Make tsan tests more portable (take 3)
Some tests didn't merge stderr with stdout.

Patch by Maxim Kuvyrkov.

llvm-svn: 266426
2016-04-15 12:34:00 +00:00
Renato Golin 37e64f352c Revert "Make tsan tests more portable (take 2)"
This reverts commit r266294, as it broke some buildbots again. :/

llvm-svn: 266300
2016-04-14 13:31:22 +00:00
Renato Golin 17b8b06252 Make tsan tests more portable (take 2)
Using stderr more uniformily, avoiding potential races when scanning stdout
and stderr output.

Patch by Maxim Kuvyrkov.

llvm-svn: 266294
2016-04-14 12:10:21 +00:00
Kuba Brecka 173c690a61 [tsan] Fix size reporting for OS X zone allocator with 0-sized allocations
The custom zone implementation for OS X must not return 0 (even for 0-sized allocations). Returning 0 indicates that the pointer doesn't belong to the zone. This can break existing applications. The underlaying allocator allocates 1 byte for 0-sized allocations anyway, so returning 1 in this case is okay.

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

llvm-svn: 266283
2016-04-14 09:05:19 +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
Betul Buyukkurt 785b5a8950 [PGO] Fix the buildbots for r266229.
llvm-svn: 266240
2016-04-13 20:02:07 +00:00
Evgeniy Stepanov 691ef096d0 [safestack] Fix stack canary test on Mac.
Disable FORTIFY_SOURCE and explicitly disable stack protector in the
no-stack-protector run.

llvm-svn: 266106
2016-04-12 18:48:41 +00:00
Evgeniy Stepanov ddb499a453 [safestack] A test for stackprotector canaries.
llvm-svn: 266006
2016-04-11 22:28:13 +00:00
Kuba Brecka 7b6f400090 [tsan] Replace 'not' with '%deflake' in gcd-apply-race.mm Darwin test.
llvm-svn: 265919
2016-04-11 08:38:35 +00:00
Evgeniy Stepanov eb37fcbc87 [sanitizer] Fix sem_init_glibc.cc test on __HAVE_64B_ATOMIC arches.
glibc can use one of 2 layouts for semaphores: architectures that
don't HAVE_64B_ATOMIC use an uint32_t field with semaphore value,
then a private field, then a waiting thread count field - this is
the layout currently assumed by the test. However, HAVE_64B_ATOMIC
arches use a fused uint64_t field that contains the value in low bits
and waiting thread count in high bits, followed by a private field.

This resulted in taking private field from the wrong offset on 64-bit
atomic platforms (the test still passed, but didn't actually test
the private field). On big-endian platforms, this resulted in a fail,
since the first 4 bytes overlay the thread count field, and not
the value field.

Found while porting ASan to s390x.

Patch by Marcin Kościelnicki.

llvm-svn: 265715
2016-04-07 20:26:28 +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
Kuba Brecka 79cb643b20 [tsan] Remove long sleeps from fork tests
On one of our testing machines, we're running the tests under heavy load, and especially in the fork-based TSan tests, we're seeing timeouts when a test uses sleep(10), assuming that calling fork() on another thread will finish sooner than that. This patch removes a timeout and makes another one longer.

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

llvm-svn: 265666
2016-04-07 12:10:28 +00:00
Kuba Brecka 74f7f399ac [tsan] Add support for OS X OSAtomic* functions
OS X provides atomic functions in libkern/OSAtomic.h. These provide atomic guarantees and they have alternatives which have barrier semantics. This patch adds proper TSan support for the functions from libkern/OSAtomic.h.

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

llvm-svn: 265665
2016-04-07 12:05:09 +00:00
Kuba Brecka 399af93242 [tsan] Add interceptors for dispatch_apply
Adding an interceptor with two more release+acquire pairs to avoid false positives with dispatch_apply.

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

llvm-svn: 265662
2016-04-07 11:52:51 +00:00
Kuba Brecka e316bb61b3 [tsan] Add XPC support (OS X)
XPC APIs have async callbacks, and we need some more happen-before edges to avoid false positives. This patch add them, plus a test case (sorry for the long boilerplate code, but XPC just needs all that).

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

llvm-svn: 265661
2016-04-07 11:47:11 +00:00
Kuba Brecka cecb7faea2 [tsan] Add support for dispatch event sources
GCD has APIs for event sources, we need some more release-acquire pairs to avoid false positives in TSan.

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

llvm-svn: 265660
2016-04-07 11:38:53 +00:00
Kuba Brecka 33c15c91a6 [tsan] Fix synchronization in dispatch_sync
In the interceptor for dispatch_sync, we're currently missing synchronization between the callback and the code *after* the call to dispatch_sync. This patch fixes this by adding an extra release+acquire pair to dispatch_sync() and similar APIs. Added a testcase.

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

llvm-svn: 265659
2016-04-07 11:33:44 +00:00
Kuba Brecka aafb41ae47 [tsan] Fix Darwin tests (missing FileCheck's)
A little embarrassing, but we're missing the call to FileCheck in several Darwin tests. Let's fix this.

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

llvm-svn: 265658
2016-04-07 11:31:02 +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
Sean Silva 9af25704d2 Another place for CMAKE_HOST_UNIX
If we don't create the target, don't try to add it as a dependency.

After r265595, we were only creating the SanitizerLintCheck when
`CMAKE_HOST_UNIX` was true.

CMake was emitting a warning:
  The dependency target "SanitizerLintCheck" of target "check-ubsan" does not
  exist.

llvm-svn: 265613
2016-04-06 23:18:09 +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
Vedant Kumar 62f0576c5c [profile] Remove quotes around env variable, NFC
llvm-svn: 264824
2016-03-30 04:36:10 +00:00
Vedant Kumar 989bc4bfd6 [profile] Test error reporting by writing to a temp directory
This test case is meant to check whether verbose error logging works. It
does this by _failing_ to write a profile to a path corresponding to a
directory. Make this clearer by writing to a temporary directory.

Patch suggested by Sean Silva!

llvm-svn: 264817
2016-03-30 01:30:47 +00:00
Sean Silva 2c6d2b3c5e [libprofile] Make this test express intent a bit better.
This also makes it work on PS4 a bit better.
For running the libprofile tests on PS4, we are sneaking environment
variables through on the command line, so the extra argument for
LLVM_PROFILE_FILE was messing up the simple `argc < 2` check.

llvm-svn: 264812
2016-03-30 00:25:15 +00:00
Xinliang David Li bd54f5bd25 Fix comment in test
llvm-svn: 264792
2016-03-29 21:53:08 +00:00
Vedant Kumar dcafeddfb7 [profile] Make a test work if run by the super-user
llvm-svn: 264773
2016-03-29 19:24: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
Sean Silva c9d546c291 [libprofile] Use one fewer -mllvm option in this test.
AFAIK there is still no way to avoid `-mllvm -disable-vp=false`
currently.

llvm-svn: 264682
2016-03-28 22:23:03 +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
Kuba Brecka 0d026d9e9e [tsan] Fix a crash when exiting the main thread (e.g. dispatch_main)
This patch fixes the custom ThreadState destruction on OS X to avoid crashing when dispatch_main calls pthread_exit which quits the main thread.

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

llvm-svn: 264627
2016-03-28 19:36:25 +00:00
Sean Silva 7434e1d01f [libprofile] Make this test not depend on previous runs.
llvm-svn: 264626
2016-03-28 19:34:22 +00:00
Sean Silva 7d27e77820 [libprofile] Make this test a bit more specific
llvm-svn: 264625
2016-03-28 19:25:19 +00:00