Commit Graph

8216 Commits

Author SHA1 Message Date
Mike Aizatsky dc58a7d618 Revert "[sancov] introducing SANCOV_OPTIONS"
and related changes

https://llvm.org/svn/llvm-project/compiler-rt/trunk@291068

llvm-svn: 291141
2017-01-05 16:55:56 +00:00
Mike Aizatsky 252adf7c77 [sancov] force default flags for windows
llvm-svn: 291089
2017-01-05 06:55:55 +00:00
Mike Aizatsky 2ced0edd1c [sancov] enabling tests on ppc and s390
The reason they should have failed: absent sancov.
In this test (vs the trace_pc_guard test) sancov is not
yet called (not implemented).

llvm-svn: 291080
2017-01-05 04:46:19 +00:00
Mike Aizatsky 6196eaf0ae fixing build, accidentally deleted two lines
llvm-svn: 291077
2017-01-05 04:22:20 +00:00
Mike Aizatsky 3fd897dc32 [sancov] workaround for absence of weak symbols on win
llvm-svn: 291076
2017-01-05 04:18:02 +00:00
Mike Aizatsky 078d716d4c [sancov] workaround for absence of weak symbols on win
llvm-svn: 291071
2017-01-05 03:48:20 +00:00
Chandler Carruth bbb82ca4e6 [gtest] Teach the sanitizer's custom gtest compilations to disable
a warning that 'gtest-all.cc' directly triggers in the newer 1.8.0
version.

This should fix a warning in folks' build and bring a couple of -Werror
bots back to life.

llvm-svn: 291070
2017-01-05 03:41:41 +00:00
Mike Aizatsky 4ae2e0c386 [sancov] introducing SANCOV_OPTIONS
Summary:
At this point SANCOV_OPTIONS are not functional but it is our intent
to move here sanitizer coverage flags from various sanitizers _OPTIONS.

Reviewers: kcc

Subscribers: kubabrecka, mgorny

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

llvm-svn: 291068
2017-01-05 03:14:35 +00:00
Bob Haarman f04df85258 break overly long line in sanitizer_win.cc
llvm-svn: 291062
2017-01-05 01:35:38 +00:00
Bob Haarman 71a7323b5a fix warning about noreturn in sanitizer_win's internal__exit()
Summary:
A previous fix used __assume(0), but not all compilers know that control will
not pass that. This patch uses a macro which works in more compilers.

Reviewers: rnk

Subscribers: kubabrecka

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

llvm-svn: 291042
2017-01-05 00:37:13 +00:00
Bob Haarman f51b0d5908 [compiler-rt] suppress LNK4221 warning when creating static libraries
Summary:
We put empty object files in archives, which causes MSVC's linker to
complain about these objects not defining any previously undefined
symbols. Since we do it on purpose, this only creates noise during
the build process. This patch causes us to suppress the warnings.

Reviewers: rnk, samsonov

Subscribers: dberris, mgorny

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

llvm-svn: 291011
2017-01-04 21:40:00 +00:00
Dean Michael Berris 7c030a2d91 [XRay] [compiler-rt] Include argv[0] in the log file name.
Summary:
If you decide to recompile parts of your Linux distro with XRay, it may
be useful to know which trace belongs to which binary.  While there, get
rid of the incorrect strncat() usage; it always returns a pointer to the
start which makes that if() always true.  Replace with snprintf which is
bounded so that enough from both strings fits nicely.

Reviewers: dberris

Subscribers: danalbert, srhines, kubabrecka, mgorny, llvm-commits

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

llvm-svn: 290861
2017-01-03 04:35:24 +00:00
Dean Michael Berris 0aba35710f Revert "[XRay][compiler-rt] XRay Flight Data Recorder Mode"
This reverts rL290852 as it breaks aarch64 and arm.

llvm-svn: 290854
2017-01-03 04:04:00 +00:00
Dean Michael Berris 33d305b54b [XRay][compiler-rt] XRay Flight Data Recorder Mode
Summary:
In this change we introduce the notion of a "flight data recorder" mode
for XRay logging, where XRay logs in-memory first, and write out data
on-demand as required (as opposed to the naive implementation that keeps
logging while tracing is "on"). This depends on D26232 where we
implement the core data structure for holding the buffers that threads
will be using to write out records of operation.

This implementation only currently works on x86_64 and depends heavily
on the TSC math to write out smaller records to the inmemory buffers.

Also, this implementation defines two different kinds of records with
different sizes (compared to the current naive implementation): a
MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord
entries are meant to write out information like the thread ID for which
the metadata record is defined for, whether the execution of a thread
moved to a different CPU, etc. while a FunctionRecord represents the
different kinds of function call entry/exit records we might encounter
in the course of a thread's execution along with a delta from the last
time the logging handler was called.

While this implementation is not exactly what is described in the
original XRay whitepaper, this one gives us an initial implementation
that we can iterate and build upon.

Reviewers: echristo, rSerge, majnemer

Subscribers: mehdi_amini, llvm-commits, mgorny

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

llvm-svn: 290852
2017-01-03 03:38:17 +00:00
Evgeniy Stepanov c0e82d6bfc Decrease kLargeMalloc block size in ASAN unit tests.
Summary:
Make kLargeMalloc big enough to be handled by secondary allocator
and small enough to fit into quarantine for all configurations.
It become too big to fit into quarantine on Android after D27873.

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: danalbert, llvm-commits, kubabrecka

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

llvm-svn: 290689
2016-12-28 21:57:51 +00:00
Evgeniy Stepanov 8988ebb435 Fix unit test broken by D27873.
Summary:
Reduce RSS size treshold in the unit test to accomodate for the smaller
ASAN quarantine size on Android (see D27873).

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: danalbert, kubabrecka, llvm-commits

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

llvm-svn: 290643
2016-12-28 01:41:24 +00:00
Evgeniy Stepanov ddf0c26b6a [asan] Mark printf-m test as unsupported on windows.
llvm-svn: 290635
2016-12-27 22:22:32 +00:00
Evgeniy Stepanov f787cf7ee6 [asan] Fix handling of %m in printf interceptor.
llvm-svn: 290632
2016-12-27 22:14:03 +00:00
Vitaly Buka ec494b2675 [compiler-rt] Fix compilation error after r290626
llvm-svn: 290629
2016-12-27 21:30:20 +00:00
Vitaly Buka f2973dcfe8 [compiler-rt] Move logic which replace memcpy interceptor with memmove from asan to sanitizer_common.
Reviewers: eugenis

Subscribers: kubabrecka, dberris, llvm-commits

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

llvm-svn: 290626
2016-12-27 21:13:11 +00:00
Vitaly Buka a5a916bdca [asan] Fix test broken by r290540
Reviewers: ahatanak, eugenis, myatsina

Subscribers: kubabrecka, zizhar, llvm-commits

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

llvm-svn: 290621
2016-12-27 19:40:23 +00:00
Saleem Abdulrasool c1861d86e1 test: filter out -fPIE/-pie on Windows
Use some new substitutions to avoid duplicating the tests for just
dropped flags.  -fPIC/-fPIE/-fpic/-fpie do not make sense on Windows as
they can cause ELF-style PIC.  Substitute away the flag on Windows.
This should repair the windows buildbots.

llvm-svn: 290571
2016-12-27 03:16:20 +00:00
Vitaly Buka b67bfd2fd7 [tsan] Fix string to bool conversion warnings in tsan tests
llvm-svn: 290568
2016-12-27 02:05:24 +00:00
Marina Yatsina 168b954611 [inline-asm]No error for conflict between inputs\outputs and clobber list
Updated test according to commit 290539:

According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict.
for example:

const long double a = 0.0;
int main()
{

char b;
double t1 = a;
__asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)");

return 0;
}

This should conflict with the output - t1 which is st, and st which is st aswell.
The patch fixes it.

Commit on behald of Ziv Izhar.

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

llvm-svn: 290540
2016-12-26 12:24:49 +00:00
Kuba Mracek a6a177389c [sanitizer] Define some CPU type symbols (like CPU_SUBTYPE_X86_64_H) when they're not available.
This allows compiler-rt to be built on older macOS SDKs, where there symbols are not defined.

Patch by Jeremy Huddleston Sequoia <jeremyhu@apple.com>.

llvm-svn: 290521
2016-12-25 20:03:40 +00:00
Renato Golin ece8de7c23 Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification"
This reverts commit r290452, not quite there yet. We need to test this
offline.

