Commit Graph

1257 Commits

Author SHA1 Message Date
Vedant Kumar 43eec242e0 [asan] Relax a test which depends on optimized debug info
On some ARM platforms this test depends on debug locations being
present on constant materialization code, which was eliminated in
r335497.

Relax the test to allow two outcomes: the backtrace either contains the
right line numbers, or no line numbers.

llvm-svn: 335741
2018-06-27 14:57:59 +00:00
Kuba Mracek badaa15c88 [sanitizer] Unify and generalize Apple platforms in CMake and lit test configs
There's more platforms than just "ios" and "iossim" that we should support, and adding more lit config variables for each platform isn't great. Let's generalize and have a single value that determines what the platform under test is.

Differential Revision: https://reviews.llvm.org/D48309

llvm-svn: 335123
2018-06-20 13:33:42 +00:00
Reid Kleckner 3f573cab15 [asan] Add flushes to try to fix test
llvm-svn: 335089
2018-06-20 01:09:51 +00:00
Reid Kleckner b3ba1cc82a [asan] Add Windows test for handle_segv and SetUnhandledExceptionFilter
llvm-svn: 335087
2018-06-20 00:45:54 +00:00
Vitaly Buka b0a3e6f127 [asan] Enable fgets_fputs test on Android
"echo data" didn't work because %run on android executes test on the device
when lit shell command on the host system.

https://github.com/google/sanitizers/issues/952

llvm-svn: 334883
2018-06-16 04:01:08 +00:00
Vitaly Buka 572e442b6d [asan] Move long-object-path.cc test to Linux
Reviewers: Lekensteyn

Reviewed By: Lekensteyn

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D48186

llvm-svn: 334866
2018-06-15 21:25:42 +00:00
Peter Wu 4ff2d87f30 [ASAN] fix typos and disable long-object-path test for win32
Glob patterns seem unsupported for commands executed by the emulated
shell (LIT_USE_INTERNAL_SHELL=1). Disable the test while that is being
addressed (a workaround such as "cd a-*" also does not work).

llvm-svn: 334719
2018-06-14 15:12:46 +00:00
Peter Wu 1bbab1e558 [ASAN] fix startup crash in dlsym for long paths since glibc 2.27
Summary:
Error messages for dlsym used to be stored on the stack, but since
commit 2449ae7b ("ld.so: Introduce struct dl_exception") in glibc 2.27
these are now stored on the heap (and thus use the dlsym alloc pool).

Messages look like "undefined symbol: __isoc99_printf\0/path/to/a.out".
With many missing library functions and long object paths, the pool is
quickly exhausted. Implement a simple mechanism to return freed memory
to the pool (clear it in case it is used for calloc).

Fixes https://github.com/google/sanitizers/issues/957

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D47995

llvm-svn: 334703
2018-06-14 10:42:54 +00:00
Ahmed Bougacha 61631b1b8f [ASAN] Re-enable fgets_fputs test for darwin.
It seems to be passing, at least on the bots I've seen.

llvm-svn: 334626
2018-06-13 17:46:17 +00:00
Peter Wu fa60e6966c [ASAN] disable fgets_fputs test for android and darwin
aarch64/aosp_marlin-userdebug/OPR4.170623.016] builder unexpectedly
failed the fgets test (`assertion "fp" failed`). macOS unexpectedly
passes the fputs test without triggering ASAN.

llvm-svn: 334558
2018-06-12 23:05:03 +00:00
Peter Wu 14db2509ac [ASAN] fix fgets and fgets_fputs tests failure
Some systems (Android) might not have /etc/passwd. Fixes r334450.

llvm-svn: 334487
2018-06-12 09:27:18 +00:00
Peter Wu 1c05c95739 [sanitizer] Add fgets, fputs and puts into sanitizer_common
Summary:
Add fgets, fputs and puts to sanitizer_common. This adds ASAN coverage
for these functions, extends MSAN support from fgets to fputs/puts and
extends TSAN support from puts to fputs.

Fixes: https://github.com/google/sanitizers/issues/952

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D46545

llvm-svn: 334450
2018-06-11 22:58:04 +00:00
Alex Shlyapnikov 406385505d [Sanitizers] Move allocator_returns_null.cc test to common.
Summary:
Add allocator_returns_null.cc test to sanitizer_common and
remove all sanitizer-specific ones except:
- HWASan is not covered by sanitizer_common
- TSan allocator does not have comprehensive error reporting yet

Reviewers: vitalybuka

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D47971

llvm-svn: 334433
2018-06-11 19:45:59 +00:00
Alex Shlyapnikov 789494026e [Sanitizers] Move pvalloc overflow tests to common.
Summary:
Now all sanitizers with improved allocator error reporting are covered
by these common tests.

Also, add pvalloc-specific checks to LSan.

HWASan is not covered by sanitizer_common, hence its own pvalloc
and other allocator tests.

Reviewers: vitalybuka

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D47970

llvm-svn: 334424
2018-06-11 17:33:53 +00:00
Vitaly Buka 683e2d636d [asan] Re-enable no_asan_gen_globals for 32-bit
PR22682. Bug in gold was fixed 3 years ago.