llvm-svn: 290453
2016-12-23 21:58:39 +00:00
Serge Rogatch 4ee228bf73 [XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification
Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 290452
2016-12-23 21:21:01 +00:00
Kostya Kortchinsky 524c035a4a [scudo] Use the macro get_test_cc_for_arch for the tests
Summary: The macro was introduced with D26929, use it in Scudo as well.

Reviewers: kcc, alekseyshl, kubabrecka

Subscribers: llvm-commits, danalbert, srhines, mgorny

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

llvm-svn: 290439
2016-12-23 18:40:47 +00:00
Michal Gorny f344a51369 [tests] Add missing "int_lib.h" includes and extend guards
Fix missing "int_lib.h" includes in ARM negdf2vfp and subdf3vfp tests.
Additionally, extend the __arm__ guard to cover the builtin definition
in the former. This is mostly intended to prevent build failures
and allow those tests to be properly skipped on other targets.

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

llvm-svn: 290422
2016-12-23 11:18:24 +00:00
Vitaly Buka 2e97554245 [compiler-rt] Define COMMON_INTERCEPT_FUNCTION_MEMCPY for tsan and esan
Reviewers: eugenis

Subscribers: kubabrecka, dberris, llvm-commits

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

llvm-svn: 290396
2016-12-23 01:08:31 +00:00
Vitaly Buka cd613e9d6d Fix interceptors setup broken after r290382
Summary: We setup these interceptors twice which hangs test on windows.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 290393
2016-12-23 00:37:07 +00:00
Vitaly Buka 9895f7959a Replace WRAP in interceptors with memset, memmove and memcpy implementation
Summary:
According https://reviews.llvm.org/D27659#625093 WRAP adds confusing stack
frame.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 290382
2016-12-22 22:02:26 +00:00
Evgeniy Stepanov 37db58e9eb Expose thread local quarantine size as ASAN option.
Summary: Make thread local quarantine size an option so it can be turned off to save memory.

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 290373
2016-12-22 21:43:22 +00:00
Evgeniy Stepanov 055f506c54 Improve ThreadedQuarantineTest heap memory measurements.
Summary:
Warm up ASAN caches in ThreadedQuarantineTest to get more predictable
incremental heap memory usage measurements.

Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: aemerson, kubabrecka, llvm-commits

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

llvm-svn: 290371
2016-12-22 21:16:04 +00:00
Renato Golin fe8bbb2333 Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification"
This reverts commit r290354, as it broke the build. We need to make sure
this builds on AArch64 before committing again.

llvm-svn: 290362
2016-12-22 19:38:04 +00:00
Serge Rogatch 93fb15788a [XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing the instruction cache after code modification
Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 290354
2016-12-22 18:48:36 +00:00
Krzysztof Parzyszek bd0455defa [compiler-rt] Add missing includes of <errno.h> and <iterator>
The compilation failed due to undeclared identifiers: distance, errno,
and EINTR.

llvm-svn: 290343
2016-12-22 15:31:21 +00:00
Diana Picus 6b88e325ea [XRay] [compiler-rt] Move machine-dependent code into machine-dependent files
Reapply r290077.

Authors: pelikan

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

llvm-svn: 290330
2016-12-22 07:35:56 +00:00
Evgeniy Stepanov 76a60a8ccd Increase the treshold in unit test to accomodate for qurantine size increase.
Reviewers: eugenis

Patch by Alex Shlyapnikov.

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 290279
2016-12-21 22:50:08 +00:00
Evgeniy Stepanov 1a21263a89 Reduce the size of quarantine cache in ASAN_LOW_MEMORY configuration.
Summary:
Experiments show that on Android the current values result in too much
of the memory consumption for all quarantined chunks.

Reviewers: kcc, eugenis

Subscribers: mgorny, danalbert, srhines, llvm-commits, kubabrecka

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 290218
2016-12-21 00:18:10 +00:00
Kostya Kortchinsky e3be61c139 [scudo] ARM32 support
Summary:
With the previous modifications, the code works on ARM32. The random shuffle
test is unsupported on 32-bit platforms for the moment and being marked as
such. There is no hardware support for the checksum computation yet, this will
come at a later point.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, aemerson, rengolin, mgorny

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

llvm-svn: 290201
2016-12-20 21:17:58 +00:00
Dimitry Andric 003fe25b07 Fix build breakage on FreeBSD after rL289878/rL289881
Summary:
After rL289878/rL289881, the build on FreeBSD is broken, because
sanitizer_platform_limits_posix.cc attempts to include <utmp.h> and use
`struct utmp`, neither of which are supported anymore on FreeBSD.

Fix this by adding `&& !SANITIZER_FREEBSD` in a few places, and stop
intercepting utmp functions altogether for FreeBSD.

Reviewers: kubabrecka, emaste, eugenis, ed

Subscribers: ed, llvm-commits

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

llvm-svn: 290167
2016-12-20 07:58:49 +00:00
Chandler Carruth 6db6efd40c Make this REQUIRES match the other REQUIRES lines that mention requiring
a darwin system.

llvm-svn: 290152
2016-12-20 01:57:31 +00:00
Kuba Mracek 0722cd0815 Fixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how to make it work on Linux.
llvm-svn: 290129
2016-12-19 18:54:34 +00:00
Kuba Mracek 05bf3ec4c4 More fixup for r290119: Make the ifdef work.
llvm-svn: 290126
2016-12-19 18:27:26 +00:00
Kuba Mracek 7384738362 Another fix-up for r290119: Include stdint.h so we have uint64_t on Linux.
llvm-svn: 290124
2016-12-19 18:09:18 +00:00
Kuba Mracek 866310fcbc Fix-up for r290119 - don't check global size, it might not be available when using atos
llvm-svn: 290123
2016-12-19 18:06:49 +00:00
Kuba Mracek 1187cbd20f [tsan] Implement __tsan_get_alloc_stack and __tsan_locate_address to query pointer types and allocation stacks of heap pointers
In ASan, we have __asan_locate_address and __asan_get_alloc_stack, which is used in LLDB/Xcode to show the allocation backtrace for a heap memory object. This patch implements the same for TSan.

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

llvm-svn: 290119
2016-12-19 17:52:20 +00:00
Diana Picus c0eb996318 Revert "[XRay] [compiler-rt] Move machine-dependent code into machine-dependent files."
This reverts commit r290077, 78, 79 and 83.

llvm-svn: 290101
2016-12-19 12:43:08 +00:00
Dean Michael Berris 2cc7fc2cc6 [XRay][compiler-rt] Fix missing include of <cerrno>
Futher attempt to un-break ARM and AArch64 build.

Follow-up on D25360.

llvm-svn: 290083
2016-12-19 05:26:14 +00:00
Dean Michael Berris 6f16e2c456 [XRay][compiler-rt] Post-commit review fixup of XRay refactoring.
Missed a couple of files:

- Using #pragma once
- Missing top-matter for headers
- Missing an include for <cstdint>

Follow-up on D25360.

llvm-svn: 290079
2016-12-19 03:59:20 +00:00
Dean Michael Berris 4527ebecb6 [XRay][compiler-rt] Explicitly include <cstdint> for types
This is an attempt to un-break the ARM7, AArch64 builds.

Follow-up on D25360.

llvm-svn: 290078
2016-12-19 03:47:35 +00:00
Dean Michael Berris 094173ba2c [XRay] [compiler-rt] Move machine-dependent code into machine-dependent files.
Summary: Include the necessary headers while there.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 290077
2016-12-19 03:21:26 +00:00
Dean Michael Berris a53217d185 [XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support %ld.
Summary:
Getting rid of the distance number altogether because:
- a person knowledgeable enough to know what the message means will also
  know how to do hexadecimal math (with the help of a calculator)
- numbers outside INT_MIN - INT_MAX are hard to comprehend anyway

This unbreaks the case when you dynamically link a library with XRay and
it exits pre-main() with a not very informative static string.

Author: pelikan

Reviewers: dberris

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 290074
2016-12-19 00:47:40 +00:00
Kuba Mracek 79b4f0ad9c Follow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future.mm testcase.
Turns out 1000 unjoined threads are a bit too rough in certain environments.

llvm-svn: 289971
2016-12-16 18:44:01 +00:00
Kuba Mracek 0bd0fe4e7d Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept getutent and friends).
llvm-svn: 289881
2016-12-15 22:40:24 +00:00
Evgeniy Stepanov 40f05dcec9 [msan] Intercept getutent and friends.
Differential Revision: https://reviews.llvm.org/D27791

llvm-svn: 289878
2016-12-15 22:00:14 +00:00
Hans Wennborg 603679849d Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)"
It breaks programs on Mac. See comments on the code review for details.

llvm-svn: 289864
2016-12-15 20:11:12 +00:00
Saleem Abdulrasool c9dcfc5182 xray: fix assembly macro definition
projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:33:7: error: unexpected token in '.endm' directive
  .endm SAVE_REGISTERS
	^
  projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:52:7: error: unexpected token in '.endm' directive
  .endm RESTORE_REGISTERS
	^

Remove the trailing name on the `.endm` which does not take the name of the
macro.  This should bring the compiler-rt build bot back into working state.

llvm-svn: 289852
2016-12-15 18:54:27 +00:00
Saleem Abdulrasool 561117caba sanitizers: silence -pedantic warning
projects/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc:142:2: warning: extra ';' [-Wpedantic]
   };  // namespace
    ^

Identified by gcc 6.

llvm-svn: 289851
2016-12-15 18:54:25 +00:00
Kostya Kortchinsky 47be0edfa3 [scudo] Use DefaultSizeClassMap for 32-bit
Summary:
With the recent changes to the Secondary, we use less bits for UnusedBytes,
which allows us in return to increase the bits used for Offset. That means
that we can use a Primary SizeClassMap allowing for a larger maximum size.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 289838
2016-12-15 18:06:55 +00:00
Mike Aizatsky 94752697ee [sanitizers] dont dump coverage if not asked to
llvm-svn: 289835
2016-12-15 17:30:58 +00:00
Kuba Mracek 659949cb03 [tsan] Add interceptor for libcxx __shared_count::__release_shared()
We already have an interceptor for __shared_weak_count::__release_shared, this patch handles __shared_count::__release_shared in the same way. This should get rid of TSan false positives when using std::future.

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