llvm-svn: 334319
2018-06-08 21:04:44 +00:00
Alex Shlyapnikov dcf0097962 [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalign
Summary:
Move the corresponding tests to the common folder (as all of the
sanitizer allocators will support this feature soon) and add the checks
specific to aligned_alloc to ASan and LSan allocators.

Reviewers: vitalybuka

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D47924

llvm-svn: 334316
2018-06-08 20:40:35 +00:00
Yvan Roux 3b480d1858 [ASAN] Sanitize testsuite for ARM.
Address failures exhibited by ARMv8 bot in Thumb mode:

- Fix logic for fast unwinding support (i.e feature is not available for Thumb)
- Fix Unsupported and Requires rules to handle armv8 as well as soft and hard
  float targets
- Un-xfail passing tests

Differential Revision: https://reviews.llvm.org/D47575

llvm-svn: 333729
2018-06-01 06:23:36 +00:00
Kamil Rytarowski c7fe74576f Do not link with -ldl in NetBSD/ASan tests
Summary:
The dlopen(3) features on NetBSD are in libc.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D46713

llvm-svn: 332790
2018-05-19 01:02:51 +00:00
Dan Liew fe7250c2fa Fix another case where libstdc++ is being inappropriately requested (see
r328775) for all platforms.

Given that this is the second occurance of this problem it seemed worth
fixing this problem in a more generic way. r328775 has been reverted and
now a substitution `%linux_static_libstdcplusplus` has been provided.
This substitution expands to Clang driver arguments to use a static
libstdc++ on Linux and on all other platforms it expands to nothing.

The `asan/TestCases/throw_invoke_test.cc` and
`test/tsan/static_init6.cc` test cases now use this substitution.

rdar://problem/39948818

Differential Revision: https://reviews.llvm.org/D46401

llvm-svn: 332254
2018-05-14 15:48:49 +00:00
Reid Kleckner 824eb0e6a0 [asan] Align __asan_global_start so that it works with LLD
Otherwise LLD will not align the .ASAN$GA section start, and
&__asan_globals + 1 will not be the start of the next real ASan global
metadata in .ASAN$GL.

We discovered this issue when attempting to use LLD on Windows in
Chromium: https://crbug.com/837090

llvm-svn: 330990
2018-04-26 20:46:50 +00:00
Peter Collingbourne 7b17c9d05c asan: Mark printf-4.c as unsupported on Windows.
Although sprintf is not intercepted on Windows, this test can pass
if sprintf calls memmove, which is intercepted, so we can't XFAIL it.

Differential Revision: https://reviews.llvm.org/D45894

llvm-svn: 330469
2018-04-20 19:07:35 +00:00
Kuba Mracek 0fb14e944c [asan] Reduce flakiness in stack-overflow detection
IsStackOverflow only treats accesses within 512 bytes of SP as stack-overflow. This should really be the size of a page instead.

The scariness_score_test.cc triggers stack overflow with frames that are even larger than a page, which can also trigger a fault that will not be recognized as stack-overflow. Let's just use smaller frames.

llvm-svn: 329980
2018-04-13 00:29:24 +00:00
Simon Dardis dfee530748 [compiler-rt][asan][mips] UnXFAIL some consistently passing tests
llvm-svn: 329688
2018-04-10 11:09:17 +00:00
Kostya Kortchinsky 0716fb9376 [asan] Fix aligned_alloc test case
Summary:
Under some circumstances (that I haven't dug further into), the first stack
frame for the test looks like:
`#0 0x4e6038 in __interceptor_memalign.localalias.1 ...compiler-rt/lib/asan/asan_malloc_linux.cc:113`
which isn't matched by the current CHECK.

Expand the CHECK to match aligned_alloc or memalign. Hopefully this should fix
the PowerPC issue as well, otherwise we'll bring back the FIXME.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D45281

llvm-svn: 329226
2018-04-04 20:03:16 +00:00
Alex Shlyapnikov 0ee5a5577c [ASan] Disable new ASan error reporting tests on various ARMs.
As many other ASan tests already, has to disable these failing tests on
arm, armhf and aarch64 configs.

Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328849
2018-03-30 00:03:36 +00:00
Dan Liew 0f08dff1b5 [asan] Split the `throw_invoke_test.cc` into a Linux specific variant
and the general version to avoid use of libstdc++ on non-Linux
platforms.

This is motivated by the fact that using `libstdc++` is deprecated on
Darwin and maybe removed some day.

Differential Revision: https://reviews.llvm.org/D44733

llvm-svn: 328775
2018-03-29 13:53:50 +00:00
Alex Shlyapnikov b43b558012 [ASan] Disable aligned_alloc-alignment.cc on PPC64.
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328753
2018-03-29 02:18:57 +00:00
Alex Shlyapnikov 239533319f [ASan] Disable aligned_alloc-alignment.cc on ppc64be
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328742
2018-03-29 00:09:12 +00:00
Alex Shlyapnikov 5062d7a22d [ASan] Disable aligned_alloc-alignment.cc test on gcc.
This check "CHECK: {{#0 0x.* in .*aligned_alloc}}" fails on ppc64be, gcc
build. Disabling the test for gcc for now.

Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328741
2018-03-28 23:01:04 +00:00
Alex Shlyapnikov b276621d3d [ASan] Disable aligned_alloc-alignment.cc on Android.
Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328734
2018-03-28 22:00:08 +00:00
Alex Shlyapnikov 506b8388ed [ASan] Add aligned_alloc declaration to aligned_alloc-alignment.cc test.
aligned_alloc is not always defined in headers.

Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328726
2018-03-28 19:53:55 +00:00
Alex Shlyapnikov 10f50a44c1 [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ing
Summary:
Currently many allocator specific errors (OOM, for example) are reported as
a text message and CHECK(0) termination, not stack, no details, not too
helpful nor informative. To improve the situation, ASan detailed errors were
defined and reported under the appropriate conditions.

Issue: https://github.com/google/sanitizers/issues/887

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D44404

llvm-svn: 328722
2018-03-28 18:22:40 +00:00
Evgeniy Stepanov 7989d8da20 Revert "[asan] Replace vfork with fork."
Replacing vfork with fork results in significant slowdown of certain
apps (in particular, memcached).

This reverts r327752.

llvm-svn: 328600
2018-03-27 00:31:16 +00:00
Evgeniy Stepanov a4561123de [asan] Replace vfork with fork.
Summary:
vfork is not ASan-friendly because it modifies stack shadow in the
parent process address space. While it is possible to compensate for that with, for example,
__asan_handle_no_return before each call to _exit or execve and friends, simply replacing
vfork with fork looks like by far the easiest solution.

Posix compliant programs can not detect the difference between vfork and fork.

Fixes https://github.com/google/sanitizers/issues/925

Reviewers: kcc, vitalybuka

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D44587

llvm-svn: 327752
2018-03-16 22:15:05 +00:00
Evgeniy Stepanov c2e54761c9 [asan] poison_heap=0 should not disable __asan_handle_no_return.
Reviewers: kcc, alekseyshl, vitalybuka

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D44339

llvm-svn: 327337
2018-03-12 21:46:55 +00:00
Dan Liew 0c51c94b00 [asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc`
by explicitly listing where we expect this test to work.

Because this test invokes undefined behaviour all sorts of things
can happen (e.g. crash, or on some bots asan manages to catch
something). The test seems to pass okay on Darwin (x86_64/x86_64/i386)
and on Linux (x86_64/i386) so explicitly require one of these platforms
to run the test.

llvm-svn: 327185
2018-03-09 23:12:32 +00:00
Dan Liew 3aa75a7f9b [asan] Try to unbreak arm build bots by only running the test on
x86_64 and x86_64H (and not in the iOS simulator) where it seems
to work. We need to properly fix the test when time permits.

llvm-svn: 327122
2018-03-09 12:26:29 +00:00
Kuba Mracek ffb5014d9e Mark the -overlap tests are "UNSUPPORTED: android". Android test harness doesn't know how to handle suppression files.
llvm-svn: 327091
2018-03-09 00:41:29 +00:00
Kuba Mracek 08126e7eaa Mark strcat-overlap.cc as "UNSUPPORTED: win32"
llvm-svn: 327081
2018-03-09 00:03:09 +00:00
Kuba Mracek f9ee716299 Move lto-constmerge-odr.cc to Posix (it's failing on Windows).
llvm-svn: 327080
2018-03-08 23:53:29 +00:00
Dan Liew 0faaa99e4d [asan] Fix bug where suppression of overlapping accesses was ignored on
`strcpy()`, `strncpy()`, `strcat()`, and `strncat()`.

rdar://problem/35576899

Differential Revision: https://reviews.llvm.org/D43702

llvm-svn: 327068
2018-03-08 21:50:22 +00:00
Kuba Mracek e70e5fcc7e [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part, take 3]
This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example.

Differential Revision: https://reviews.llvm.org/D43959

llvm-svn: 327062
2018-03-08 21:02:52 +00:00
Kuba Mracek e3dfb9408a More revert of r327031
llvm-svn: 327038
2018-03-08 18:20:03 +00:00
Kuba Mracek 0fe43695e5 Revert r327031
llvm-svn: 327032
2018-03-08 17:31:31 +00:00
Kuba Mracek 653f94df53 [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part]
This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

Differential Revision: https://reviews.llvm.org/D43959

llvm-svn: 327031
2018-03-08 17:24:47 +00:00
Vitaly Buka 781ef03e10 [asan] Intercept std::rethrow_exception indirectly
Summary:
Fixes Bug 32434
See https://bugs.llvm.org/show_bug.cgi?id=32434

Short summary:
std::rethrow_exception does not use __cxa_throw to rethrow the exception, so if
it is called from uninstrumented code, it will leave the stack poisoned. This
can lead to false positives.

Long description:

For functions which don't return normally (e.g. via exceptions), asan needs to
unpoison the entire stack. It is not known before a call to such a function
where execution will continue, some function which don't contain cleanup code
like destructors might be skipped. After stack unwinding, execution might
continue in uninstrumented code.

If the stack has been poisoned before such a function is called, but the stack
is unwound during the unconventional return, then zombie redzones (entries) for
no longer existing stack variables can remain in the shadow memory. Normally,
this is avoided by asan generating a call to asan_handle_no_return before all
functions marked as [[noreturn]]. This asan_handle_no_return unpoisons the
entire stack. Since these [[noreturn]] functions can be called from
uninstrumented code, asan also introduces interceptor functions which call
asan_handle_no_return before running the original [[noreturn]] function;
for example, cxa_throw is intercepted.

If a [[noreturn]] function is called from uninstrumented code (so the stack is
left poisoned) and additionally, execution continues in uninstrumented code, new
stack variables might be introduced and overlap with the stack variables
which have been removed during stack unwinding. Since the redzones are not
cleared nor overwritten by uninstrumented code, they remain but now contain
invalid data.

Now, if the redzones are checked against the new stack variables, false
positive reports can occur. This can happen for example by the uninstrumented
code calling an intercepted function such as memcpy, or an instrumented
function.

Intercepting std::rethrow_exception directly is not easily possible since it
depends on the C++ standard library implementation (e.g. libcxx vs libstdc++)
and the mangled name it produces for this function. As a rather simple
workaround, we're intercepting _Unwind_RaiseException for libstdc++. For
libcxxabi, we can intercept the ABI function __cxa_rethrow_primary_exception.

Patch by Robert Schneider.

Reviewers: kcc, eugenis, alekseyshl, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42644

llvm-svn: 326132
2018-02-26 21:40:19 +00:00
Kuba Mracek 9967378eba [asan] Add "arm64" into the list of 64-bit architectures
It looks like get_bits_for_arch doesn't recognize "arm64" as a 64-bit architecture, and it actually matches the "arm" regexp, which marks it as 32-bit. Let's fix that by matching the 64-bit list first and addin "arm64" into the list.

Differential Revision: https://reviews.llvm.org/D43155

llvm-svn: 325300
2018-02-15 22:14:36 +00:00
Kamil Rytarowski 62b0c5bb88 Enable test/asan for NetBSD
Sponsored by <The NetBSD Foundation>

llvm-svn: 325246
2018-02-15 14:59:59 +00:00
Kuba Mracek f1ddefb55f Use NULL instead of nullptr in invalid-pointer-pairs-compare-null.cc; nullptr is not available on older Darwin systems.
llvm-svn: 324136
2018-02-02 20:42:29 +00:00
Kuba Mracek 66ce45150f [asan] Make concurrent_overflow.cc less flaky
The "sleep(5)" sometimes times out on our bots, causing the test to fail. Let's use pthread_join.

Differential Revision: https://reviews.llvm.org/D42862

llvm-svn: 324126
2018-02-02 19:49:24 +00:00
Alex Shlyapnikov 3c80f4d941 Make detect_invalid_pointer_pairs option to be tristate.
Summary:
With the change, one can choose not to report comparison (or subtraction)
of a pointer with nullptr pointer.

Reviewers: kcc, jakubjelinek, alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D41479

llvm-svn: 323995
2018-02-01 19:52:56 +00:00
Bill Seurer e76f2171f9 [PowerPC][asan] Fix asan tests to handle changed memory layouts
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
for powerpc64 changed causing the address sanitizer to not work properly. This
patch fixes up a test case that was found to fail on some newer Fedora
releases that use different address ranges.

ref: https://reviews.llvm.org/D40907
llvm-svn: 323217
2018-01-23 16:28:17 +00:00
Alex Shlyapnikov ac8217de83 Small fixes for detect_invalid_pointer_pairs.
Summary:
One test-case uses a wrong operation (should be subtraction).
Second test-case should declare a global variables before a tested one
in order to guarantee we will find a red-zone.

Reviewers: kcc, jakubjelinek, alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D41481

llvm-svn: 323162
2018-01-22 23:28:52 +00:00
Dan Liew 3fc243aea5 Force lit to execute the ASan and TSan tests on iOS devices
sequentially.

The current implementation of commands in
`test/sanitizer_common/ios_commands/` for iOS devices cannot be executed
in parallel which results in the ASan and TSan tests failing when
executed in parallel by lit which was the default behaviour.

We now force the ASan and TSan tests to be a new parallelism group named
`darwin-ios-device-sanitizer` which allows only one test to be run at a
time.  We also emit a warning informing the user that tests are being
run sequentially.

This only applies if the target is an iOS device.

Differential Revision: https://reviews.llvm.org/D42156

llvm-svn: 323026
2018-01-20 02:07:30 +00:00
Kamil Rytarowski 1628943978 Hotfix for test/asan/TestCases/alloca_constant_size.cc
Add missing endif.

llvm-svn: 322638
2018-01-17 12:32:17 +00:00
Kamil Rytarowski 3efd1c516c [Sanitizers, test] Fix sanitizer tests on Solaris (PR 33274)
Summary:
This patch (on top of the previous two (https://reviews.llvm.org/D40898 and
https://reviews.llvm.org/D40899) complete the compiler-rt side of the the Solaris
sanitizer port.

It contains the following sets of changes:

* For the time being, the port is for 32-bit x86 only, so reject the various tests on
  x86_64.

* When compiling as C++, <setjmp.h> resp. <iso/setjmp_iso.h> only declares
  _setjmp and _longjmp inside namespace std.

* MAP_FILE is a Windows feature.  While e.g. Linux <sys/mman.h> provides a
  no-op compat define, Solaris does not.

* test/asan/TestCases/Posix/coverage.cc was initially failing like this:

/vol/gcc/src/llvm/llvm/local/projects/compiler-rt/lib/sanitizer_common/scripts/sancov.py: 4 files merged; 2 PCs total
rm: cannot remove '/var/gcc/llvm/local/projects/compiler-rt/test/asan/I386SunOSConfig/TestCases/Posix/Output/coverage': Invalid argument

  Further digging revealed that the rm was trying to remove the running test's working
  directory which failed as observed.  cd'ing out of the dir before let the test pass.

* Two tests needed a declaration of alloca. I've now copied the existing code from
  test/asan/TestCases/alloca_constant_size.cc, but it may be more profitable and
  maintainable to have a common testsuite header where such code is collected.

* Similarly, Solaris' printf %p format doesn't include the leading 0x.

* In test/asan/TestCases/malloc-no-intercept.c, I had to undef __EXTENSIONS__
  (predefined by clang for no apparent reason) to avoid conflicting declarations
  for memalign.

* test/ubsan/TestCases/Float/cast-overflow.cpp has different platform dependent
  ways to define BYTE_ORDER and friends.  Why not just use __BYTE_ORDER__ and
  friends as predefined by clang and gcc?

Patch by Rainer Orth.

Reviewers: kcc, alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, kubamracek, mgorny, krytarowski, fedor.sergeev, JDevlieghere, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D40900

llvm-svn: 322635
2018-01-17 12:26:04 +00:00
Azharuddin Mohammed febd5e3e37 [cmake] Fix typo in test/asan/CMakeLists.txt
Summary:
[cmake] Fix typo in test/asan/CMakeLists.txt

Should be variable name instead of variable reference.

Reviewers: samsonov, rnk, smeenai, beanz

Reviewed By: smeenai

Subscribers: kubamracek, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D41214

llvm-svn: 321760
2018-01-03 21:29:49 +00:00
Alex Shlyapnikov 50c342bf3f [Sanitizers] Export aligned new/delete from runtimes.
Summary:
Export aligned new/delete to make dynamic runtimes work again.

Remove all valid new/delete cases from ASan test, there's a test in
common for that.

Reviewers: eugenis

Subscribers: srhines, kubamracek, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D41548

llvm-svn: 321394
2017-12-23 00:30:51 +00:00
Maxim Ostapenko de74bdb3d2 [asan] Add interceptor for printf_chk
There could be a situation when a specific DSO was built with FORTIFY_SOURCE option. In case asan-ed binary link against that DSO,
libasan can't handle the possible memory error because it does not have interceptors for spinrtf_chk, snprintf_chk, vprintf_chk,
vsnprintf_chk, __fprintf_chk functions. Let's interceptors for them.

Patch by Denis Khalikov.

Differential Revision: https://reviews.llvm.org/D40951

llvm-svn: 320990
2017-12-18 15:31:26 +00:00
Ahmed Bougacha 7008c6bc03 Update another sanitizer test for C++14.
Follow-up to r320251.

llvm-svn: 320284
2017-12-10 05:50:23 +00:00
Tim Northover ad850f83ee Update sanitizer tests for C++14 default in Clang
llvm-svn: 320251
2017-12-09 13:35:52 +00:00
Bill Seurer c776a9f5a8 [PowerPC][asan] Update asan to handle changed memory layouts in newer kernels
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
for powerpc64 changed causing the address sanitizer to not work properly. This
patch adds support for 47 bit VMA kernels for powerpc64 and fixes up test
cases.

https://reviews.llvm.org/D40908

There is an associated patch for trunk.

Tested on several 4.x and 3.x kernel releases.

llvm-svn: 320110
2017-12-07 22:53:49 +00:00
Alex Shlyapnikov 9842821461 [ASan] Disable invalid-pointer-pairs-threads.cc on Darwin.
pthread barriers are not available on OS X

Differential revision: https://reviews.llvm.org/D40600

llvm-svn: 319681
2017-12-04 19:40:39 +00:00
Alex Shlyapnikov ebbbf0eb8c [ASan] Fix test/asan/TestCases/Posix/invalid-pointer-pairs-threads.cc
Explicitly add pthread for asan-dynamic config.

Differential revision: https://reviews.llvm.org/D40600

llvm-svn: 319671
2017-12-04 18:35:25 +00:00
Alex Shlyapnikov c73d1e28f1 [ASan] Enhance libsanitizer support for invalid-pointer-pair.
Following patch adds support of all memory origins in
CheckForInvalidPointerPair function. For small difference of pointers,
it's directly done in shadow memory (the limit was set to 2048B).
Then we search for origin of first pointer and verify that the second
one has the same origin. If so, we verify that it points either to a same
variable (in case of stack memory or a global variable), or to a same
heap segment.

Committing on behanf of marxin and jakubjelinek.

Reviewers: alekseyshl, kcc

Subscribers: llvm-commits

Differential revision: https://reviews.llvm.org/D40600

llvm-svn: 319668
2017-12-04 18:00:24 +00:00
Roman Lebedev d45054dbd2 [ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.

This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.

I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.

Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.

Please review carefully, i have not worked with lit/sanitizer tests before.

The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc

Differential Revision: https://reviews.llvm.org/D39508

llvm-svn: 319575
2017-12-01 19:36:29 +00:00
Ismail Donmez b8dd5078ee Add missing signal.h header:
/havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:20: error: variable has incomplete type 'struct sigaction'
  struct sigaction act = {};
                   ^
/havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:10: note: forward declaration of 'sigaction'
  struct sigaction act = {};
         ^
/havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:160:17: error: use of undeclared identifier 'SIGPROF'
  if (sigaction(SIGPROF, &act, 0)) {
                ^
2 errors generated.

llvm-svn: 319532
2017-12-01 11:12:58 +00:00
Roman Lebedev 85653e3db9 Revert "[ubsan] lit changes for lld testing, future lto testing."
This reverts commit r319525.

This change has introduced a problem with the Lit tests build for compiler-rt using Gold: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/6047/steps/test%20standalone%20compiler-rt/logs/stdio

llvm-lit: /b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg', traceback: Traceback (most recent call last):
  File "/b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path
    exec(compile(data, path, 'exec'), cfg_globals, None)
  File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 37, in <module>
    if root.host_os not in ['Linux'] or not is_gold_linker_available():
  File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 27, in is_gold_linker_available
    stderr = subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
llvm-svn: 319529
2017-12-01 10:09:27 +00:00
Roman Lebedev 0d044dc090 [ubsan] lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.

This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.

I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.

Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.

Please review carefully, i have not worked with lit/sanitizer tests before.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc

Differential Revision: https://reviews.llvm.org/D39508

llvm-svn: 319525
2017-12-01 08:38:25 +00:00
Kuba Mracek ceea5466eb [sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib from DYLD_INSERT_LIBRARIES
On macOS, we usually don't require launching the target with DYLD_INSERT_LIBRARIES anymore. However, it is still necessary when running a target that is not instrumented (and e.g. dlopen's an instrument library later). In any case, ASan and TSan currently remove themselves from the DYLD_INSERT_LIBRARIES environment variable to avoid passing it onto children. This works well e.g. when instrumenting a shell. A problem arises when the target is a non-instrumented shim (e.g. "xcrun") that either re-execs or launches a child that is supposed to get DYLD_INSERT_LIBRARIES propagated. To support this mode, this patch introduces 'strip_env' flag that can be used to keep DYLD_INSERT_LIBRARIES untouched.

Differential Revision: https://reviews.llvm.org/D39991

llvm-svn: 319365
2017-11-29 21:42:48 +00:00
Kuba Mracek e73d1f13b6 [asan] Don't crash on fclose(NULL)
It's explicitly forbidden to call fclose with NULL, but at least on Darwin, this succeeds and doesn't segfault. To maintain binary compatibility, ASan should survice fclose(NULL) as well.

Differential Revision: https://reviews.llvm.org/D40053

llvm-svn: 319347
2017-11-29 19:43:11 +00:00
Kuba Mracek 21e6efcb51 [asan] Allow getpwnam(NULL) for binary compatibility
Calling getpwnam(NULL) is probably a bug, but at least on Darwin, such a call succeeds without segfaulting. I have some existing code that relies on that. To maintain binary compatibility, ASan should also survive a call to getpwnam with NULL.

Differential Revision: https://reviews.llvm.org/D40052

llvm-svn: 319344
2017-11-29 19:33:35 +00:00
Peter Collingbourne dd01ddbe67 Enable PDB generation with lld in asan and cfi tests on Windows.
PDB emission now works well enough that we can rely on it for these
tests to pass.

Differential Revision: https://reviews.llvm.org/D40188

llvm-svn: 318546
2017-11-17 19:49:41 +00:00
Walter Lee 513fc069f0 [asan] Properly mark or disable tests that only work with shadow scale of 3
Differential Revision: https://reviews.llvm.org/D39774

llvm-svn: 318471
2017-11-16 23:29:19 +00:00
Walter Lee 00b4931d5d [asan] Port tests to shadow scale of 5
The tests are ported as follows:

contiguous_container_crash.cc
use-after-delete.cc
use-after-free.cc
  Replace hardwired shadow granularity in CHECK statements with regex.

max_redzone.cc
  Bump max_redzone parameter to 32.

memset_test.cc
  Bump size parameter of __asan_poison_memory_region to 32.

scariness_score_test.cc
  For "far-from-bounds" heap overflow, make sure overflow is more than
  one shadow granularity away.

  At large shadow granularity, there is not enough redzone between
  stack elements to detect far-from-bounds, so fake out that test.

Differential Revision: https://reviews.llvm.org/D39773

llvm-svn: 318470
2017-11-16 23:28:50 +00:00
Teresa Johnson 179b8fbba6 Revert new ThinLTO ASAN test until lit support added
This reverts commit r317723 and r317728. Will be re-added when
support for LTO/ThinLTO added to test/asan/lit.cfg.

llvm-svn: 317823
2017-11-09 19:26:54 +00:00
Teresa Johnson c707c6f3a7 [ThinLTO] New test needs to require LTO
Fix buildbot failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/5262/steps/annotate/logs/stdio

llvm-svn: 317728
2017-11-08 21:48:27 +00:00
Teresa Johnson edf782f0d0 [ThinLTO] Ensure sanitizer passes are run
Recommit new test as linux-only.

llvm-svn: 317723
2017-11-08 20:27:28 +00:00
Teresa Johnson 67a781c4fc Revert "[ThinLTO] Ensure sanitizer passes are run"
This reverts commit r317715. It failed a Windows buildbot since
ThinLTO is presumably not supported, leading to a corrupt file error
on the object file:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19395/steps/run%20check-asan/logs/stdio

Will re-commit the new ThinLTO part of the test to a linux only test
file.

llvm-svn: 317717
2017-11-08 20:08:15 +00:00
Teresa Johnson 0cfd530b2b [ThinLTO] Ensure sanitizer passes are run
Summary:
Test fix to pass manager for ThinLTO.

Depends on D39565.

Reviewers: pcc

Subscribers: kubamracek, mehdi_amini, llvm-commits, inglorion

Differential Revision: https://reviews.llvm.org/D39566

llvm-svn: 317715
2017-11-08 19:46:25 +00:00
Alex Shlyapnikov a53b55f66c [Sanitizers] ASan: detect new/delete calls with mismatched alignment.
ASan allocator stores the requested alignment for new and new[] calls
and on delete and delete[] verifies that alignments do match.

The representable alignments are: default alignment, 8, 16, 32, 64, 128,
256 and 512 bytes. Alignments > 512 are stored as 512, hence two
different alignments > 512 will pass the check (possibly masking the bug),
but limited memory requirements deemed to be a resonable tradeoff for
relaxed conditions.

The feature is controlled by new_delete_type_mismatch flag, the same one
protecting new/delete matching size check.

Differential revision: https://reviews.llvm.org/D38574

Issue: https://github.com/google/sanitizers/issues/799
llvm-svn: 316595
2017-10-25 17:21:37 +00:00
Alex Shlyapnikov 028c4cddad [Sanitizers] New sanitizer API to purge allocator quarantine.
Summary:
Purging allocator quarantine and returning memory to OS might be desired
between fuzzer iterations since, most likely, the quarantine is not
going to catch bugs in the code under fuzz, but reducing RSS might
significantly prolong the fuzzing session.

Reviewers: cryptoad

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D39153

llvm-svn: 316347
2017-10-23 17:12:07 +00:00
Evgeniy Stepanov 0bf7717a02 Factor out "stable-runtime" feature and enable it on all android.
This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan
seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android.

llvm-svn: 315389
2017-10-10 23:37:26 +00:00
Evgeniy Stepanov 0a4217c14b Factor out default_(a|ub)sanitizer_opts in lit.
Reviewers: vitalybuka

Subscribers: srhines, llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D38644

llvm-svn: 315106
2017-10-06 20:53:40 +00:00
Evgeniy Stepanov 3b87cc910e [sanitizer] Move %ld_flags_rpath_exe to common and use it in more tests.
Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D38527

llvm-svn: 315010
2017-10-05 20:00:07 +00:00
Dmitry Mikulin d2224e17c3 ASan allocates a global data initialization array at the tail end of each
compunit's .data section. This vector is not poisoned. Because of this the
first symbol of the following section has no left red zone. As a result, ASan
cannot detect underflow for such symbols.

Poison ASan allocated metadata, it should not be accessible to user code.

This fix does not eliminate the problem with missing left red zones but it
reduces the set of vulnerable symbols from first symbols in each input data
section to first symbols in the output section of the binary.

Differential Revision: https://reviews.llvm.org/D38056

llvm-svn: 314365
2017-09-27 23:32:01 +00:00
Simon Dardis 5a14bc84e1 [mips][asan] Fix preinstalled_signal.cc test for mips
Linux for mips has a non-standard layout for the kernel sigaction struct.
Adjust the layout by the minimally amount to get the test to pass, as we
don't require the usage of the restorer function.

llvm-svn: 314200
2017-09-26 11:49:04 +00:00
Maxim Ostapenko d0d900d850 [asan/lsan] Trying to fix PPC64 and x380x buildbots after r313966
llvm-svn: 313974
2017-09-22 10:44:28 +00:00
Maxim Ostapenko c1f0b0ecab [asan/lsan] Trying to fix buildbots after r313966
llvm-svn: 313967
2017-09-22 08:23:16 +00:00
Maxim Ostapenko 9d016b773b [asan/lsan] Make LSan compliant with recovery mode when running on top of ASan
Don't overwrite exit code in LSan when running on top of ASan in recovery mode
to avoid breakage of users code due to found leaks.

Patch by Slava Barinov.

Differential Revision: https://reviews.llvm.org/D38026

llvm-svn: 313966
2017-09-22 07:11:43 +00:00
Vitaly Buka 08706542e9 [asan] Remove trailing spaces
llvm-svn: 313845
2017-09-21 00:14:17 +00:00
Vitaly Buka d0d025ef62 [asan] Remove "COLLISION" workaround for datarace in asan
"nested bug in the same thread" is not expected in case like this and was caused
by https://github.com/google/sanitizers/issues/858

llvm-svn: 313844
2017-09-21 00:11:30 +00:00
Vitaly Buka d7f0361ab1 [asan] Remove "rm -f" in tests where it was needed only because of >>
llvm-svn: 313843
2017-09-21 00:06:08 +00:00
Vitaly Buka 3191a2ac1f [asan] Fix nested error detection
Summary: Fixes https://github.com/google/sanitizers/issues/858

Reviewers: eugenis, dvyukov

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D38019

llvm-svn: 313835
2017-09-20 23:27:38 +00:00
Vitaly Buka 8a65209d0b [asan] Try to fix windows test by fflush(stderr)
llvm-svn: 313728
2017-09-20 07:16:08 +00:00
Vitaly Buka cf096c2af3 [asan] Resolve FIXME by converting gtest into lit test
llvm-svn: 313727
2017-09-20 07:01:19 +00:00
Vitaly Buka a4f62c62d3 [ubsan] Fix interface_symbols_windows test
Summary:
1. Update ubsan_interface.inc to make the test happy.
2. Switch interface_symbols_linux and interface_symbols_darwin to C++ to import __ubsan_handle_dynamic_type_cache_miss
3. Switch interface_symbols_windows to C++ for consistency.

Reviewers: rnk, zturner

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D37986

llvm-svn: 313551
2017-09-18 18:46:19 +00:00
Kuba Mracek 8db966a097 Mark various failing tests with "UNSUPPORTED: ios".
llvm-svn: 313498
2017-09-17 20:00:43 +00:00
Vitaly Buka cd2d9a6b98 [sanitizer] Support check-asan on Android
This patch enabled asan tests from sanitizer_common.

llvm-svn: 313444
2017-09-16 05:14:05 +00:00
Vitaly Buka 0dc3ef3734 [sanitizer] Move android_commoands from asan into sanitizer_common
llvm-svn: 313443
2017-09-16 05:13:56 +00:00
Vitaly Buka 20d78186c2 [asan] Remove not-android
Replaced with !android

llvm-svn: 313440
2017-09-16 03:41:16 +00:00
Vitaly Buka 581fbc61b2 [asan] Enable asan_and_llvm_coverage_test.cc on Android
Test just needs profile.

llvm-svn: 313438
2017-09-16 03:26:03 +00:00
Vitaly Buka 2cda290ec8 [asan] Disable two dynamic tests on armhf
This is not an regression. Tests are old and we just recently started to
run them on bots with dynamic runtime.

llvm-svn: 313283
2017-09-14 18:19:28 +00:00
Vitaly Buka ecc44ecdbc [compiler-rt] Move dump_instruction_bytes and dump_registers into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D37766

llvm-svn: 313117
2017-09-13 06:24:59 +00:00
Vitaly Buka 87d1f9ce93 [asan] Include asan-dynamic into check-all
Summary: It's adds just 1k to about 45k tests.

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D37666

llvm-svn: 312937
2017-09-11 19:41:17 +00:00
Vitaly Buka f8e944121e [asan] Fix tests broken by r312858
llvm-svn: 312872
2017-09-09 20:07:45 +00:00
Vitaly Buka b4f2d13dc6 [compiler-rt] Move allow_user_segv.cc into sanitizer_common
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis

Subscribers: kubamracek, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D37537

llvm-svn: 312859
2017-09-09 06:04:23 +00:00
Vitaly Buka e7e7194a73 [asan] Use more generic string in error message
Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D37609

llvm-svn: 312858
2017-09-09 05:58:52 +00:00
Kamil Rytarowski d92f3982ce Finalize ASAN/NetBSD
Summary:
This revision contains various cleanups.

Sponsored by <The NetBSD Foundation>

Reviewers: kcc, vitalybuka, joerg, eugenis

Reviewed By: kcc

Subscribers: emaste, srhines, llvm-commits, kubamracek, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D37244

llvm-svn: 312188
2017-08-30 23:02:36 +00:00
Matt Morehouse 034126e507 [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Only enable on Linux.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D37156

llvm-svn: 312185
2017-08-30 22:49:31 +00:00
Vitaly Buka 07196d3145 [asan] Add use-after-scope test which fails because of bug in clang
Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D37242

llvm-svn: 312039
2017-08-29 21:23:44 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

Differential Revision: https://reviews.llvm.org/D26764

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
Michal Gorny 7298595a2c Revert r311842 - [cmake] Remove i686 target that is duplicate to i386
The required change in clang is being reverted because of the Android
build bot failure.

llvm-svn: 311859
2017-08-27 20:37:06 +00:00
Michal Gorny 34ca7168ae [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

Differential Revision: https://reviews.llvm.org/D26764

llvm-svn: 311842
2017-08-27 07:44:41 +00:00
Hans Wennborg c7d8b01774 Mark allocator_oom_test.cc unsupported on arm & aarch64 (PR33972)
The buildbots don't seem to like it.

llvm-svn: 311674
2017-08-24 17:00:36 +00:00
Kuba Mracek b17fd11e09 Remove "%T" from ASan Darwin tests.
llvm-svn: 311298
2017-08-20 18:31:00 +00:00
Kuba Mracek ac102b6977 [asan] Make dump_registers.cc more stable
Differential Revision: https://reviews.llvm.org/D36231

llvm-svn: 310273
2017-08-07 18:12:01 +00:00
Kostya Kortchinsky a53de0bf0f [asan] Fix unsupported test on Android
Summary:
`pvalloc` appears to not be available on Android. Mark the failing test as
unsupported on that platform.

Reviewers: alekseyshl, vitalybuka

Reviewed By: alekseyshl, vitalybuka

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D36339

llvm-svn: 310133
2017-08-04 21:26:20 +00:00
Kostya Kortchinsky d7d1681a0e [asan] Check for pvalloc overlow
Summary:
Last one of the `pvalloc` overflow checks!

`CheckForPvallocOverflow` was introduced with D35818 to detect when `pvalloc`
would wrap when rounding up to the next multiple of the page size.

Add this check to ASan's `pvalloc` implementation.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D36257

llvm-svn: 310119
2017-08-04 20:28:59 +00:00
Kostya Serebryany 1ca948a2b4 Add new ASAN_OPTION: sleep_after_init.
Summary: As mentioned in https://github.com/google/sanitizers/issues/834, suggested option can be handy for debugging.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D35409

llvm-svn: 309854
2017-08-02 18:48:45 +00:00
Evgeniy Stepanov 6ff4412375 [sancov] Fix coverage-reset test on Android/i686.
DSO coverage may be dumped in any order.

llvm-svn: 309639
2017-07-31 23:08:27 +00:00
Reid Kleckner 3bcad2b2e6 Try to fix asan test on sanitizer-windows
llvm-svn: 309440
2017-07-28 21:43:23 +00:00
Matt Morehouse 74ddba0c95 Add end-to-end tests for overflows of byval arguments.
Summary:
Included is one test for passing structs by value and one test for
passing C++
objects by value.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34827

llvm-svn: 309424
2017-07-28 19:52:31 +00:00
Evgeniy Stepanov fea50c286a [sancov] Add missing line breaks in test. NFC.
llvm-svn: 309339
2017-07-28 00:22:42 +00:00
Evgeniy Stepanov 59b5e9c00c [sancov] Implement __sanitizer_cov_reset.
Summary: Clears all collected coverage.

Reviewers: kcc

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D35958

llvm-svn: 309333
2017-07-27 23:22:37 +00:00
George Karpenkov b87543c704 Prefer atos to llvm-symbolizer on Darwin
atos is the default symbolizer on Apple's compiler for quite a few years now.
llvm-symbolizer is quite fragile on Darwin: for example, unless a .dSYM
file was explicitly generated symbolication would not work.
It is also very convenient when the behavior of LLVM open source
compiler matches to that of Apple's compiler on Apple's platform.
Furthermore, llvm-symbolizer is not installed on Apple's platform by
default, which leads to strange behavior during debugging: the test
might fail under lit (where it has llvm-symbolizer) but would run
properly when launched on the command line (where it does not, and atos
would be used).

Indeed, there's a downside: atos does not work properly with inlined
functions, hence the test change.
We do not think that this is a major problem, as users would often
compile with -O0 when debugging, and in any case it is preferable to
symbolizer not being able to symbolize.

Differential Revision: https://reviews.llvm.org/D35745

llvm-svn: 308908
2017-07-24 18:24:08 +00:00
Vitaly Buka 1eb9595c53 [asan] Update unittest for changes in logging r308637
llvm-svn: 308647
2017-07-20 18:20:12 +00:00
Vitaly Buka 923ddad4c6 [asan] Disable not working new test on Windows
llvm-svn: 308123
2017-07-16 01:28:40 +00:00
Alex Shlyapnikov 31e8173c94 [Sanitizers] ASan and LSan allocator set errno on failure.
Summary:
Set proper errno code on alloction failures and change some
implementations to satisfy their man-specified requirements:

LSan: valloc and memalign
ASan: pvalloc, memalign and posix_memalign

Changing both allocators in one patch since LSan depends on ASan allocator in some configurations.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D35440

llvm-svn: 308064
2017-07-14 22:23:47 +00:00
Vitaly Buka 9fd492e71e [asan] Avoid recompilation of the same code in the test
llvm-svn: 307868
2017-07-12 23:59:22 +00:00
Kuba Mracek 7004b7cf0d Add explicit CMake targets for ASan/TSan iOS Simulator testing and update the instructions how to run them.
llvm-svn: 307844
2017-07-12 21:02:48 +00:00
Evgeniy Stepanov 7d3eeaaa96 Revert r307342, r307343.
Revert "Copy arguments passed by value into explicit allocas for ASan."
Revert "[asan] Add end-to-end tests for overflows of byval arguments."

Build failure on lldb-x86_64-ubuntu-14.04-buildserver.
Test failure on clang-cmake-aarch64-42vma and sanitizer-x86_64-linux-android.

llvm-svn: 307345
2017-07-07 01:31:23 +00:00
Evgeniy Stepanov 03542db81c [asan] Add end-to-end tests for overflows of byval arguments.
Included is one test for passing structs by value and one test for passing C++
objects by value.

Patch by Matt Morehouse.

Differential revision: https://reviews.llvm.org/D34827

llvm-svn: 307343
2017-07-07 00:48:38 +00:00
Vitaly Buka 080118351b [asan] This Android lit workaround should not be needed as bug is fixed
llvm-svn: 306942
2017-07-01 04:23:47 +00:00
Vitaly Buka d29d3da349 [asan] Fix test on Android i686/fugu
printf from .preinit_array may crash.

llvm-svn: 306940
2017-07-01 03:54:19 +00:00
Vitaly Buka c1c17833ff [asan] Disable test which fails on Android x86
Other Android CPUs probably pass just by luck as ulimit was not executed.

llvm-svn: 306914
2017-06-30 23:47:03 +00:00
Kuba Mracek c41ba09433 [objc] Don't require null-check and don't emit memset when result is ignored for struct-returning method calls [compiler-rt part]
This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer.

Differential Revision: https://reviews.llvm.org/D34834

llvm-svn: 306838
2017-06-30 16:29:43 +00:00
Vitaly Buka 1631129834 Revert "[asan] Control location of symbolizer on device using ANDROID_SYMBOLIZER_PATH"
Not needed, I am going to put symbolizer into tests dir.

This reverts commit r306627.

llvm-svn: 306630
2017-06-29 02:48:06 +00:00
Vitaly Buka 72c24da063 [asan] Control location of symbolizer on device using ANDROID_SYMBOLIZER_PATH
llvm-svn: 306627
2017-06-29 01:04:32 +00:00
Vitaly Buka 2af2fd5f76 [asan] Fix try to fix test on Android
%T is dir on host system, device does not have it

llvm-svn: 306621
2017-06-29 00:19:29 +00:00
Vitaly Buka 0c981cf69b [asan] Disable tests which do no work on Android
llvm-svn: 306620
2017-06-29 00:19:28 +00:00
Vitaly Buka 3681a55137 [asan] This test now passes
llvm-svn: 306619
2017-06-29 00:19:27 +00:00
Alex Shlyapnikov 4b450685d3 [Sanitizers] Operator new() interceptors always die on allocation error
Summary:
Operator new interceptors behavior is now controlled by their nothrow
property as well as by allocator_may_return_null flag value:

- allocator_may_return_null=* + new()        - die on allocation error
- allocator_may_return_null=0 + new(nothrow) - die on allocation error
- allocator_may_return_null=1 + new(nothrow) - return null

Ideally new() should throw std::bad_alloc exception, but that is not
trivial to achieve, hence TODO.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34731

llvm-svn: 306604
2017-06-28 21:58:57 +00:00
Kuba Mracek ce65982ea1 Revert r306504: Re-enable wait.cc, wait4.cc, waitid.cc tests on Darwin.
llvm-svn: 306551
2017-06-28 15:13:09 +00:00
Kuba Mracek 70e8e9d8f6 Re-enable wait.cc, wait4.cc, waitid.cc tests on Darwin. They used to be flaky, something to do with LeakSanitizer now being enabled on Darwin. Let's re-enable them and see if they are still flaky or not.
llvm-svn: 306504
2017-06-28 05:03:28 +00:00
Kuba Mracek 495371d6df [asan] Flag 'asan_gen_prefixes.cc' as unsupported on iOS. The ARM and ARM64 assemblers can use different label prefixes than the expected.
llvm-svn: 306335
2017-06-26 21:37:40 +00:00
Vitaly Buka b768d5b863 [asan] Regression test for PR33372
Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34315

llvm-svn: 306195
2017-06-24 01:40:41 +00:00
Vitaly Buka ff7b8ea2a0 Revert "[compiler-rt] Don't reset non-default user handler if allow_user_segv_handler is true."
Summary:
On Android we still need to reset preinstalled handlers and allow use handlers later.

This reverts commit r304039.

Reviewers: eugenis

Subscribers: kubamracek, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D34434

llvm-svn: 305871
2017-06-21 01:10:23 +00:00
Evgeniy Stepanov 827cd74618 [asan] Fix android compiler wrapper lost in r301617.
llvm-svn: 305870
2017-06-21 00:56:31 +00:00
Alex Shlyapnikov a26d10802b [ASan] Disable allocator_oom_test.cc on s390
Summary:
ASan shadow memory on s390 is larger than other configurations, let's
disable this test for now (will revisit it later).

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34414

llvm-svn: 305822
2017-06-20 19:16:41 +00:00
Alex Shlyapnikov d340605a37 [Sanitizers] Fix allocator OOM test on Windows.
Summary:
Point of failure is different after D34243, hence the change of the
message.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D34292

llvm-svn: 305580
2017-06-16 20:36:39 +00:00
Alex Shlyapnikov 9092fe6f4b [Sanitizers] Secondary allocator respects allocator_may_return_null=1.
Summary:
Context: https://github.com/google/sanitizers/issues/740.

Making secondary allocator to respect allocator_may_return_null=1 flag
and return nullptr when "out of memory" happens.

More changes in primary allocator and operator new will follow.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34243

llvm-svn: 305569
2017-06-16 18:48:08 +00:00
Vitaly Buka 7901b47094 [asan] Return allow_user_segv_handler=0 to fix compatibility issues.
Summary:
After r303941 it was not possible to setup ASAN_OPTIONS to have the same
behavior for pre r303941 and post r303941 builds.
Pre r303941 Asan does not accept handle_sigbus=2.
Post r303941 Asan does not accept allow_user_segv_handler.

This fix ignores allow_user_segv_handler=1, but for allow_user_segv_handler=0
it will upgrade flags like handle_sigbus=1 to handle_sigbus=2. So user can set
ASAN_OPTIONS=allow_user_segv_handler=0 and have same behavior on old and new
clang builds (except range from r303941 to this revision).

In future users which need to prevent third party handlers should switch to
handle_sigbus=2 and remove allow_user_segv_handler as soon as suport of older
builds is not needed.

Related bugs:
  https://github.com/google/oss-fuzz/issues/675
  https://bugs.chromium.org/p/chromium/issues/detail?id=731130

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D34227

llvm-svn: 305433
2017-06-15 00:19:13 +00:00
Maxim Ostapenko d8c47ca836 [asan] Fix ASan internal failure in AllocateFromLocalPool
This patch addresses PR 33206. There might be a situation when dynamic ASan runtime initializes later
than shared library which has malloc in static constructor (rtld doesn't provide an order of shared libs initialization).
In this case ASan hasn't yet initialized interceptors, but already intercepts malloc.
If malloc is too big to be handled by static local pool, ASan will die with error: 
Sanitizer CHECK failed: lib/asan/asan_malloc_linux.cc:40 ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (1036, 1024)

Patch by Denis Khalikov.

Differential Revision: https://reviews.llvm.org/D33784

llvm-svn: 305058
2017-06-09 07:47:38 +00:00
Alex Shlyapnikov effb794346 [ASan] A speculative attempt to fix a flaky test on ppc64be.
Summary:
As mentioned in test/msan/fork.cc, if test output is redirected to a file
(as opposed to being piped directly to FileCheck), we may lose some "done"s due to
a kernel bug: https://lkml.org/lkml/2014/2/17/324, so let's pipe the
output of the test.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D33915

llvm-svn: 304744
2017-06-05 22:23:15 +00:00
Alex Shlyapnikov abe8af9fac [asan] Use asan exitcode=0 option to always succeed a test run.
Summary:
halt_on_error-torture.cc intermittently fails on ppc64be, let's try to
collect more info on failures.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D33912

llvm-svn: 304731
2017-06-05 20:36:57 +00:00
Vedant Kumar 921e4ddbad Mark the atos-symbolizer test as unsupported on i386-darwin
atos is apparently not able to resolve symbol addresses properly on
i386-darwin reliably any more. This is causing bot flakiness:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/6841

There have not been any SDK changes on the bot as of late.

/Users/buildslave/jenkins/sharedspace/clang-stage1-cmake-RA_workspace/llvm/projects/compiler-rt/test/asan/TestCases/Darwin/atos-symbolizer.cc:20:12: error: expected string not found in input
 // CHECK: #1 0x{{.*}} in main {{.*}}atos-symbolizer.cc:[[@LINE-4]]
           ^
<stdin>:35:27: note: scanning from here
 #0 0x112f56 in wrap_free (/Users/buildslave/jenkins/sharedspace/clang-stage1-cmake-RA_workspace/clang-build/lib/clang/5.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:i386+0x56f56)
                          ^
<stdin>:35:27: note: with expression "@LINE-4" equal to "16"
 #0 0x112f56 in wrap_free (/Users/buildslave/jenkins/sharedspace/clang-stage1-cmake-RA_workspace/clang-build/lib/clang/5.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:i386+0x56f56)
                          ^
<stdin>:36:168: note: possible intended match here
 #1 0xb6f20 in main (/Users/buildslave/jenkins/sharedspace/clang-stage1-cmake-RA_workspace/clang-build/tools/clang/runtime/compiler-rt-bins/test/asan/I386DarwinConfig/TestCases/Darwin/Output/atos-symbolizer.cc.tmp:i386+0x1f20)

llvm-svn: 304674
2017-06-04 02:18:45 +00:00
Kostya Serebryany ad272b0861 [asan] fix one more case where stack-use-after-return is not async-signal-safe (during thread startup). beef-up the test to give it a chance to catch regressions. Also relax the lint to make C++11 more usable.
llvm-svn: 304598
2017-06-02 21:32:04 +00:00
Kostya Serebryany 124c2ae4fa [sanitizer-coverage] nuke more stale code
llvm-svn: 304508
2017-06-02 01:17:04 +00:00
Kostya Serebryany 70c64869b5 [sanitizer-coverage] nuke more stale code
llvm-svn: 304500
2017-06-01 23:56:49 +00:00
Pierre Gousseau 183d1368f3 [asan] Add strndup/__strndup interceptors.
Recommit of r302781 with Vitaly Buka's fix for non zero terminated strings.

Differential Revision: https://reviews.llvm.org/D31457

llvm-svn: 304399
2017-06-01 09:37:22 +00:00
Kostya Serebryany 9c50876120 [sanitizer-coverage] remove stale code (old coverage); compiler-rt part
llvm-svn: 304318
2017-05-31 18:26:32 +00:00
Alex Shlyapnikov f8f8f49a24 [asan] Enable back halt_on_error-torture.cc disabled on PowerPC.
Summary:
D33521 addressed a memory ordering issue in BlockingMutex, which seems
to be the cause of a flakiness of a few ASan tests on PowerPC.

Reviewers: eugenis

Subscribers: kubamracek, nemanjai, llvm-commits

Differential Revision: https://reviews.llvm.org/D33611

llvm-svn: 304045
2017-05-26 23:14:06 +00:00
Vitaly Buka e8b09195fa [compiler-rt] Don't reset non-default user handler if allow_user_segv_handler is true.
Reviewers: eugenis, kcc

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D32457

llvm-svn: 304039
2017-05-26 21:51:26 +00:00
Alex Shlyapnikov 23ff882e45 [asan] Enable back some ASan tests disabled on PowerPC.
Summary:
D33521 addressed a memory ordering issue in BlockingMutex, which seems
to be the cause of a flakiness of a few ASan tests on PowerPC.

Reviewers: eugenis

Subscribers: kubamracek, nemanjai, llvm-commits

Differential Revision: https://reviews.llvm.org/D33569

llvm-svn: 303995
2017-05-26 14:49:42 +00:00
Vitaly Buka a05da1fca9 [compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusive
Summary:
allow_user_segv_handler had confusing name did not allow to control behavior for
signals separately.

Reviewers: eugenis, alekseyshl, kcc

Subscribers: llvm-commits, dberris, kubamracek

Differential Revision: https://reviews.llvm.org/D33371

llvm-svn: 303941
2017-05-25 23:42:33 +00:00
Kostya Serebryany f3509b6d9b [asan] relax sanbox_read_proc_self_maps_test to pass even if unshare() fails.
llvm-svn: 303911
2017-05-25 20:50:36 +00:00
Adam Nemet 14205b4a76 Disable two more flaky ASan wait* tests temporarily on Darwin
llvm-svn: 303885
2017-05-25 17:24:54 +00:00
Bill Seurer ec372bd8ed [powerpc] deactivate flakey test halt_on_error-torture.cc on powerpc64 be
This test case occassionally fails when run on powerpc64 be.

asan/TestCases/Posix/halt_on_error-torture.cc

The failure causes false problem reports to be sent to developers whose
code had nothing to do with the failures.  Reactivate it when the real
problem is fixed.

This could also be related to the same problems as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, ManyThreadsTest,
and several others that do not run reliably on powerpc.

llvm-svn: 303864
2017-05-25 14:41:58 +00:00
Adam Nemet 4f4748557e Disable flaky ASan tests temporarily on darwin
llvm-svn: 303662
2017-05-23 17:50:48 +00:00
Vitaly Buka 8018780d39 [compiler-rt] Switch handle_<signal> flags from bool to enum.
Summary: We are going to make it tri-state and remove allow_user_segv_handler.

Reviewers: eugenis, alekseys, kcc

Subscribers: kubamracek, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D33159

llvm-svn: 303464
2017-05-19 22:37:16 +00:00
Daniel Jasper f97310fb7a Revert r302781 and subsequent attempts to disable part of it.
The Msan unit tests are still broken and by this point, I think we
should start over.

llvm-svn: 303339
2017-05-18 09:31:37 +00:00
Kostya Serebryany 9aa8ef8504 temporary disable stndup interceptor, due to r302781 being buggy
llvm-svn: 303324
2017-05-18 03:00:07 +00:00
Kostya Serebryany 130fca1882 [asan] make asan under sandboxes more robust
llvm-svn: 303132
2017-05-15 23:37:54 +00:00
Reid Kleckner 07c0dd7654 [asan/win] Re-enable Win64 asan tests on Win8+
Our theory is that reserving large amounts of shadow memory isn't
reliable on Win7 and earlier NT kernels. This affects the
clang-x64-ninja-win7 buildbot, which uses Windows 7.

llvm-svn: 302917
2017-05-12 16:30:56 +00:00
Francis Ricci fdcab2cbf2 Enable lsan test suite on Darwin x86_64 builds
Reviewers: kubamracek, alekseyshl

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D32191

llvm-svn: 302904
2017-05-12 15:10:05 +00:00
Pierre Gousseau 9ce59db426 [asan] Test 'strndup_oob_test.cc' added in r302781 fails on the clang-cmake-thumbv7-a15-full-sh bot.
Marking as unsupported on armv7l-unknown-linux-gnueabihf, same as strdup_oob_test.cc

llvm-svn: 302807
2017-05-11 16:26:50 +00:00
Pierre Gousseau 24090e59ea [asan] Test 'strndup_oob_test.cc' added in r302781 fails on clang-s390x-linux.
Marking it as unsupported for now to hopefully make the bot green.

llvm-svn: 302789
2017-05-11 11:22:04 +00:00
Pierre Gousseau 0550581070 [asan] Recommit of r301904: Add strndup/__strndup interceptors
Fix undeclared __interceptor_malloc in esan_interceptors.cc
Fix undeclared strnlen on OSX

Differential Revision: https://reviews.llvm.org/D31457

llvm-svn: 302781
2017-05-11 08:53:24 +00:00
Peter Wu dbc4f7413c [ASAN] Add interceptor for __longjmp_chk
Summary:
glibc on Linux calls __longjmp_chk instead of longjmp (or _longjmp) when
_FORTIFY_SOURCE is defined. Ensure that an ASAN-instrumented program
intercepts this function when a system library calls it, otherwise the
stack might remain poisoned and result in CHECK failures and false
positives.

Fixes https://github.com/google/sanitizers/issues/721

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D32408

llvm-svn: 302152
2017-05-04 14:03:57 +00:00
Reid Kleckner eceba0d2e3 Revert my bad winasan coverage test fix and apply one that actually works
trace-pc doesn't work, but trace-pc-guard does. *shrug*

llvm-svn: 302045
2017-05-03 16:11:01 +00:00
Reid Kleckner d7e681ca10 Speculative fix for WinASan after r301994
llvm-svn: 302043
2017-05-03 15:59:07 +00:00
Kuba Mracek 9537912961 [asan] Mark some more testcases as unsupported on iOS.
llvm-svn: 301976
2017-05-02 21:22:29 +00:00
Kuba Mracek 24d7542715 [asan] Mark atos-symbolizer-dyld-root-path.cc testcase as unsupported on iOS.
llvm-svn: 301967
2017-05-02 20:09:33 +00:00
Kuba Mracek 1a8e0b0b0e [asan] Mark a bunch of tests as unsupported on iOS
This patch marks a few ASan tests as unsupported on iOS. These are mostly tests that use files or paths that are invalid/inaccessible on iOS or the simulator. We currently don't have a good way of propagating/copying secondary files that individual tests need. The same problem exists on Android, so I'm just marking the tests as UNSUPPORTED now.

Differential Revision: https://reviews.llvm.org/D32632

llvm-svn: 301966
2017-05-02 19:37:28 +00:00
Kuba Mracek f3b6db40b6 [asan] Disable some Darwin tests that don't work on iOS simulator
Differential Revision: https://reviews.llvm.org/D32633

llvm-svn: 301965
2017-05-02 19:35:29 +00:00
Pierre Gousseau 1c5550671d Revert r301904 causing tsan test failure in x86_64-linux-autoconf
llvm-svn: 301909
2017-05-02 10:22:05 +00:00
Pierre Gousseau b7101479a8 [asan] Add strndup/__strndup interceptors if targeting linux.
Differential Revision: https://reviews.llvm.org/D31457

llvm-svn: 301904
2017-05-02 09:01:02 +00:00
Kostya Serebryany 60cff50b27 [sanitizer-coverage] remove more stale code
llvm-svn: 301845
2017-05-01 22:07:12 +00:00
Kostya Serebryany e5ca68cfcd [asan] speed up small memcpy (> 32 but <= 64 bytes)
llvm-svn: 301837
2017-05-01 21:05:29 +00:00
Kostya Serebryany f151b848c0 [sanitizer-coverage] disable coverage_direct=1, will remove the code in a few weeks
llvm-svn: 301826
2017-05-01 20:01:50 +00:00
Bill Seurer 6a47ba2ee0 [powerpc] deactivate flakey tests on powerpc64le
These test cases occassionally fail when run on powerpc64le:

ignore_lib1.cc
ignore_lib5.cc
TestCases/Posix/current_allocated_bytes.cc
rtl/TsanRtlTest/Posix.ThreadLocalAccesses
TestCases/Posix/coverage-fork-direct.cc

The failures cause false problem reports to be sent to developers whose
code had nothing to do with the failures.  Reactivate them when the real
problems are fixed.

This could also be related to the same problems as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, ManyThreadsTest,
and several others that do not run reliably on powerpc.

llvm-svn: 301798
2017-05-01 13:56:04 +00:00
Kuba Mracek 10c6ba06d4 Fix unset-insert-libraries-on-exec.cc to use "%env" to make it work in iOS simulator.
llvm-svn: 301622
2017-04-28 05:50:46 +00:00
Kuba Mracek b08c567201 Fix the reexec-insert-libraries-env.cc testcase to use %env to make it work on iOS simulator.
llvm-svn: 301621
2017-04-28 05:48:27 +00:00
Kuba Mracek 0d91d6a4ed [asan] Add a compilation wrapper that codesigns shared libraries to support iOS simulator testing
Tests that run on the iOS simulator require the dlopen'd dylibs are codesigned. This patch adds the "iossim_compile.py" wrapper that codesigns any produces dylib.

Differential Revision: https://reviews.llvm.org/D32561

llvm-svn: 301617
2017-04-28 04:55:35 +00:00
Evgeniy Stepanov 4094d9a127 [asan] Fix dead stripping of globals on Linux (compiler-rt).
Third attempt. See the description of the corresponding commit in
LLVM for more details.

llvm-svn: 301588
2017-04-27 20:27:33 +00:00
Rafael Espindola dc18f517cd Also match the output on 32 bit systems.
llvm-svn: 301543
2017-04-27 14:21:09 +00:00
Rafael Espindola fbdaac4841 Add missing FileCheck, update CHECK lines and avoid subshell.
llvm-svn: 301541
2017-04-27 13:32:09 +00:00
Kuba Mracek c080598ed3 Mark two tests (dead-strip.c, initialization-bug.cc) as unsupported on iOS.
llvm-svn: 301478
2017-04-26 21:34:18 +00:00
Kuba Mracek 74233bed59 [asan] Allow propagating env variables when testing on iOS Simulator
This patch adds "%env" as a way to express that the environment variable should be set on the target device/simulator. This fixes some test failures when testing on iOS/Simulator.

Differential Revision: https://reviews.llvm.org/D32556

llvm-svn: 301462
2017-04-26 20:38:24 +00:00