llvm-svn: 289831
2016-12-15 16:45:28 +00:00
Dean Michael Berris 76e56c6777 [XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.
Summary:
The layout of all registers saved on stack shouldn't deviate and will be reused in future trampolines as well.

While there, fix whitespace and clarify comments.

Author: mpel

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 289789
2016-12-15 09:04:05 +00:00
Marcos Pividori 4b9853ffa8 Fix simple cmake error when COMPILER_RT_SUPPORTED_ARCH is empty.
Differential Revision: https://reviews.llvm.org/D27719

llvm-svn: 289749
2016-12-15 01:21:04 +00:00
Kostya Serebryany 6bca8423c9 [sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)
llvm-svn: 289690
2016-12-14 19:10:17 +00:00
Dmitry Vyukov 963f5490e2 tsan: allow Java VM iterate over allocated objects
Objects may move during the garbage collection, and JVM needs
to notify ThreadAnalyzer about that. The new function
__tsan_java_find eliminates the need to maintain these
objects both in ThreadAnalyzer and JVM.

Author: Alexander Smundak (asmundak)
Reviewed in https://reviews.llvm.org/D27720

llvm-svn: 289682
2016-12-14 18:20:18 +00:00
Kostya Kortchinsky a37860acee [scudo] Relax the memalign test
Summary:
Now that we are not rounding up the sizes passed to the secondary allocator,
the memalign test could run out of aligned addresses to return for larger
alignments. We now reduce the size of the quarantine for that test, and
allocate less chunks for the larger alignments.

Subscribers: llvm-commits

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

llvm-svn: 289665
2016-12-14 16:38:11 +00:00
Mike Aizatsky f775dbb5f4 [sanitizers] -DAG is order-independent check
llvm-svn: 289606
2016-12-13 22:26:04 +00:00
Reid Kleckner 76e881903d Add DLL thunks for new sancov APIs to fix Windows tests
llvm-svn: 289587
2016-12-13 20:54:45 +00:00
Kostya Kortchinsky c74da7ce58 Corrected D27428: Do not use the alignment-rounded-up size with secondary
Summary:
I atually had an integer overflow on 32-bit with D27428 that didn't reproduce
locally, as the test servers would manage allocate addresses in the 0xffffxxxx
range, which led to some issues when rounding addresses.

At this point, I feel that Scudo could benefit from having its own combined
allocator, as we don't get any benefit from the current one, but have to work
around some hurdles (alignment checks, rounding up that is no longer needed,
extraneous code).

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289572
2016-12-13 19:31:54 +00:00
Reid Kleckner 125b15e6c9 Fix warning for noreturn function
llvm-svn: 289568
2016-12-13 19:01:41 +00:00
Ulrich Weigand 50d4ec66d4 [sancov] Disable failing test on SystemZ as well
This doesn't work at all on big-endian systems, even just reading in the
magic bytes in the binary .sancov file header gets byte order wrong.

llvm-svn: 289539
2016-12-13 14:44:25 +00:00
Renato Golin 08c2563cb1 [sancov] Mark as unstable on ARM, not XFAIL, since it does pass on some config
llvm-svn: 289526
2016-12-13 10:22:49 +00:00
Mike Aizatsky f723811972 [sanitizers] dso order is random, test shouldnt depend on it
llvm-svn: 289516
2016-12-13 05:24:57 +00:00
Mike Aizatsky b67efec03b [sanitizers] powerpc4 is also unsupported platform
llvm-svn: 289515
2016-12-13 05:21:19 +00:00
Mike Aizatsky df80572d1f [sanitizers] disabling dso test as well where appropriate
llvm-svn: 289508
2016-12-13 01:11:46 +00:00
Mike Aizatsky e20a4c8859 [sanitizers] trace-pc-guard doesn't work on mac as well
fatal error: error in backend: Global variable '__sancov_gen_' has an
invalid section specifier '__sancov_guards': mach-o section specifier
requires a segment and section separated by a comma.

llvm-svn: 289507
2016-12-13 01:10:21 +00:00
Mike Aizatsky 1e2f30e957 [sanitizers] sancov really works on x86 only
llvm-svn: 289505
2016-12-13 00:34:33 +00:00
Dean Michael Berris 481294e3c7 [XRay][compiler-rt] Use explicit comparisons in unit tests.
Summary:
This should improve the error messages generated providing a bit more
information when the failures are printed out. One example of a
contrived error looks like:

```
Expected: (Buffers.getBuffer(Buf)) != (std::error_code()), actual:
system:0 vs system:0
```

Because we're using error codes, the default printing gets us more
useful information in case of failure.

This is a follow-up on D26232.

Reviewers: rSerge

Subscribers: llvm-commits

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

llvm-svn: 289501
2016-12-13 00:17:31 +00:00
Mike Aizatsky aaa637001a [sancov] __sanitizer_dump_coverage api
Subscribers: kubabrecka, mgorny

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

llvm-svn: 289498
2016-12-12 23:45:38 +00:00
Petr Hosek f332d190cc [compiler-rt] Support building builtins for a single target
This is used when building builtins for multiple targets as part
of LLVM runtimes.

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

llvm-svn: 289489
2016-12-12 23:14:02 +00:00
Peter Collingbourne 9d763b22af symbolizer: Add lseek64 to global symbol list.
llvm-svn: 289449
2016-12-12 17:55:40 +00:00
Petr Hosek 627f686ffc [XRay][CMake] Check target for XRay Flight Data Recorder
This target doesn't currently do anything, but it is required by
the runtimes build.

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

llvm-svn: 289420
2016-12-12 05:18:36 +00:00
Kuba Mracek 1c002267fb [sanitizer] Make sure libmalloc doesn't remove the sanitizer zone from malloc_zones[0]
In certain OS versions, it was possible that libmalloc replaced the sanitizer zone from being the default zone (i.e. being in malloc_zones[0]). This patch introduces a failsafe that makes sure we always stay the default zone. No testcase for this, because this doesn't reproduce under normal circumstances.

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

llvm-svn: 289376
2016-12-11 08:45:36 +00:00
Kuba Mracek b93f78128f [sanitizer] Handle malloc_destroy_zone() on Darwin
We currently have a interceptor for malloc_create_zone, which returns a new zone that redirects all the zone requests to our sanitizer zone. However, calling malloc_destroy_zone on that zone will cause libmalloc to print out some warning messages, because the zone is not registered in the list of zones. This patch handles this and adds a testcase for that.

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

llvm-svn: 289375
2016-12-11 08:42:42 +00:00
Renato Golin 3bdc0f165b [DFSAN] Another unstable test in AArch64 breaking bots unnecessarily
llvm-svn: 289253
2016-12-09 19:02:04 +00:00
Kostya Kortchinsky bfeb7990b2 Reverting rL289088 while investigating some test issue on the build servers
Subscribers: kubabrecka

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

llvm-svn: 289180
2016-12-09 03:28:12 +00:00
Vitaly Buka 5d16b9b8dd [sanitizer] Add workaround for empty strings
Summary: I see crashes on this check when some reports are being generated.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 289145
2016-12-08 22:26:03 +00:00
Vitaly Buka 6eead19ce4 [asan] Add test which detects bugs undetectable before r288563
Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289090
2016-12-08 19:13:13 +00:00
Kostya Kortchinsky 2defe4d9a1 [sanitizer] Do not use the alignment-rounded-up size when using the secondary
Summary:
The combined allocator rounds up the requested size with regard to the
alignment, which makes sense when being serviced by the primary as it comes
with alignment guarantees, but not with the secondary. For the rare case of
large alignments, it wastes memory, and entices unnecessarily large fields for
the Scudo header. With this patch, we pass the non-alignement-rounded-up size
to the secondary, and adapt the Scudo code for this change.

Reviewers: alekseyshl, kcc

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289088
2016-12-08 19:05:46 +00:00
Etienne Bergeron 58ee3b786d [compiler-rt][asan] Fix overlaping parameters for memmove/memcpy on windows.
Summary:
On windows, memmove and memcpy may be the same functions (on 64-bits).

```
-- f:\dd\vctools\crt\vcruntime\src\string\amd64\memcpy.asm --------------------

        OPTION PROLOGUE:NONE, EPILOGUE:NONE

        memmove = memcpy
        mov     r11, rcx                ; save destination address
```


This is causing ASAN to report overlaping parameters when instrumenting chromium.

```
D:\src\chromium\src>out\asan64\chrome.exe --no-sandbox
[8956:6208:1121/162511:ERROR:entry.cc(167)] Entry::Deserialize: dictionary has no interface_provider_specs key
[8956:11560:1121/162511:ERROR:external_registry_loader_win.cc(130)] Missing value path for key Software\Google\Chrome\Ex
tensions\doeiiacdhfmpdeckdaifnjaemmkkdlkf.
=================================================================
==5132==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x000000237ee8,0x000000237eea) and [0x000000237ee9
, 0x000000237eeb) overlap
```

The error triggered on chromium:
```
Child-SP          RetAddr           Call Site
00000000`00166520 00000001`400a4886 chrome!__asan::ReportStringFunctionMemoryRangesOverlap+0x23 [d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_report.cc @ 305]
*** WARNING: Unable to verify checksum for D:\src\chromium\src\out\asan64dynamic\libglesv2.dll
00000000`001672a0 000007fe`e1859607 chrome!__asan_wrap_memcpy+0xf6 [d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_interceptors.cc @ 458]
00000000`00167b30 000007fe`e184bcbc libglesv2!__acrt_fp_strflt_to_string+0xb7 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\_fptostr.cpp @ 86]
(Inline Function) --------`-------- libglesv2!fp_format_f+0x57 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\cvt.cpp @ 578]
00000000`00167b60 000007fe`e182e2a2 libglesv2!__acrt_fp_format+0x180 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\cvt.cpp @ 722]
00000000`00167bf0 000007fe`e182ce80 libglesv2!__crt_stdio_output::output_processor<char,__crt_stdio_output::stream_output_adapter<char>,__crt_stdio_output::format_validation_
```


This bug is similar to: https://llvm.org/bugs/show_bug.cgi?id=16362

Reviewers: rnk, zaks.anna, filcab

Subscribers: filcab, kubabrecka, chrisha, llvm-commits, dberris

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

llvm-svn: 289063
2016-12-08 15:53:33 +00:00
Sagar Thakur 76a878b8f8 [MSAN][MIPS] Fix fork.cc test on MIPS
Summary: For platforms which support slow unwinder only, we restrict the store context size to 1, basically only storing the current pc. We do this because the slow unwinder which is based on libunwind is not async signal safe and causes random freezes in forking applications as well as in signal handlers.

Reviewed by eugenis.
Differential: D23107

llvm-svn: 289027
2016-12-08 06:30:58 +00:00
Serge Rogatch 3c265b55fc [XRay][AArch64] Disable the unstable test XRay-aarch64-linux::patching-unpatching.cc
Summary:
The test `XRay-aarch64-linux::patching-unpatching.cc` sometimes passes, sometimes fails on buildbots.
This patch disables test `patching-unpatching.cc` for AArch64 targets.

Reviewers: rengolin, dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 288988
2016-12-07 22:00:02 +00:00
Weiming Zhao 0a274c5954 [builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod
Summary:
For idivsi3, convert the Thumb2 only instruction to thumb1.
For aeabi_idivmod, using __divsi3.

Reviewers: rengolin, compnerd

Subscribers: llvm-commits

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

llvm-svn: 288960
2016-12-07 19:14:29 +00:00
Weiming Zhao a913f7ddbe [builtin] for the condition for check __ARM_FEATURE_CLZ
Summary: Since CLZ is not available for Thumb1, we use __ARM_ARCH_ISA_THUMB != 1 as one of the conditions.

Reviewers: rnk, compnerd, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 288954
2016-12-07 18:41:07 +00:00
Renato Golin cb2443e80c [asan] Disable yet another unstable test under AArch64
llvm-svn: 288953
2016-12-07 18:37:49 +00:00
Dean Michael Berris d0b3c6c8e6 [XRay][compiler-rt] Explicitly add dependency to pthread
This should fix the sanitizer bootstrap builds.

Follow-up to D26232.

llvm-svn: 288860
2016-12-06 23:08:45 +00:00
Evgeniy Stepanov 74cf034805 Replace "|&" with "2>&1 |" to support bash pre-4
Summary: Old bash release (3.2) on SLES11 chokes on new redirection shortcut.

Patch by Brian Cain.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 288854
2016-12-06 22:02:21 +00:00
Dean Michael Berris 406200eae6 [XRay][compiler-rt] Only add unit tests if we're building XRay.
As constructed before this patch, in case we run into case where we
don't actually build the XRay library, we really ought to not be adding
the unit test runs. This should fix the bootstrap build failures.

This is a follow-up further to D26232.

llvm-svn: 288788
2016-12-06 09:43:44 +00:00
Dean Michael Berris dcd2748a34 [XRay][compiler-rt] CMake fixes for XRay -- take 2.
The bootstrap buildbot complains about not being able to find the
unittests for XRay, when the conditionals to include or not include
tests and unit tests don't match.

This is a follow-up to D26232.

llvm-svn: 288786
2016-12-06 08:40:16 +00:00
Dean Michael Berris d94c0bf4be [XRay][compiler-rt] Fix unit test adding logic.
Before this change we would add the unit tests potentially even if we
don't actually include the unit tests.

This is a follow-up on D26232.

llvm-svn: 288785
2016-12-06 08:22:31 +00:00
Weiming Zhao 05fec0907d builtins: Add ARM Thumb1 implementation for uidiv and uidivmod
This is a resubmit of r288710 due to breakage of Darwin armv7em.

llvm-svn: 288777
2016-12-06 07:13:15 +00:00
Dean Michael Berris 21e877c6d9 [XRay][compiler-rt] Explicitly initialise members.
Before this, the change committed in D26232 might have an uninitialised
std::atomic<bool> that may or may not have a valid state. On aarch64
this breaks consistently, while it doesn't manifest as a problem in
x86_64.

This is an attempt to un-break this in aarch64.

llvm-svn: 288776
2016-12-06 06:58:15 +00:00
Dean Michael Berris abe04e3295 [XRay][compiler-rt] XRay Buffer Queue
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

This is a re-roll of the previous attempt to submit, because it caused
failures in arm and aarch64.

Reviewers: majnemer, echristo, rSerge

Subscribers: tberghammer, danalbert, srhines, modocache, mehdi_amini, mgorny, llvm-commits

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

llvm-svn: 288775
2016-12-06 06:24:08 +00:00
Chris Bieneman 31150cbdc9 Revert "builtins: Add ARM Thumb1 implementation for uidiv and uidivmod"
This reverts commit r288710.

r288710 breaks building the builtin libraries on Darwin for armv7em.

Build logs may still be avaialable here:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/12035/console

llvm-svn: 288773
2016-12-06 05:41:32 +00:00
Serge Rogatch 882fc5d0a3 [XRay][AArch64] Attempt to fix unstable test XRay-aarch64-linux::patching-unpatching.cc
Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris

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

llvm-svn: 288729
2016-12-05 23:29:56 +00:00
Mike Aizatsky 48ee418f88 [sanitizers] mac prints null differently
llvm-svn: 288726
2016-12-05 23:06:07 +00:00
Mike Aizatsky 0d98da7c1f [sanitizers] __sanitizer_get_module_and_offset_for_pc interface function
Summary: The function computes full module name and coverts pc into offset.

Reviewers: kcc

Subscribers: kubabrecka

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

llvm-svn: 288711
2016-12-05 21:45:14 +00:00
Weiming Zhao adf4258f50 builtins: Add ARM Thumb1 implementation for uidiv and uidivmod
Summary:
The current uidiv supports archs without clz. However, the asm is for thumb2/arm.
For uidivmod, the existing code calls the C version of uidivmodsi4, which then calls uidiv. The extra push/pop/bl makes it less efficient.

Reviewers: jmolloy, jroelofs, joerg, compnerd, rengolin

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288710
2016-12-05 21:40:36 +00:00
Kuba Mracek c14916dae7 [compiler-rt] Remove duplicates from COMPILER_RT_SUPPORTED_ARCH
Since we’re adding an entry into COMPILER_RT_SUPPORTED_ARCH for all architectures of all Darwin platforms, COMPILER_RT_SUPPORTED_ARCH often ends up having duplicate items. Let’s remove them.

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

llvm-svn: 288681
2016-12-05 17:52:45 +00:00
Daniel Jasper 724df6e8b7 Remove a couple of memset usages from TSan, introduced in r288624.
TSan runtime shouldn't contain memset, so internal_memset is used
instead and syntax that emits memset is avoided.

This doesn't fail in-tree due to TSan being build with -03, but it fails
when TSan is built with -O0, and is (I think) a true positive.

Patch by Sam McCall, review: https://reviews.llvm.org/D27407

llvm-svn: 288672
2016-12-05 14:37:42 +00:00
Kuba Mracek 8f34233318 [sanitizer] Make atos stdin a non-tty pipe to make sure it's not stuck waiting for user input
On macOS, we often symbolicate using atos (when llvm-symbolizer is not found). The current way we invoke atos involves creating a pseudo-terminal to make sure atos doesn't buffer its output. This however also makes atos think that it's stdin is interactive and in some error situations it will ask the user to enter some input instead of just printing out an error message. For example, when Developer Mode isn't enabled on a machine, atos cannot examine processes, and it will ask the user to enter an administrator's password, which will make the sanitized process get stuck. This patch only connects the pseudo-terminal to the stdout of atos, and uses a regular pipe as its stdin.

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

llvm-svn: 288624
2016-12-04 21:52:21 +00:00
Kuba Mracek 3eb98a1318 [sanitizer] Track architecture and UUID of modules in LoadedModule
When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well.

This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis.

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

llvm-svn: 288537
2016-12-02 21:27:14 +00:00
Filipe Cabecinhas 8c1c8e5d7c Revert "Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)"
This reverts commit r288504.

clang-bpf-build fails with no details:
******************** TEST 'AddressSanitizer-x86_64-linux ::
TestCases/masked-ops.cpp' FAILED ********************
Script:
--
/mnt/buildbot/slave-root/clang-bpf-build/stage1/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -o /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp -mavx -O1
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l1 2>&1 | FileCheck -check-prefix=CHECK-L1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp l6 2>&1 | FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp la 2>&1 | FileCheck -check-prefix=CHECK-LA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
not /mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s1 2>&1 | FileCheck -check-prefix=CHECK-S1 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp s6 2>&1 | FileCheck -check-prefix=CHECK-S6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
/mnt/buildbot/slave-root/clang-bpf-build/stage1/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/masked-ops.cpp.tmp sa 2>&1 | FileCheck -check-prefix=CHECK-SA /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp
--
Exit Code: 2

Command Output (stderr):
--
FileCheck error: '-' is empty.
FileCheck command line:  FileCheck -check-prefix=CHECK-L6 /mnt/buildbot/slave-root/clang-bpf-build/llvm/projects/compiler-rt/test/asan/TestCases/masked-ops.cpp

--

********************

llvm-svn: 288507
2016-12-02 16:19:14 +00:00
Filipe Cabecinhas 2f461bf24a Compiler-rt part of D26230: Add (constant) masked load/store support (Try #2)
Summary:
Unfortunately, there is no way to emit an llvm masked load/store in
clang without optimizations, and AVX enabled. Unsure how we should go
about making sure this test only runs if it's possible to execute AVX
code.

Reviewers: kcc, RKSimon, pgousseau

Subscribers: kubabrecka, dberris, llvm-commits

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

llvm-svn: 288504
2016-12-02 15:33:04 +00:00
NAKAMURA Takumi 5ce101a848 compiler-rt/test/profile/Linux/lit.local.cfg: [Py3] Use text mode (universal_newlines=True).
llvm-svn: 288490
2016-12-02 08:17:17 +00:00
Maxim Ostapenko 6bdcb1f0e9 [sanitizer] Add a bunch of ifdefs for sparc targets to avoid build failures.
Differential Revision: https://reviews.llvm.org/D27301

llvm-svn: 288488
2016-12-02 08:07:35 +00:00
Stephan Bergmann 612d8c66f4 Don't include system header inside namespace
...causes build failure at least with GCC 6.2.1, as smmintrin.h indirectly
includes cstdlib, which then runs into problems.

llvm-svn: 288486
2016-12-02 08:03:57 +00:00
Saleem Abdulrasool aba0edb340 build: fix building for Windows after SVN r287465
The previous change for enabling MinGW did not preserve the Win32 check and
added the EABI specific routines to a Windows build which does not use the EABI
routines.  Correct the conditional check for that.

llvm-svn: 288422
2016-12-01 22:00:54 +00:00
Evgeniy Stepanov e109ef854a Release memory to OS only when the requested range covers the entire page
Summary:
The current code was sometimes attempting to release huge chunks of
memory due to undesired RoundUp/RoundDown interaction when the requested
range is fully contained within one memory page.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 288271
2016-11-30 20:41:59 +00:00
Kostya Kortchinsky 1148dc5274 [scudo] 32-bit and hardware agnostic support
Summary:
This update introduces i386 support for the Scudo Hardened Allocator, and
offers software alternatives for functions that used to require hardware
specific instruction sets. This should make porting to new architectures
easier.

Among the changes:
- The chunk header has been changed to accomodate the size limitations
  encountered on 32-bit architectures. We now fit everything in 64-bit. This
  was achieved by storing the amount of unused bytes in an allocation rather
  than the size itself, as one can be deduced from the other with the help
  of the GetActuallyAllocatedSize function. As it turns out, this header can
  be used for both 64 and 32 bit, and as such we dropped the requirement for
  the 128-bit compare and exchange instruction support (cmpxchg16b).
- Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2
  instruction set is supported, use the 32-bit CRC32 instruction, and in the
  XorShift128, use a 32-bit based state instead of 64-bit.
- Add software support for CRC32: if SSE 4.2 is not supported, fallback on a
  software implementation.
- Modify tests that were not 32-bit compliant, and expand them to cover more
  allocation and alignment sizes. The random shuffle test has been deactivated
  for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't
  currently randomize chunks.

Reviewers: alekseyshl, kcc

Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache

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

llvm-svn: 288255
2016-11-30 17:32:20 +00:00
Maxim Ostapenko d136340166 [asan] Avoid redundant poisoning checks in __sanitizer_contiguous_container_find_bad_address.
__sanitizer_contiguous_container_find_bad_address computes three regions of a
container to check for poisoning: begin, middle, end. The issue is that in current
design the first region can be significantly larger than kMaxRangeToCheck.

Proposed patch fixes a typo to calculate the first region properly.

Patch by Ivan Baravy.

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

llvm-svn: 288234
2016-11-30 09:11:47 +00:00
Kuba Mracek 4edffbd28c [asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS <=10.10)
This fixes https://llvm.org/bugs/show_bug.cgi?id=30285. On macOS 10.10 and lower, instrumented unit tests still need to be able to re-exec to make interceptors work.

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

llvm-svn: 288224
2016-11-30 00:46:04 +00:00
Xinliang David Li 8b19a0a100 [Profile] Fix value profiler eviction bug
Differential Revision: https://reviews.llvm.org/D27224

llvm-svn: 288204
2016-11-29 22:00:54 +00:00
Kuba Mracek ff1bd20ded [sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

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

llvm-svn: 288186
2016-11-29 19:25:53 +00:00
Filipe Cabecinhas c707bbf081 Revert "Compiler-rt part of D26230: Add (constant) masked load/store support"
This reverts commit r288162. Buildbot clang-bpf-build fails running tests.

llvm-svn: 288173
2016-11-29 18:08:24 +00:00
Filipe Cabecinhas bca5fd4f81 Compiler-rt part of D26230: Add (constant) masked load/store support
Summary:
Unfortunately, there is no way to emit an llvm masked load/store in
clang without optimizations, and AVX enabled. Unsure how we should go
about making sure this test only runs if it's possible to execute AVX
code.

Reviewers: kcc, RKSimon, pgousseau

Subscribers: kubabrecka, dberris, llvm-commits

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

llvm-svn: 288162
2016-11-29 16:56:59 +00:00
Bob Haarman 9ee65aca3d [profile] use GetComputerNameExW instead of gethostname on Windows
Summary: In profile data paths, we replace "%h" with the hostname of the machine the program is running on. On Windows, we used gethostname() to obtain the hostname. This requires linking with ws2_32. With this change, we instead get the hostname from GetComputerNameExW(), which does not require ws2_32.

Reviewers: rnk, vsk, amccarth

Subscribers: zturner, ruiu, hans

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

llvm-svn: 288146
2016-11-29 15:24:00 +00:00
Marcin Koscielnicki 3089884bcf Revert "Revert "[ASan] Enable on SystemZ.""
This reverts commit r287767.

Hopefully, the tests should be fixed by D27118.

llvm-svn: 288116
2016-11-29 08:25:00 +00:00
Saleem Abdulrasool f9d34dfbe4 builtins: switch to c11 from c99
This fixes an incorrect standard usage of GNU99 when the compiler check was for
the ISO standard C99.  Furthermore, bump the dependency up to C11.  The
motivation for this change is ARM EHABI compatibility with clang 3.8.  We rely
on a type definition redefinition which causes an error with -Werror builds.
This is problematic for FreeBSD builds.  Switching to C11 allows the
compatibility without the unnecessary pedantic warning.  The alternative would
be to clutter the support header with a `pragma clang diagnostic ignore`.  GCC
4.8+ and the supported clang revisions along with MSVC support enough of C11 to
allow building the builtins in C11 mode.  No functional change intended.

llvm-svn: 288099
2016-11-29 02:31:40 +00:00
Evgeniy Stepanov d3305afc75 Return memory to OS right after free (not in the async thread).
Summary:
In order to avoid starting a separate thread to return unused memory to
the system (the thread interferes with process startup on Android,
Zygota waits for all threads to exit before fork, but this thread never
exits), try to return it right after free.

Reviewers: eugenis

Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 288091
2016-11-29 00:22:50 +00:00
Kuba Mracek 87b3634615 [asan] Refactor shadow memory initialization out of AsanInitInternal [NFC]
Differential Revision: https://reviews.llvm.org/D27137

llvm-svn: 288072
2016-11-28 21:40:41 +00:00
Kuba Mracek 809dea2aeb [asan] Attempt to fix the debug_double_free.cc testcase on Windows after r288065.
llvm-svn: 288067
2016-11-28 21:28:41 +00:00
Kuba Mracek 48090f5b82 [asan] Provide bug descriptions for all reports (not just ErrorGeneric)
Differential Revision: https://reviews.llvm.org/D27012

llvm-svn: 288065
2016-11-28 21:18:15 +00:00
Marcin Koscielnicki b3d93889f5 [sanitizers] Get the proper printf/scanf version when long double transition is involved.
See D19555 for rationale.  As it turns out, this treatment is also necessary
for scanf/printf.

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

llvm-svn: 288064
2016-11-28 21:15:19 +00:00
Kuba Mracek 3a481cf0bd [tsan] Fix the lit expansion of %deflake not to eat a space
The lit expansion of "%deflake " (notice the space after) expands in a way that the space is removed, this fixes that.

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

llvm-svn: 287989
2016-11-26 19:09:32 +00:00
Kuba Mracek 23551fa811 [asan] Support handle_sigill on Darwin
Handling SIGILL on Darwin works fine, so let's just make this feature work and re-enable the ill.cc testcase.

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

llvm-svn: 287959
2016-11-26 01:30:31 +00:00
Kuba Mracek 073cea6128 [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV
This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag.

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

llvm-svn: 287957
2016-11-26 00:50:08 +00:00
Dean Michael Berris 291d74bdb4 Revert "[XRay][compiler-rt] XRay Buffer Queue"
Broke the build on arm7 and aarch64.

llvm-svn: 287911
2016-11-25 03:54:45 +00:00
Dean Michael Berris 47119579c8 [XRay][compiler-rt] XRay Buffer Queue
Summary:
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

Reviewers: majnemer, rSerge, echristo

Subscribers: mehdi_amini, mgorny, llvm-commits

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

llvm-svn: 287910
2016-11-25 03:14:10 +00:00
Kuba Mracek b59118f6ec [tsan] Add support for GCD dispatch_suspend and dispatch_resume
GCD queues can be suspended and resumed with dispatch_suspend and dispatch_resume. We need to add synchronization between the call to dispatch_resume and any subsequent executions of blocks in the queue that was resumed. We already have an Acquire(q) before the block executes, so this patch just adds the Release(q) in an interceptor of dispatch_resume.

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

llvm-svn: 287902
2016-11-24 21:24:54 +00:00
Vedant Kumar 3ac1d4dc10 [test] Use a helper macro to refer to MAP_ANON (NFC)
Some of our internal bots use old SDK's which don't define MAP_ANON.
Use a helper macro to pass the right flag into mmap().

llvm-svn: 287833
2016-11-23 22:23:42 +00:00
Reid Kleckner 3c3fe5d885 [asan/win] Skip incremental linker padding during unregistration
Should fix issues that came up while testing Win64 ASan.

llvm-svn: 287791
2016-11-23 18:28:04 +00:00
Reid Kleckner ff8f2b8f89 [asan/win] Check assumptions about the incremental linker more
Remove a needless cast as well.

llvm-svn: 287785
2016-11-23 18:02:16 +00:00
Reid Kleckner f174a0bbd2 [asan/win] Fix incremental linking vs. global registration
The MSVC incremental linker pads every global out to 256 bytes in case
it changes size after an incremental link. So, skip over null entries in
the DSO-wide asan globals array. This only works if the global padding
size is divisible by the size of the asan global object, so add some
defensive CHECKs.

llvm-svn: 287780
2016-11-23 17:37:00 +00:00
Marcin Koscielnicki 441dd21da9 Revert "[ASan] Enable on SystemZ."
This reverts commit r287764.

Two tests broke on the clang-s390x-linux buildbot:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/1293.

llvm-svn: 287767
2016-11-23 16:07:07 +00:00
Marcin Koscielnicki 9a02c55edf [ASan] Enable on SystemZ.
Differential Revision: http://reviews.llvm.org/D21831

llvm-svn: 287764
2016-11-23 15:47:41 +00:00
Marcin Koscielnicki 5bdf70f410 [profile] Enable on SystemZ.
Differential Revision: http://reviews.llvm.org/D21738

llvm-svn: 287748
2016-11-23 08:28:42 +00:00
Dean Michael Berris 3076d43f9a [XRay][compiler-rt] Add newlines to error messages (NFC).
This goes through all the calls to `Report(...)` to make sure that each
one would have a newline at the end of the message for readability.

llvm-svn: 287736
2016-11-23 04:47:41 +00:00
Kuba Mracek e99e8d345c [sanitizer] Fix the dedup_token_length_test.cc testcase to not fail when user's home directory contains "bar"
Differential Revision: https://reviews.llvm.org/D24605

llvm-svn: 287696
2016-11-22 20:24:26 +00:00
Dmitry Vyukov 9c5bab23ee tsan: fix build after 287632
1. Mac does not have MAP_32BIT.
Define it to 0 if it is not defined.

2. We are lacking nolibc stub for ListOfModules::init.
Add it.

llvm-svn: 287634
2016-11-22 11:09:35 +00:00
Dmitry Vyukov 5c5d4766f8 tsan: switch libignore from /proc/self/maps to dl_iterate_phdr
/proc/self/maps can't be read atomically, this leads to episodic
crashes in libignore as it thinks that a module is loaded twice.
See the new test for an example.
dl_iterate_phdr does not have this problem.
Switch libignore to dl_iterate_phdr.

llvm-svn: 287632
2016-11-22 09:49:11 +00:00
Dmitry Vyukov 8b2ddfeb0b tsan: mark cur_thread_placeholder definition as initial-exec
See https://sourceware.org/bugzilla/show_bug.cgi?id=20805 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294 for context.
Previously we marked only declaration as initial-exec. But compilers treat
initial-exec attribute somewhat differently. Mark definition as well.

llvm-svn: 287629
2016-11-22 08:59:17 +00:00
Kuba Mracek d692ea1e87 [asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deployment target of 10.11+)
The ODR detection in initialization-bug.cc now works on Darwin (due to the recently enabled "live globals" on-by-default), but only if the deployment target is 10.11 or higher. Let's adjust the testcases.

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

llvm-svn: 287581
2016-11-21 21:48:25 +00:00
Ivan Krasin 694c28495a Add a test for vcall on a null ptr.
Summary:
Turns out that in the case of -fsanitize=null and a virtual call,
the type check was generated *after* reading from vtable, which
causes a non-interpretable segfault. The check has been moved up
in https://reviews.llvm.org/D26559 and this CL adds a test for this case.

Reviewers: pcc

Subscribers: cfe-commits, kubabrecka

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

llvm-svn: 287578
2016-11-21 21:23:56 +00:00
Reid Kleckner 7a7477c71f [asan] Un-XFAIL Windows global dead stripping test cases
Test update for r287576

llvm-svn: 287577
2016-11-21 20:40:56 +00:00
Dean Michael Berris bad8f0feb4 [XRay] Support AArch64 in compiler-rt
This patch adds XRay support in compiler-rt for AArch64 targets.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
Clang: https://reviews.llvm.org/D26415

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown

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

llvm-svn: 287517
2016-11-21 03:20:43 +00:00
Martin Storsjo 8c59680ac2 builtins: Allow building windows arm functions for mingw
When building with clang/LLVM in MSVC mode, the msvcrt libraries contain
these functions.

When building in a mingw environment, we need to provide them somehow,
e.g. via compiler-rt.

The aeabi divmod functions work in the same way as the corresponding
__rt_*div* functions for windows, but their parameters are swapped.
The functions for converting float to integer and vice versa are the
same as their aeabi equivalents, only with different function names.

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

llvm-svn: 287465
2016-11-19 21:22:38 +00:00
Renato Golin 2b9d742ae7 [ARM|ASAN] Disabling more unstable ASAN tests
We're seeying these errors with GCC and Clang on different systems, while
some other identical OSs on different boards fail. Like many other ASAN
tests, there seem to be no easy way to investigate this other than someone
familiar with the sanitizer code and the ARM libraries.

At least, for now, we'll silence the bots. I'll create a bugzilla entry.

llvm-svn: 287464
2016-11-19 21:19:19 +00:00
Mike Aizatsky 7594ec3355 rename InternalBinarySearch to InternalLowerBound
Summary: The new name better corresponds to its logic.

Reviewers: kcc

Subscribers: kubabrecka

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

llvm-svn: 287377
2016-11-18 20:48:52 +00:00
Saleem Abdulrasool 865a671fa2 builtins: repair the builtins build with clang 3.8
When the C unwinding personality was corrected to match the ARM EHABI
specification, the unwind header in clang was updated with necessary
declarations.  However, when building with an older compiler, we would not have
the necessary declarations.  This would result in a build failure.  Provide a
supplementary header to ensure that the necessary declarations are present for
the build of the C unwinding personality.

Note that this is NOT an ABI break.  It merely is a compile time failure due to
the constants not being present.  The constants here are reproduced
equivalently.  This header should permit building with clang[<3.9] as well as
gcc.

Addresses PR31035!

llvm-svn: 287359
2016-11-18 18:21:06 +00:00
Mike Aizatsky 1e0093eb87 [sanitizers] specifying style for global constant
Subscribers: kubabrecka

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

llvm-svn: 287268
2016-11-17 21:57:43 +00:00
Reid Kleckner 39950b0f92 [asan] Create a .ASAN$G(A-Z) section for global registration
Summary:
The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

The two tests added for this feature will fail until the LLVM
instrumentation change in D26770 lands, so they are marked XFAIL for
now.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits, mgorny

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

llvm-svn: 287246
2016-11-17 19:02:53 +00:00
Michal Gorny a07c531ef9 [tests] Use __SSE2__ (rather than __i686__...) for SSE2 ASAN test
Use the __SSE2__ to determine whether SSE2 is enabled in the ASAN tests
rather than relying on either of the __i686__ and __x86_64__. The former
is only set with explicit -march=i686, and therefore misses most of
the x86 CPUs that support SSE2. __SSE2__ is in turn defined if
the current settings (-march, -msse2) indicate that SSE2 is supported
which should be more reliable.

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

llvm-svn: 287245
2016-11-17 18:41:54 +00:00
Anna Zaks 4cb4c7f4b1 [asan] Update the tests as Mach-O metadata liveness tracking is on by default
This commit reverts r274579.

llvm-svn: 287236
2016-11-17 16:56:11 +00:00
Mike Aizatsky 423405b19f adding operator* to help working with primitive values
Subscribers: kubabrecka

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

llvm-svn: 287144
2016-11-16 19:35:37 +00:00
Diana Picus 87d025f1ce [XRay][compiler-rt] Attempt to fix ARM buildbots after r287068
Include xray_defs.h in xray_arm.cc (seems to be the only one that doesn't
include it).

Buildbot errors:
[...]/compiler-rt/lib/xray/xray_arm.cc:31:58: error: expected initializer before 'XRAY_NEVER_INSTRUMENT'
 inline static uint32_t getMovwMask(const uint32_t Value) XRAY_NEVER_INSTRUMENT {

llvm-svn: 287089
2016-11-16 09:32:23 +00:00
Mike Aizatsky ff3bdbac35 fixing binary search for cases when element is not in array
Subscribers: kubabrecka

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

llvm-svn: 287078
2016-11-16 04:03:27 +00:00
Dean Michael Berris 4031e4b95d [XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime.
Summary:
Adds a CMake check for whether the compiler used to build the XRay
library supports XRay-instrumentation. If the compiler we're using does
support the `-fxray-instrument` flag (i.e. recently-built Clang), we
define the XRAY_NEVER_INSTRUMENT macro that then makes sure that the
XRay runtime functions never get XRay-instrumented.

This prevents potential weirdness involved with building the XRay
library with a Clang that supports XRay-instrumentation, and is
attempting to XRay-instrument the build of compiler-rt.

Reviewers: majnemer, rSerge, echristo

Subscribers: mehdi_amini, llvm-commits, mgorny

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

llvm-svn: 287068
2016-11-16 01:01:13 +00:00
Reid Kleckner c9b27ba11d Allow users to call ASan's deadly exception report mechanism
Users often have their own unhandled exception filters installed. ASan
already goes to great lengths to install its own filter, but our core
wars with Chrome crashpad have escalated to the point that its time to
declare a truce. By exposing this hook, they can call us directly when
they want ASan crash reporting without worrying about who initializes
when.

llvm-svn: 287040
2016-11-15 21:54:58 +00:00
Kuba Brecka cf8d1fc3d8 [asan] Re-enable the use-after-scope-types.cc test on Darwin, now that r287028 fixed the llvm-symbolizer issue that broke this test.
Differential Revision: https://reviews.llvm.org/D26537

llvm-svn: 287029
2016-11-15 21:08:51 +00:00
Kuba Brecka 5b2e4e3c66 [tsan] Call pthread interceptors directly in TSan RTL unit tests
On Darwin, we're running the TSan unit tests without interceptors. To make sure TSan observes all the pthread events (thread creating, thread join, condvar signal, etc.) in tsan_posix.cc, we should call the pthread interceptors directly, as we already do in tsan_test_util_posix.cc. This fixes some flaky failures on Darwin bots.

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

llvm-svn: 287026
2016-11-15 21:00:55 +00:00
Reid Kleckner 34652925cb [asan] Reduce prototype duplication with decltype
NFC

llvm-svn: 287000
2016-11-15 18:38:41 +00:00
Reid Kleckner 0d7c42c7ab [asan] Don't assert that a target is within 2GB on 32-bit Windows
Summary:
In a 32-bit address space, PC-relative jump targets are wrapped, so a
direct branch at 0x90000001 can reach address 0x10000000 with a
displacement of 0x7FFFFFFFF. This can happen in applications, such as
Chrome, that are linked with /LARGEADDRESSAWARE.

Reviewers: etienneb

Subscribers: mgorny, llvm-commits

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

llvm-svn: 286997
2016-11-15 18:29:17 +00:00
Anna Zaks 71b55d92c5 [asan] Fixup to r286608 that makes the test pass on iOS.
TARGET_OS_IPHONE is defined in TargetConditionals.h. Without the include the
iOS path is never triggered.

llvm-svn: 286929
2016-11-15 01:57:29 +00:00
Vedant Kumar 8f21c0e50a [cfi] Mark tests as xfailing on Darwin
This allows them to be run on other platforms, undoing damage from
r286902.

llvm-svn: 286904
2016-11-14 23:12:52 +00:00
Vedant Kumar 4f4e522b97 [cfi] Mark some tests as requiring additional support from the MachO writer
These tests need to be marked as unsupported on Darwin:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1545

llvm-svn: 286902
2016-11-14 22:50:13 +00:00
Kuba Brecka b0dd454a1a [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), compiler-rt part
This adds support for TSan C++ exception handling, where we need to add extra calls to __tsan_func_exit when a function is exitted via exception mechanisms. Otherwise the shadow stack gets corrupted (leaked). This patch moves and enhances the existing implementation of EscapeEnumerator that finds all possible function exit points, and adds extra EH cleanup blocks where needed.

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

llvm-svn: 286894
2016-11-14 21:41:33 +00:00
Evgeniy Stepanov eee04c8f12 Temporarily relax test expectations to fix failures on ppc64.
Summary: Relax test expectations to fix failures on ppc64.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 286885
2016-11-14 20:46:52 +00:00
Kuba Brecka 41c52889b9 [sanitizer] Max out allowed macOS deployment targets to 10.9
It's not a good idea to build the sanitizers with e.g. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12, because some deprecated functions that we intercept will cause build errors. Let's limit the allowed deployment targets to 10.9 (which is the default anyway), and warn when it's set above.

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

llvm-svn: 286859
2016-11-14 18:27:47 +00:00
Reid Kleckner d0c646117f Remove pwd to fix WinASan bot
It only slipped in while I was debugging the test case.

llvm-svn: 286854
2016-11-14 18:02:42 +00:00
Reid Kleckner 171a7022aa Split strncmp and strncasecmp test and XFAIL one for Windows
llvm-svn: 286850
2016-11-14 17:51:11 +00:00
Reid Kleckner e1e344ed05 [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization
Summary:
ASan needs to initialize before ucrtbase.dll so that it can intercept
all of its heap allocations. New versions of dbghelp.dll depend on
ucrtbase.dll, which means both of those DLLs will initialize before the
dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we
avoid the issue.

Eventually, I would like to remove our dbghelp.dll dependency in favor
of always using llvm-symbolizer.exe, but this seems like an acceptable
interim solution.

Fixes PR30903

Reviewers: etienneb

Subscribers: kubabrecka, mgorny, llvm-commits

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

llvm-svn: 286848
2016-11-14 17:37:50 +00:00
Strahinja Petrovic f10d114d43 [lsan] [aarch64] Fix printing of pointers in make check tests - update
This patch replaces fprintf with print_address function in LSAN
tests. This is necessary because of different printing of pointers
in fprintf and sanitizer's print function. 
Differential Revision: https://reviews.llvm.org/D26084.

llvm-svn: 286816
2016-11-14 11:40:56 +00:00
Vitaly Buka c557191b21 [asan] Fix strncmp and strncasecmp interceptors
Summary:
In non-strict mode we will check memory access for both strings from beginning
to either:
  1. 0-char
  2. size
  3. different chars

In strict mode we will check from beginning to either:
  1. 0-char
  2. size

Previously in strict mode we always checked up to the 0-char.

Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 286708
2016-11-12 04:32:31 +00:00
Anna Zaks 03136efd1b [tsan] Test that false races from ObjC's dealloc, .cxx_destruct, and initialize are ignored
Differential Revision: https://reviews.llvm.org/D26228

llvm-svn: 286693
2016-11-12 00:46:07 +00:00
Evgeniy Stepanov ececb37e39 [tsan] Fix typo in test.
llvm-svn: 286674
2016-11-11 23:25:09 +00:00
Reid Kleckner cb03ef90bb Disable a test using posix_spawn on Android
llvm-svn: 286673
2016-11-11 23:23:33 +00:00
Evgeniy Stepanov 31f4eb5f5b Tread TSan LLVM flags to driver: unit tests.
Summary: Unit tests for the new clang flags.

Reviewers: eugenis, dvyukov

Subscribers: kubabrecka, llvm-commits

Patch by Alex Shlyapnikov.

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

llvm-svn: 286670
2016-11-11 23:17:49 +00:00
Anna Zaks be15addffe [tsan] Expose __tsan_ignore_thread_begin and __tsan_ignore_thread_end in TSan interface
This patch is needed to implement the function attribute that disable TSan checking at run time.

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

llvm-svn: 286658
2016-11-11 22:43:12 +00:00
Evgeniy Stepanov a0fb81fe37 [cfi] Test case for weak symbol handling.
llvm-svn: 286637
2016-11-11 21:39:35 +00:00
Reid Kleckner 47dc7f5550 Add a test that uses coverage and printf from a DLL
This test fails without LLVM r286615

llvm-svn: 286618
2016-11-11 19:27:52 +00:00
Evgeniy Stepanov 753953b02d [cfi] Tweak a test for the cfi-icall change.
llvm-svn: 286612
2016-11-11 18:49:15 +00:00
Reid Kleckner 359fafe74c Add missing %run to test to fix AArch64 buildbot
llvm-svn: 286609
2016-11-11 18:11:33 +00:00
Reid Kleckner 2a2bc7293e [asan/win] Fix wrong TerminateProcess exit code
Add a test for it.

llvm-svn: 286608
2016-11-11 17:51:51 +00:00
Sylvestre Ledru 3383f946ab Force the locale when executing ld gold
Summary:
If run with other locales (like French),
the decode operation might fail

This is the same change as in r246421 for llvm.

llvm-svn: 286605
2016-11-11 17:46:51 +00:00
Sagar Thakur cdfdff0b18 [MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64
Changed the kernel sigaction structure in test syscalls_sigaction.cc for MIPS according to the structure defined in kernel.

Reviewed by eugenis.
Differential: https://reviews.llvm.org/D25814

llvm-svn: 286583
2016-11-11 12:05:30 +00:00
Reid Kleckner 949f9b9f64 [asan/win] Move breakpoint from Abort to internal__exit
Now that we use TerminateProcess, the debugger doesn't stop on program
exit. Add this breakpoint so that the debugger stops after asan reports
an error and is prepared to exit the program.

llvm-svn: 286501
2016-11-10 20:44:05 +00:00
Kostya Serebryany 56cec3d662 [lsan] fix a rare lsan false positive: ensure that we don't re-sort the chunks_ array while iterating over it. A test is hard to create, but I've added a consistency check that fires w/o the fix on existing tests. The bug analysis and the initial patch were provided by Pierre Bourdon
llvm-svn: 286478
2016-11-10 17:27:28 +00:00
Reid Kleckner 76b4261082 [asan/win] Use TerminateProcess when we want to exit abnormally
ExitProcess still runs some code which can lead to ASan interceptors
running after CHECK failure. This can lead to deadlock if it CHECK fails
again. Avoid that mess by really exiting immediately.

llvm-svn: 286395
2016-11-09 21:27:58 +00:00
Jonas Hahnfeld 8530137de5 Pacify lint check
llvm-svn: 286346
2016-11-09 08:36:45 +00:00
Evgeniy Stepanov a50bc7fddb [asan] Ignore host LD_LIBRARY_PATH in device tests.
I'm not sure why is it there, but it is breaking tests on Android N
because of unexpected linker output about an empty LD_LIBRARY_PATH
entry.

llvm-svn: 286321
2016-11-09 00:33:43 +00:00
Evgeniy Stepanov fcba0d647c [asan] Disable unexpected passing test.
This test fails on some versions of Android and passes on other versions.
Replace XFAIL with UNSUPPORTED.

llvm-svn: 286320
2016-11-09 00:33:41 +00:00
Reid Kleckner d092107b0e [asan/win] Add init hooks to .CRT$XLAB
Summary:
User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
Chromium:
https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs

This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.

The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.

Reviewers: etienneb

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 286290
2016-11-08 20:45:45 +00:00
Dmitry Vyukov 62f99cc486 tsan: more precise handling of atomic stores
Atomic stores terminate release sequences on the atomic variable,
and must use ReleaseStore primitive instead of Release.
This was broken in r192355 during a refactoring.
Restore correct behavior and add a test.

llvm-svn: 286211
2016-11-08 05:34:50 +00:00
Evgeniy Stepanov f95e706371 [asan] Add missing header in a test.
llvm-svn: 286191
2016-11-08 01:17:58 +00:00
Evgeniy Stepanov 11d3b27959 [asan] Fix asan-rt bitness issues in asan_device_setup on Android.
asan_device_setup script is using LD_PRELOAD to inject the ASan
runtime library into the Zygote process. This breaks when the Zygote
or any of its descendants spawn a process with different bitness due
to the fact that the ASan-RT library name includes the target
architecture.

The fix is to preload the library through a symlink which has the
same name in lib and lib64.

llvm-svn: 286188
2016-11-08 00:59:58 +00:00
Evgeniy Stepanov 4fcbb24deb [asan] Fix one test on Android N.
A fake strtol interceptor should at least make forward progress.

llvm-svn: 286187
2016-11-08 00:59:54 +00:00
Kuba Brecka c784b36fca [tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments don't have nullptr.
llvm-svn: 286166
2016-11-07 22:26:13 +00:00
Evgeniy Stepanov 5d387286d0 Use -fsanitize-recover instead of -mllvm -msan-keep-going: tests.
Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: unit tests.

Reviewers: eugenis

Subscribers: llvm-commits

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

Patch by Aleksey Shlyapnikov.

llvm-svn: 286149
2016-11-07 21:02:56 +00:00
Kuba Brecka 19679f97ed [tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part
Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

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

llvm-svn: 286136
2016-11-07 19:10:13 +00:00
Reid Kleckner 3501fdcb30 [asan] Add more dynamic CRT mode tests
Only tests using %clang_cl_asan were using the dynamic CRT before this.
The unit tests and lit tests using %clangxx_asan were using the static
CRT. Many cross-platform tests fail with the dynamic CRT, so I had to
add win32-(static|dynamic)-asan lit features.

Also deletes some redundant tests in TestCases/Windows that started
failing with this switch.

llvm-svn: 285821
2016-11-02 15:39:08 +00:00
Dean Michael Berris 0d86810158 [XRay][x86_64] Define a tail exit trampoline.
Summary:
We define a new trampoline that's a hybrid between the exit and entry
trampolines with the following properties:

- Saves all of the callee-saved registers according to the x86_64
  calling conventions.
- Indicate to the log handler function being called that this is a
  function exit event.

This fixes a bug that is a result of not saving enough of the register
states, and that the log handler is clobbering registers that would be
used by the function being tail-exited into manifesting as runtime
errors.

Reviewers: rSerge, echristo, majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 285787
2016-11-02 04:11:29 +00:00
Kuba Brecka be0f80a284 [tsan] Enable the tsan/libcxx/ testcase(s) on Darwin
Apparently, the std_shared_ptr.cc testcase works fine on Darwin, even without the instrumented libcxx. Let's enable it.

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

llvm-svn: 285634
2016-10-31 20:50:15 +00:00
Kuba Brecka 1f7deb8908 [tsan] Implement WriteMemoryProfile for Darwin
TSan’s memory usage profiling currently doesn’t work on Darwin. This patch implements measuring the amount of resident and dirty memory for each memory region. I also removed the GetShadowMemoryConsumption function, which seems to be unused.

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

llvm-svn: 285630
2016-10-31 20:17:13 +00:00
Kuba Brecka bf6e7848a0 [asan] Move instrumented null-terminated strings to a special section, compiler-rt part
On Darwin, simple C null-terminated constant strings normally end up in the __TEXT,__cstring section of the resulting Mach-O binary. When instrumented with ASan, these strings are transformed in a way that they cannot be in __cstring (the linker unifies the content of this section and strips extra NUL bytes, which would break instrumentation), and are put into a generic __const section. This breaks some of the tools that we have: Some tools need to scan all C null-terminated strings in Mach-O binaries, and scanning all the contents of __const has a large performance penalty. This patch instead introduces a special section, __asan_cstring which will now hold the instrumented null-terminated strings.

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

llvm-svn: 285620
2016-10-31 18:52:32 +00:00
Kuba Brecka 0222eacf0f [tsan] Add support for GCD target queues
GCD (libdispatch) has a concept of “target queues”: Each queue has either an implicit or explicit target queue, where the task is handed over to when it’s time to execute it. For example, a concurrent queue can have a serial target queue (effectively making the first queue serial), or multiple queues can have the same serial target queue (which means tasks in all the queues are mutually excluded). Thus we need to acquire-release semantics on the full “chain” of target queues.

This patch changes the way we Acquire() and Release() when executing tasks in queues. Now we’ll walk the chain of target queues and synchronize on each queue that is serial (or when dealing with a barrier block). This should avoid false positives when using dispatch_set_target_queue().

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

llvm-svn: 285613
2016-10-31 18:28:02 +00:00
Reid Kleckner 18817c35be [ASan] Initialize cloned dynamic runtime global variables earlier
Otherwise __asan_dynamic_memory_address will be zero during static
initialization and instrumented code will crash immediately.

Fixes PR30810

Patch by David Major

llvm-svn: 285600
2016-10-31 17:13:02 +00:00
Anna Zaks 7be6b4963c [asan] Set the darwin deployment target for the dead-strip test
ASan dead-strip support relies on a linker option that only exists
in 10.11 and later, so the LLVM instrumentation checks for the deployment
target. This test does not pass when clang is built to choose lower
deployment target by default but runs on newer host.

(Note, the REQUIRES: osx-ld64-live_support clause only checks the host
and not the target OS.)

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

llvm-svn: 285482
2016-10-29 00:27:07 +00:00
Saleem Abdulrasool 2678d023ca build: give aliases the same visibility
ARM EABI also uses function aliases.  Ensure that those aliased functions are
given proper visibility annotations.

llvm-svn: 285478
2016-10-28 23:37:50 +00:00
Saleem Abdulrasool 2594717436 builtins: ensure that VISIBILITY_HIDDEN is defined properly
The CMake build system had missed this macro as part of the build of the
builtins.  This would result in the builtins exporting symbols which are
implemented in assembly with global visibility.  Ensure that the assembly
optimized routines are given the same visibility as the C routines.

llvm-svn: 285477
2016-10-28 23:19:03 +00:00
Dmitry Vyukov 1a75379b24 tsan: add a hook to obtain number of reports
Requested in:
https://github.com/golang/go/issues/15972
Will help to fail individual test cases with races.

llvm-svn: 285455
2016-10-28 21:25:37 +00:00
Dmitry Vyukov 0b00a7fc6e tsan: round Go shadow to page boundary
There is a corner case reported in Go issue tracker:
https://github.com/golang/go/issues/17065
On darwin data/bss segments may not be aligned to page bounary
and mmap seems to be behaving differently than on linux
(shrinks instead of enlarge unaligned regions).

Explicitly round shadow to page bounary before mapping
to avoid any such problems.

llvm-svn: 285454
2016-10-28 21:24:29 +00:00
Dmitry Vyukov 8ee6f0c30f tsan: set disable_coredump=0 by default for Go
Go maps shadow memory lazily, so we don't have the huge multi-TB mapping.
Virtual memory consumption is proportional to normal memory usage.
Also in Go core dumps are enabled explicitly with GOTRACEBACK=crash,
if user explicitly requests a core that must be on purpose.

So don't disable core dumps by default.

llvm-svn: 285451
2016-10-28 20:52:22 +00:00
Dmitry Vyukov 5dc443619e tsan: always define SANITIZER_GO
Currently we either define SANITIZER_GO for Go or don't define it at all for C++.
This works fine with preprocessor (ifdef/ifndef/defined), but does not work
for C++ if statements (e.g. if (SANITIZER_GO) {...}). Also this is different
from majority of SANITIZER_FOO macros which are always defined to either 0 or 1.

Always define SANITIZER_GO to either 0 or 1.
This allows to use SANITIZER_GO in expressions and in flag default values.

Also remove kGoMode and kCppMode, which were meant to be used in expressions,
but they are not defined in sanitizer_common code, so SANITIZER_GO become prevalent.

Also convert some preprocessor checks to C++ if's or ternary expressions.

Majority of this change is done mechanically with:
sed "s#ifdef SANITIZER_GO#if SANITIZER_GO#g"
sed "s#ifndef SANITIZER_GO#if \!SANITIZER_GO#g"
sed "s#defined(SANITIZER_GO)#SANITIZER_GO#g"

llvm-svn: 285443
2016-10-28 20:14:18 +00:00
Dmitry Vyukov 693163e723 tsan: fix windows meta mapping
Currently windows fails on startup with:
CHECK failed: gotsan.cc:3077 "(((m - prev_m) / kMetaShadowSize)) == (((p - prev) / kMetaShadowCell))" (0x3ffffffeffffff7e, 0x6ffffff7e)

Make MemToMeta do the same MemToShadow does on windows: add offset instead of or'ing it.

llvm-svn: 285420
2016-10-28 17:25:27 +00:00
Dmitry Vyukov 128bd99808 tsan: fix code formatting
llvm-svn: 285418
2016-10-28 17:23:08 +00:00
Dmitry Vyukov a2a677c542 sanitizer_common: fix description of disable_coredump flag
s/disable_core/disable_coredump/
Add missing space in text.

llvm-svn: 285401
2016-10-28 14:25:51 +00:00
Dmitry Vyukov 7e6f8db7aa tsan: fix windows build
Currently fails with:

C:\workdir\compiler-rt\lib\tsan\go>gcc -c -o race_windows_amd64.syso gotsan.cc -I..\rtl -I..\.. -I..\..\sanitizer_common -I..\..\..\include -m64 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO -Wno-error=at
tributes -Wno-attributes -Wno-format -Wno-maybe-uninitialized -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer -std=c++11 
gotsan.cc:9229:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/alternatename:__sanitizer_print_memory_profile=__sanitizer_default_print_memory_profile") // NOLINT
 ^
gotsan.cc: In function 'void __sanitizer_print_memory_profile(int)':
gotsan.cc:9226:17: error: redefinition of 'void __sanitizer_print_memory_profile(int)'
 extern "C" void __sanitizer_print_memory_profile(int top_percent) {}
                 ^
gotsan.cc:6898:6: note: 'void __sanitizer_print_memory_profile(int)' previously defined here
 void __sanitizer_print_memory_profile(int top_percent) {


Remove __sanitizer_print_memory_profile from Go build, it is not needed.

llvm-svn: 285400
2016-10-28 14:16:13 +00:00
Maxim Ostapenko 49504fa211 [asan] Run pthread_create_from_constructor test on x86 targets.
llvm-svn: 285389
2016-10-28 09:49:34 +00:00
Maxim Ostapenko ee84db84d4 [asan] Disable pthread_create_from_constructor test on PowerPC64.
llvm-svn: 285387
2016-10-28 08:45:23 +00:00
Maxim Ostapenko 984f42eed5 [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread initialization.
There is possible deadlock in dynamic ASan runtime when we dlopen() shared lib
which creates a thread at the global initialization stage. The scenario:

1) dlopen grabs a GI_pthread_mutex_lock in main thread.
2) main thread calls pthread_create, ASan intercepts it, calls real pthread_create
   and waits for the second thread to be "fully initialized".
3) Newly created thread tries to access a thread local disable_counter in LSan
   (to complete its "full initialization") and hangs in tls_get_addr_tail, because
   it also tries to acquire GI_pthread_mutex_lock.

The issue is reproducible on relative recent Glibc versions e.g. 2.23.

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

llvm-svn: 285385
2016-10-28 06:49:53 +00:00
Vitaly Buka d6eee81790 [asan] Test jumps which bypass variables declaration
Summary:
Clang should not generate lifetime intrinsics for such variables. D24693

PR28267

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 285343
2016-10-27 21:02:32 +00:00
Richard Smith f8520559ce Atomics library: provide operations for __int128 when it is available.
llvm-svn: 285265
2016-10-27 01:46:24 +00:00
Anna Zaks be7ae6684f [sanitizers] Set Darwin specific linker and compiler flags for all tests
Looks like we are missing these flags only in tsan and sanitizer-common.

This results in linker warnings in some settings as it can cause the Unit
tests to be built with a different SDK version than that was used to build
the runtime. For example, we are not setting the minimal deployment target
on the tests but are setting the minimal deployment target for the sanitizer
library, which leads to the following warning on some bots: ld: warning:
object file (sanitizer_posix_test.cc.i386.o) was built for newer OSX version
(10.12) than being linked (10.11).

Differential Revision: https://reviews.llvm.org/D25860  https://reviews.llvm.org/D25352

llvm-svn: 285255
2016-10-26 23:23:38 +00:00
Kostya Kortchinsky 71dcc33c58 [scudo] Lay the foundation for 32-bit support
Summary:
In order to support 32-bit platforms, we have to make some adjustments in
multiple locations, one of them being the Scudo chunk header. For it to fit on
64 bits (as a reminder, on x64 it's 128 bits), I had to crunch the space taken
by some of the fields. In order to keep the offset field small, the secondary
allocator was changed to accomodate aligned allocations for larger alignments,
hence making the offset constant for chunks serviced by it.

The resulting header candidate has been added, and further modifications to
allow 32-bit support will follow.

Another notable change is the addition of MaybeStartBackgroudThread() to allow
release of the memory to the OS.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 285209
2016-10-26 16:16:58 +00:00
Robert Lougher 8e075fd086 [ubsan] Fix vptr.cpp test to be more resilient. NFC.
The test contains a switch statement in which two of the cases are
tail-merged, with the call to __ubsan_handle_dynamic_type_cache_miss_abort
in the common tail. When tail-merging occurs, the debug location of the
tail is randomly taken from one of the merge inputs.  Luckily for the test,
the expected line number in the check is the one which is chosen by the
tail-merge.  However, if the switch cases are re-ordered the test will
fail.

This patch disables tail-merge, making the test resilient to changes
in tail-merge, and unblocking review D25742.  It does not change the
semantics of the test.

llvm-svn: 285208
2016-10-26 16:02:36 +00:00
Renato Golin 81e8b771d7 [ARM RT] Fix broken clear_cache debug build on ARM
clear_cache is using R7 for the SVC call and that's the frame pointer in
GCC, which is only disabled on -O2/3, so Release builds finish, Debug don't.

Fixes PR30797.

llvm-svn: 285204
2016-10-26 15:20:33 +00:00
Maxim Ostapenko 6aafa89c34 [lsan] Relax check for allocator_end in ProcessGlobalRegionsCallback.
Differential Revision: https://reviews.llvm.org/D25945

llvm-svn: 285177
2016-10-26 06:56:51 +00:00
Nico Weber 0519a53d7d Remove a VS 2012 workaround, we require 2015 now.
llvm-svn: 285096
2016-10-25 18:48:43 +00:00
Peter Collingbourne 4e271c947c scripts: Document existing problems with the symbolizer build script.
Reviewers: eugenis, vitalybuka

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 285013
2016-10-24 20:15:39 +00:00
Bob Haarman 2bf4a14b3e [compiler-rt] moved __asan_schedule_unregister_globals out of anonymous namespace
Summary: Newer versions of clang complain that __asan_schedule_unregister_globals is unused. Moving it outside the anonymous namespace gets rid of that warning.

Reviewers: rnk, timurrrr

Subscribers: kubabrecka, dberris

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

llvm-svn: 285010
2016-10-24 19:56:18 +00:00
Tim Northover 5adb224bc2 [asan] relax strstr tests.
Darwin's implementation of strstr seems to trigger slightly different failure
modes from Linux since it calls strncmp. All messages seem about equally useful
and correct, so I relaxed the tests so Darwin can pass.

llvm-svn: 285004
2016-10-24 19:07:27 +00:00
Mandeep Singh Grang 249237cb2e [compiler-rt] Remove redundant --check-prefix=CHECK from test
Reviewers: eugenis, rengolin

Subscribers: dberris

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

llvm-svn: 284932
2016-10-23 00:55:12 +00:00
Kostya Serebryany 110e2e52b7 [sanitizers] support strict_string_checks for strncmp
llvm-svn: 284901
2016-10-21 23:52:26 +00:00
Richard Smith 104887ed08 Fix typo (ordered comparison between pointer and 0).
llvm-svn: 284886
2016-10-21 21:37:18 +00:00
Mike Aizatsky 8210959afd adding new symbols to llvm-symbolizer symbol test
llvm-svn: 284773
2016-10-20 20:33:54 +00:00
Strahinja Petrovic 19610a33c1 [lsan] [aarch64] Fix printing of pointers in make check tests
This patch replaces fprintf with print_address function
in LSAN tests. This is necessary because of different 
printing of pointers in fprintf and sanitizer's print 
function. Differential Revision: https://reviews.llvm.org/D25270.

llvm-svn: 284722
2016-10-20 12:25:57 +00:00
Vitaly Buka 832c383b25 [asan] Update test for D25715
Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 284548
2016-10-18 23:30:07 +00:00