Commit Graph

5956 Commits

Author SHA1 Message Date
Reid Kleckner d85f7010cc [windows] Implement GetProcAddress internally to avoid initializing the CRT
ASan uses GetProcAddress to get the address of malloc so it can patch
it. Newer versions of Windows make GetProcAddress initialize the DLL
before returning a function pointer into it. That's perfectly
reasonable, but ASan needs to finish patching malloc before CRT
initialization. So now we roll our own GetProcAddress.

Fixes PR24237

Based on a patch by David Major

Originally written by David Major as part of:
https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h

llvm-svn: 245377
2015-08-18 22:38:27 +00:00
Alexey Samsonov 0a779d7e3d [Sanitizer] Initialize common flags to default values in unit tests.
llvm-svn: 245363
2015-08-18 21:54:32 +00:00
Alexey Samsonov 9a28358a03 [DFSan] Properly initialize and parse common flags in DFSan.
llvm-svn: 245362
2015-08-18 21:54:29 +00:00
Evgeniy Stepanov 35b0eaf23d [msan] Intercept openpty and forkpty.
llvm-svn: 245345
2015-08-18 20:36:48 +00:00
Chris Bieneman d8b76ce3bf [CMake] Backing out part of r245317. Turns out safestack and profile don't work correctly on the iOS simulator and enabling it breaks tests.
llvm-svn: 245326
2015-08-18 18:35:18 +00:00
Dan Albert b5226576ea Implement __aeabi_{f,d}rsub.
Summary: Implement the missing ARM EABI functions _aeabi_frsub and __aeabi_drsub.

Reviewers: rengolin, compnerd

Subscribers: pirama, srhines, danalbert, aemerson, llvm-commits

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

llvm-svn: 245321
2015-08-18 18:10:33 +00:00
Chris Bieneman 201d065259 [CMake] Refactoring add_compiler_rt functions for darwin runtimes.
Summary: This patch consolidates add_compiler_rt_osx_static_runtime and add_compiler_rt_darwin_dynamic_runtime into a single new function add_compiler_rt_darwin_runtime.

Reviewers: filcab, samsonov, bogner

Subscribers: llvm-commits

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

llvm-svn: 245317
2015-08-18 17:32:18 +00:00
Sergey Dmitrouk d5a00e8e3c [compiler-rt] Add AArch64 to CMake configuration and several missing builtins
Summary:
Currently CMake doesn't build builtins for AArch64 and if one does this anyway
it's likely that at least `__multc3`, `__floatditf` and `__floatunditf` will be
missing.  There is actually more builtins to add, but these come from
different libc implementations, thus providing them makes compiler-rt for
AArch64 good enough at least for basic usage.

Builtins implementation were originally taken from FreeBSD project:

 * [[ https://reviews.freebsd.org/D2173 | __multc3 ]]
 * [[ https://reviews.freebsd.org/D2174 | __floatditf and __floatunditf ]]

Until they have been tested to find mistakes in `__float*` functions.
`__floatditf` was based on `__floatsitf`, which had the same mistakes
(fixed it in r243746).

Version of the builtins in this patch are fixed and complemented with basic
tests.  Additionally they were tested via GCC's torture (this is what revealed
these issues).

P.S. Ed (author of FreeBSD patches) asked for feedback on the list some time ago (here [[ http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/084064.html | here ]])
and got no response, but it seems to be worth adding these builtins as is and
extracting common part later.

Reviewers: howard.hinnant, t.p.northover, jmolloy, enefaim, rengolin, zatrazz

Subscribers: asl, emaste, samsonov, aemerson, llvm-commits, rengolin

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

llvm-svn: 245296
2015-08-18 13:43:37 +00:00
Renato Golin 4eb82578ea Revert "[sanitizer] Move definition of stable-runtime to common lit config."
This reverts commit r245263, and the change wasn't catched by UBsan.

It also reverts: "[ARM] Also disable stable-runtime check on UBsan,
to use generic one" (r245287), as it didn't fix the UBsan builds.

We need to investigate what's going on before continuing, since this
is breaking all ARM RT buildbots for a while.

llvm-svn: 245292
2015-08-18 12:44:55 +00:00
Renato Golin f71aed7e24 [ARM] Also disable stable-runtime check on UBsan, to use generic one
llvm-svn: 245287
2015-08-18 10:33:15 +00:00
Evgeniy Stepanov d457df8008 [sanitizer] Move definition of stable-runtime to common lit config.
There are tests in sanitizer_common that are unconditionally disabled
because they REQUIRE: stable-runtime which is never defined.

llvm-svn: 245263
2015-08-18 01:06:51 +00:00
Reid Kleckner 4ca630be18 Fixup stale comment about supported OSs
llvm-svn: 245089
2015-08-14 20:01:27 +00:00
Reid Kleckner 14b7dde85f Move ASAN_OPTIONS setting from compile command to run command, fixes test on posix
llvm-svn: 245079
2015-08-14 18:29:00 +00:00
Reid Kleckner 89d994367a [windows] Fix or XFAIL remaining portable test failures and enable them
Summary:
This involved various fixes:

- Move a test that uses ulimit to Posix.

- Add a few "REQUIRES: shell" lines to tests using backtick subshell
  evaluation.

- The MSVC CRT buffers stdio if the output is a pipe by default. Some
  tests need that disabled to avoid interleaving test stdio with asan
  output.

- MSVC headers provide _alloca instead of alloca (go figure), so add a
  portability macro to the two alloca tests.

- XFAIL tests that rely on accurate symbols, we need to pass more flags
  to make that work.

- MSVC's printf implementation of %p uses upper case letters and doesn't
  add 0x, so do that manually.

- Accept "SEGV" or "access-violation" reports in crash tests.

Reviewers: samsonov

Subscribers: tberghammer, danalbert, llvm-commits, srhines

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

llvm-svn: 245073
2015-08-14 17:39:48 +00:00
Naomi Musgrave 0e7ac9ab2b Removed xfail, since test is passing in line with expanded dtor sanitizing functionality
Summary: Fixed test in response to buildbot failures from last night.

Reviewers: eugenis, kcc

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

llvm-svn: 244952
2015-08-13 20:54:05 +00:00
Chris Bieneman 361231ecd5 [CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.

Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.

This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.

Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov

Subscribers: jevinskie, filcab, llvm-commits

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

llvm-svn: 244948
2015-08-13 20:38:16 +00:00
Alexey Samsonov ff1ca4af4b [UBSan] Enable 'help' option output, report unrecognized flags
Summary:
Let UBSan output flag description if 'help' options is provided.
Report unrecognized flags if verbosity mode is turned on.

Patch by Svetlana Ryabkova!

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

llvm-svn: 244946
2015-08-13 20:34:00 +00:00
Reid Kleckner afbb1a9523 Add more error logging to win/asan
llvm-svn: 244940
2015-08-13 20:10:54 +00:00
Reid Kleckner e4fabc9a87 Same fix as r244908 for sanitizer_win.cc instead of asan_win.cc
I forgot to audit lib/sanitizer_common for the same issue.  This fixes
writing out coverage files on exit.

llvm-svn: 244910
2015-08-13 16:40:54 +00:00
Reid Kleckner dd7b4406d1 Fix installation of the unhandled exception filter with r244767
Apparently /Zc:inline causes static globals in custom sections to be
discarded if they are unreferenced.

llvm-svn: 244908
2015-08-13 16:37:28 +00:00
Daniel Jasper 166d516603 Revert "Removed xfail, since test is passing in line with expanded dtor sanitizing functionality"
Still breaking the bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19678/steps/ninja%20check-msan/logs/stdio

llvm-svn: 244873
2015-08-13 07:57:32 +00:00
Reid Kleckner 7d0f22e558 [windows] Fix deadlock on mmap failure due to CHECK recursion
Summary:
Printing a stacktrace acquires a spinlock, and the sanitizer spinlocks
aren't re-entrant. Avoid the problem by reusing the logic we already
have on Posix.

This failure mode is already exercised by the existing mmap_limit_mb.cc
test case. It will be enabled in a forthcoming change, so I didn't add
standalone tests for this change.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244840
2015-08-12 23:55:38 +00:00
Reid Kleckner 85220d0218 Use %env_asan_opts= substitution instead of 'env ASAN_OPTIONS=$ASAN_OPTIONS'
Summary:
The lit internal shell is used by default on Windows, and it does not
support bash variable expansion. Because bash variable expansion
interacts with tokenization, it is prohibitively difficult to make the
existing lit shell do general shell variable expansion.

The most common use of shell variables in the asan tests is to add
options to the default set of options set by lit.cfg. We can avoid the
need for variable expansion with a substitution that expands to 'env
ASAN_OPTIONS=<defaults:>'.

This has the side benefit of shortening the RUN lines, so it seemed
better than implementing limited variable expansion in lit.

Reviewers: samsonov, filcab

Subscribers: llvm-commits

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

llvm-svn: 244839
2015-08-12 23:50:12 +00:00
Reid Kleckner 3f3af2cf74 [windows] Always use the lit shell on Windows, even if bash is present
Summary:
This is consistent with LLVM and Clang. The lit shell isn't a complete
bash implementation, but its behavior is more easily reproducible.  This
fixes some ubsan test failures.

One ubsan test requires a shell currently, so I added "REQUIRES: shell",
and the other doesn't work on Windows because it prints a stack trace
and uses a linker that doesn't support DWARF. We can fix it eventually
through other means.

Reviewers: samsonov, pcc

Subscribers: yaron.keren, filcab, llvm-commits

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

llvm-svn: 244837
2015-08-12 23:49:52 +00:00
Reid Kleckner f787cdd031 Combine helper file into main test file with ifdefs
Keeping tests isolated to a single file is nice, and it was suggested in
post-commit review for r244827.

llvm-svn: 244833
2015-08-12 23:24:41 +00:00
Reid Kleckner e7ffbffaef Move tests that use unistd.h and pthread.h to TestCases/Posix
llvm-svn: 244827
2015-08-12 22:58:56 +00:00
Naomi Musgrave 93520f09c8 Removed xfail, since test is passing in line with expanded dtor sanitizing functionality
Summary: Fixed test in response to buildbot failures from last night.

Reviewers: eugenis, kcc

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

llvm-svn: 244818
2015-08-12 21:31:27 +00:00
Rafael Espindola cc45ee9a63 Try to fix the MSVC build now that we use /Zc:inline.
Thanks to Majnemer for the help.

llvm-svn: 244786
2015-08-12 18:09:44 +00:00
Daniel Jasper c2207c2791 Revert "Revised test to pass under updated dtor callback implementation"
This breaks the buildbot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19656

llvm-svn: 244724
2015-08-12 08:13:39 +00:00
Naomi Musgrave e9971acc0c Revised test to pass under updated dtor callback implementation
Summary: New implementation for dtor sanitizer callback poisons only class members, and emits poisoning callback before base dtor invoked.

Reviewers: eugenis, kcc

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

Explicit dtor invocation

llvm-svn: 244709
2015-08-12 01:15:28 +00:00
Chris Bieneman ba325eaa4c NFC. Fixing a red squiggly line in my editor.
llvm-svn: 244699
2015-08-11 23:31:43 +00:00
Reid Kleckner c1cd8dd4de Revert the rest of r244634, since it breaks the standalone build
compiler-rt can apparently be built without an installed copy of LLVM,
so we can't call its cmake code.

llvm-svn: 244647
2015-08-11 18:43:13 +00:00
Daniel Sanders 1f4bd3dd89 [ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Account for the case when uptr is 32-bit instead of trying to fix this case
using the little endian path.

llvm-svn: 244646
2015-08-11 18:40:02 +00:00
Reid Kleckner 0e58a9d82b Include sanitizer_posix.h to try to fix the mac build
Linux must pick it up transitively.

llvm-svn: 244645
2015-08-11 18:29:32 +00:00
Reid Kleckner 269d406a9d [windows] Use lld-link instead of lld-link2, the latter no longer exists
The test passed for me locally because I had a stale copy of
lld-link2.exe.

llvm-svn: 244638
2015-08-11 17:36:09 +00:00
Reid Kleckner b5093187f9 Revert part of the last cmake change, it broke configuring with libcxx on Linux for me
llvm-svn: 244635
2015-08-11 17:22:06 +00:00
Reid Kleckner d3bb924410 [cmake] Handle external source for lld and libcxx
As requested in post-commit review of r244549.

llvm-svn: 244634
2015-08-11 17:18:23 +00:00
Reid Kleckner 46ed25e199 [windows] Remove CHECK for strdup symbol that comes from the CRT
llvm-symbolizer isn't symbolizing it for some reason. I'll investigate.

llvm-svn: 244629
2015-08-11 16:56:26 +00:00
Reid Kleckner 9aec282de2 Speculative fix for Mac build
llvm-svn: 244623
2015-08-11 16:30:27 +00:00
Reid Kleckner 7d9e1e1259 [Windows] Use llvm-symbolizer before using dbghelp
Summary:
llvm-symbolizer understands both PDBs and DWARF, so it's a better bet if
it's available. It prints out the function parameter types and column
numbers, so I needed to churn the expected test output a bit.

This makes most of the llvm-symbolizer subprocessing code
target-independent. Pipes on all platforms use fd_t, and we can use the
portable ReadFromFile / WriteToFile wrappers in symbolizer_sanitizer.cc.
Only the pipe creation and process spawning is Windows-specific.

Please check that the libcdep layering is still correct. I don't know
how to reproduce the build configuration that relies on that.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244616
2015-08-11 15:51:40 +00:00
Filipe Cabecinhas 7317de6c15 [compiler-rt] Add SourceLocations for float_cast_overflow data.
Summary:
Compiler-rt part of http://reviews.llvm.org/D11757
I ended up making UBSan work with both the old version and the new
version of the float_cast_overflow data (instead of just erroring with
the previous version). The old version will try to symbolize its caller.

Now we compile the float_cast_overflow tests without -g, and make sure
we have the source file+line+column.

If you think I'm trying too hard to make sure we can still use both
versions, let me know.

Reviewers: samsonov, rsmith

Subscribers: llvm-commits

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

llvm-svn: 244567
2015-08-11 04:19:24 +00:00
Reid Kleckner 45ebaf1840 [cmake] Hoist check for LLD sources up into root CMakeLists.txt
We will use this for ASan on Windows soon. When the ELF port of LLD
matures, we can add other sanitizer integration tests to make sure they
work with LLD.

llvm-svn: 244549
2015-08-11 00:33:07 +00:00
Reid Kleckner a0f78fef74 [sanitizers] Use portable file read/write wrappers on process pipes
This fixes a minor error checking bug around calling
internal_read/write, and makes the code more portable for D11791.

llvm-svn: 244546
2015-08-11 00:30:22 +00:00
Reid Kleckner e96833e648 [Windows] Implement FileExists, ReadFromFile, and FindPathToBinary
Summary: These are needed to talk to llvm-symbolizer on Windows.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244533
2015-08-10 23:40:27 +00:00
Reid Kleckner c0120a3000 [Windows] Relax test case patterns to allow parameter lists
llvm-symbolizer will print parameter types.  Split out from D11791.

NFC

llvm-svn: 244522
2015-08-10 22:43:04 +00:00
Naomi Musgrave 8759aa3db1 test case for poisoning trivial members
Summary:
A virtual base class and derived class should only poison their
respective members upon destruction. In particular, trivial members should
be poisoned directly, non-trivial members should be poisoned by their
respective destructors, and references to non-trivial members should be
poisoned.

Reviewers: eugenis, kcc

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

Test case avoids casting to access members

Run configurations to reflect expected runtime failure on assertions.

Simplified access to internal members.

Updated internal member structure of base.

Revised assert in main to verify successful poisoning after dtor.

Verify address of pointer is poisoned.

Fixed assert err.

Cleaned up test by removing extraneous prints, asserts.

llvm-svn: 244521
2015-08-10 22:39:09 +00:00
Filipe Cabecinhas 2bbdbcb835 Fix typo.
llvm-svn: 244475
2015-08-10 18:26:29 +00:00
David Blaikie 57add8ddfb -Wdeprecated: Use noexcept rather than throw() where supported
Summary: I've copy/pasted the LLVM_NOEXCEPT definition macro goo from LLVM's Compiler.h. Is there somewhere I should put this in Compiler RT? Is there a useful header to define/share things like this?

Reviewers: samsonov

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

llvm-svn: 244453
2015-08-10 15:24:22 +00:00
Renato Golin 86474c7a1a [ASAN/AArch64] Disable forkpty tests until we can fix them
Reported in PR24400. Disable until it works, so we can keep the rest
tested and green.

llvm-svn: 244398
2015-08-08 15:47:17 +00:00
Evgeniy Stepanov aa91588b6c [asan] Try different values of the shadow gap start.
The number of unaccessible pages at the beginning of the address
space can differ between processes on the same machine. Try different
values at runtime to protect as much memory as possible.

llvm-svn: 244364
2015-08-07 22:38:44 +00:00
Evgeniy Stepanov 290d721070 [asan] Reduce shadow gap start on 32-bit Android.
This fixes an internal assertion failure when running out of
the address space in the large allocator.

llvm-svn: 244359
2015-08-07 21:17:46 +00:00
Renato Golin 827a40b944 [Compiler-RT] Disable TSAN on AArch64 temporarily
Until all problems with the buildbot can be identified and fixed.

llvm-svn: 244324
2015-08-07 15:41:43 +00:00
Renato Golin 2ab51bf13a [ASAN] Disable ManyThreadsTest in AArch64
This test was in an infinite loop in AArch64. We're investigating it
on PR24389, but I'm disabling it for now, so that we continue testing
everything else.

llvm-svn: 244316
2015-08-07 12:40:05 +00:00
Renato Golin 5da19695c5 [ASAN/AArch64] Make sure aarch64 is not stable-runtime
llvm-svn: 244263
2015-08-06 20:34:51 +00:00
Peter Collingbourne 01101b7b5f test: Use lld-link instead of lld-link2 as the LTO linker on Windows.
The old COFF linker has been removed and lld-link now refers to the new linker.

llvm-svn: 244243
2015-08-06 18:37:54 +00:00
Kostya Serebryany cc9fd3cbe9 [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM)
llvm-svn: 244234
2015-08-06 17:52:54 +00:00
Renato Golin 4ae2e1f575 Revert "[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski"
This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline.

llvm-svn: 244210
2015-08-06 12:42:46 +00:00
Reid Kleckner 27dddfc118 Add flag to request codeview debug info on Windows
Needed after fixing PR22032.

llvm-svn: 244162
2015-08-05 22:48:26 +00:00
Kostya Serebryany ce1799a83f [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski
llvm-svn: 244136
2015-08-05 21:19:11 +00:00
Renato Golin 12a7cdc3a0 [AArch64] Stable runtime required for proc maps test
llvm-svn: 244105
2015-08-05 19:45:26 +00:00
Alexey Samsonov 894d5821e7 [UBSan] Fix UBSan-vptr false positive.
Offset from vptr to the start of most-derived object can actually
be positive in some virtual base class vtables.

Patch by Stephan Bergmann!

llvm-svn: 244101
2015-08-05 19:35:46 +00:00
Kostya Serebryany b6804dbf43 [sanitizer] fix the Mac build (hopefully)
llvm-svn: 244099
2015-08-05 18:56:42 +00:00
Renato Golin 4481fe0f1f [AArch64] Fixes broken bot fue to TSAN patch
Patch by Adhemerval Zanella.

llvm-svn: 244088
2015-08-05 18:34:20 +00:00
Kostya Serebryany dd8b3952b8 [libFuzzer] add weak hooks for strcmp
llvm-svn: 244083
2015-08-05 18:20:54 +00:00
Kostya Serebryany 823e85c37e [libFuzzer/DFSan] add more __sanitizer callbacks to dfsan blacklist
llvm-svn: 244082
2015-08-05 18:20:15 +00:00
Hans Wennborg 92e6412f29 Try to fix sanitizer_win.cc compile error on 64-bit after r243895
llvm-svn: 244077
2015-08-05 17:55:26 +00:00
Adhemerval Zanella d7984710ae [tsan] Enable tsan for aarch64
This patch enabled TSAN for aarch64 with 39-bit VMA layout.  As defined by
tsan_platform.h the layout used is:

0000 4000 00 - 0200 0000 00: main binary
2000 0000 00 - 4000 0000 00: shadow memory
4000 0000 00 - 5000 0000 00: metainfo
5000 0000 00 - 6000 0000 00: -
6000 0000 00 - 6200 0000 00: traces
6200 0000 00 - 7d00 0000 00: -
7d00 0000 00 - 7e00 0000 00: heap
7e00 0000 00 - 7fff ffff ff: modules and main thread stack

Which gives it about 8GB for main binary, 4GB for heap and 8GB for
modules and main thread stack.

Most of tests are passing, with the exception of:

 * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for
   no support to make mmap page non-executable.

 * longjmp tests due missing specialized assembly routines.

These tests are xfail for now.

The only tsan issue still showing is:

  rtl/TsanRtlTest/Posix.ThreadLocalAccesses

Which still required further investigation.  The test is disable for
aarch64 for now.

llvm-svn: 244055
2015-08-05 15:17:59 +00:00
Adhemerval Zanella 975998bf6a [asan] Enable asan for aarch64
This patch enables asan for aarch64/linux.  It marks it as 'unstable-release',
since some tests are failing due either kernel missing support of non-executable
pages in mmap or environment instability (infinite loop in juno reference
boards).

It sets decorate_proc_maps test to require stable-release, since the test expects
the shadow memory to not be executable and the support for aarch64 is only
added recently by Linux (da141706aea52c1a9 - 4.0).

It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call
as a TLS optimization.

llvm-svn: 244054
2015-08-05 15:13:33 +00:00
Tanya Lattner bba51dc31f Update references to new lists.llvm.org mailing lists.
llvm-svn: 244002
2015-08-05 03:58:00 +00:00
Naomi Musgrave 2551b62931 Runtime check of poisoning derived class members.
Summary: Simple test case to verify that an instance of a derived class with virtual base is properly poisoned

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

modified test to be more concise, and check the local pointer to the destroyed object

revised test to not examine padding- only explicit object members

llvm-svn: 243913
2015-08-03 23:01:19 +00:00
Reid Kleckner 646386e779 [asan] Print VAs instead of RVAs for module offsets on Windows
Summary:
This is consistent with binutils and ASan behavior on other platforms,
and makes it easier to use llvm-symbolizer with WinASan. The
--relative-address flag to llvm-symbolizer is also no longer needed.

An RVA is a "relative virtual address", meaning it is the address of
something inside the image minus the base of the mapping at runtime.

A VA in this context is an RVA plus the "preferred base" of the module,
and not a real runtime address. The real runtime address of a symbol
will equal the VA iff the module is loaded at its preferred base at
runtime.

On Windows, the preferred base is stored in the ImageBase field of one
of the PE file header, and this change adds the necessary code to
extract it. On Linux, this offset is typically included in program and
section headers of executables.

ELF shared objects typically use a preferred base of zero, meaning the
smallest p_vaddr field in the program headers is zero. This makes it so
that PIC and PIE module offsets come out looking like RVAs, but they're
actually VAs. The difference between them simply happens to be zero.

Reviewers: samsonov, majnemer

Subscribers: llvm-commits

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

llvm-svn: 243895
2015-08-03 19:51:18 +00:00
Kuba Brecka fe17cee960 [asan] Fix dyld version detection on OS X
We currently have a dyld check in DyldNeedsEnvVariable that detects whether we are on a new OS X (10.11+) where we don't need to re-exec. For iOS simulator, we have a dlsym() hack that checks for a specific symbol, but this turns out to be fragile and problematic, because dlsym can sometimes call malloc(), which is not a good idea this early in the process runtime.

Let's instead of this do a direct comparison of dyld's version, which is exported in a public symbol `dyldVersionNumber`.

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

llvm-svn: 243879
2015-08-03 14:48:59 +00:00
Evgeniy Stepanov c86e7cfee9 [asan] Link tests with ld.gold on Android.
ld.bfd fails to find dependencies of asan runtime library w/o an
extra -rpath-link pointing to usr/lib under the sysroot. Gold does
not have this problem.

llvm-svn: 243802
2015-08-01 00:01:23 +00:00
Alexey Samsonov 25ac9311d0 [ASan] Fix two tests on FreeBSD: alloca.h is missing there.
llvm-svn: 243800
2015-07-31 23:57:06 +00:00
Alexey Samsonov 1e156011d1 [Sanitizer] Try to fix sanitizer_libc_test on FreeBSD.
llvm-svn: 243797
2015-07-31 23:02:51 +00:00
Evgeniy Stepanov fef29821a7 [asan] Fix wrong __ANDROID_API__ preprocessor condition.
This fixes report symbolization on L devices when building for API
level 21 or 22.

llvm-svn: 243787
2015-07-31 21:35:15 +00:00
Alexey Samsonov 356ac539c3 [CMake] Don't build libc++ with MSan-with-calls instrumentation.
Instead, refactor the build rules so that we build libc++ with MSan for
each supported architecture.

llvm-svn: 243785
2015-07-31 21:15:34 +00:00
Filipe Cabecinhas 698e8cf845 [UBSan] Test: Move coverage-levels.cc out of Linux directory
Summary:
This test is working on other platforms.

Reviewers: samsonov, emaste

Subscribers: llvm-commits

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

llvm-svn: 243771
2015-07-31 18:18:07 +00:00
Sergey Dmitrouk a2ce083d2d Fix __floatsitf() for negative input
Negative numbers were handled properly initially, but got broken
during addressing review, so none of them did actually work.  Issues:
 * Wrong negation.
 * Wrong exponent calculation.

llvm-svn: 243746
2015-07-31 13:32:09 +00:00
Daniel Sanders adf1fcc2a5 Re-commit r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
The builder remains broken in the same way without this patch so this patch is
innocent.

llvm-svn: 243744
2015-07-31 11:29:25 +00:00
Renato Golin 341d42c270 [AArch64|DFSAN] XPASS custom.cc, as it got fixed by r243686
llvm-svn: 243743
2015-07-31 10:50:29 +00:00
Daniel Sanders 923906a600 Revert r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
It's implicated in a buildbot failure and while the failure looks unrelated,
this commit is the only probably candidate in the blamelist.

llvm-svn: 243740
2015-07-31 09:04:37 +00:00
Kostya Serebryany 4fca6e8063 [libFuzzer] prepare for __sanitizer_cov_trace_switch in libFuzzer and sanitizer coverage. Also fix pedantic warnings
llvm-svn: 243721
2015-07-31 01:07:12 +00:00
Evgeniy Stepanov f3ed62f626 [asan] Fix signal() interception on 64-bit Android.
The bsd_signal() special case only applies to 32-bit Android targets.
Fixes AddressSanitizer.SignalTest on aarch64/android.

llvm-svn: 243714
2015-07-31 00:00:03 +00:00
Adhemerval Zanella 4e3b4ac241 [dfsan] Enable dfsan for aarch64
This patch enable DFSan for AArch64 (39-bit VMA).  All tests are passing
but:

 * test/dfsan/custom.cc

Due an invalid access in dl_iterate_phdr instrumentation (commenting out
this function make the testcase to pass).  The test is XFAIL for aarch64
for now.

llvm-svn: 243688
2015-07-30 21:13:21 +00:00
Daniel Sanders 043717d572 [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmap
Summary:
Using u64 as type for offset changes its value, changing starting address for map in file.
This patch solves Bug 24151, which raises issue while mapping file in mips32.

Patch by Mohit Bhakkad

Reviewers: dsanders, kcc

Subscribers: hans, llvm-commits, samsonov, nitesh.jain, sagar, bhushan, jaydeep

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

llvm-svn: 243686
2015-07-30 21:00:48 +00:00
Evgeniy Stepanov df5ba14731 [asan] Support arm64 devices in asan_device_setup.
llvm-svn: 243679
2015-07-30 20:07:13 +00:00
Naomi Musgrave 64a1bd9db8 testing for tail call optimization repression when sanitizing use-after-dtor
Summary: Verify that running in optimized mode while checking for use-after-dtor errors, does not generate tail call invocation of destructor. This avoids possible error where stack frame for the destructor is eliminated, making tracking down the errors more difficult.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

simplified test cases

updated line numbering on test

renamed test

llvm-svn: 243675
2015-07-30 18:46:18 +00:00
Nico Weber e099213481 Revert r243604, it (very likely) caused PR24312.
llvm-svn: 243615
2015-07-30 03:41:05 +00:00
Kostya Serebryany 66a75c54be [sanitizer] add a weak hook for strncmp interceptor, both to dfsan and other sanitizers. Hide the declaration and the calls in better macros
llvm-svn: 243610
2015-07-30 02:32:51 +00:00
Hans Wennborg 78bea23be0 [CMake] Pass -march=i686 when targeting i686 (PR24222)
Clang will not define __i686__, even when the target triple is i686,
without -march=i686.

With this patch, the compiler-rt build will successfully detect that
Clang can target i686.

The open_memstream.cc test is a little funny. Before my patch, it
was invoked with "-m32 -m64". To make it work after my -march
change, I had to add '-march=x86-64'.

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

llvm-svn: 243604
2015-07-30 01:45:17 +00:00
Kostya Serebryany d99f2b3291 [sanitizer] add a weak hook for memcmp interceptor, to be used primarily for fuzzing. More hooks will be added later. So far this is a Linux-only feature
llvm-svn: 243601
2015-07-30 01:19:17 +00:00
Alexey Samsonov ba46a47e07 [Sanitizer] Replace diagnostic string literal to workaround CMake 2.8 bug.
Let me tell you a story. Suppose you want to build your project (e.g. LLVM)
with CMake 2.8, Clang and AddressSanitizer. You also want to ensure that
Clang is fresh enough and check that CMAKE_CXX_COMPILER_VERSION is 3.1+.
This check would fail - CMake would fail to correctly calculate compiler
version if you pass CMAKE_CXX_FLAGS=-fsanitize=address.

The problem is funky compiler version calculation in
CMakeDetermineCompilerId.cmake module: it compiles the sample source
file with provided compiler and compile flags, runs "strings" and greps
for "INFO:" ASCII strings contained on the executable to fetch
"INFO:compiler", "INFO:compiler_version" etc. It limits the output of
grep to just 4 lines.

Unfortunately, if your executable was built with ASan, it would also contain
an ASCII string
  INFO: %s ignores mlock/mlockall/munlock/munlockall
and INFO:compiler_version string would never be parsed.

All of the above actually happened after r243574 when we tried to
configure libcxx with just-built Clang with TSan/MSan, and the version
check mentioned above failed in HandleLLVMOptions.cmake

(╯°□°)╯.~.┻━┻

llvm-svn: 243599
2015-07-30 00:50:40 +00:00
Kostya Serebryany c69bf1b4c0 [asan,tsan,msan] move the memcmp interceptor from asan/tsan to sanitizer_common. This may potentially lead to more reports from msan as it now sees the reads inside memcmp. To disable, use the flag intercept_memcmp=0. Likewise, it may potentially cause new races to appear due to more strict memcmp checking (flag strict_memcmp=1)
llvm-svn: 243595
2015-07-29 23:53:08 +00:00
Evgeniy Stepanov 1378c683e9 [asan] XFAIL 1 test on Android.
The test uses source file relative paths which does not work when the
test is executed on a remote device.

llvm-svn: 243564
2015-07-29 20:17:21 +00:00
Evgeniy Stepanov 4d81f86d97 [asan] Remove special case mapping on Android/AArch64.
ASan shadow on Android starts at address 0 for both historic and
performance reasons. This is possible because the platform mandates
-pie, which makes lower memory region always available.

This is not such a good idea on 64-bit platforms because of MAP_32BIT
incompatibility.

This patch changes Android/AArch64 mapping to be the same as that of
Linux/AAarch64.

llvm-svn: 243548
2015-07-29 18:22:25 +00:00
Peter Collingbourne ea087056ae CFI: Update tests for various bit vector sizes following lowerbitsets optzns.
Also add a test to ensure that this doesn't regress.

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

llvm-svn: 243547
2015-07-29 18:12:45 +00:00
Reid Kleckner e30c0d25e6 Delete unused <dbghelp.h> include
llvm-svn: 243529
2015-07-29 16:19:40 +00:00
Evgeniy Stepanov 8e36aa6e02 [asan] Support per-application flags in the Android setup script.
llvm-svn: 243494
2015-07-28 22:45:24 +00:00
Evgeniy Stepanov 30257173b3 [sanitizer] Fix Mac build.
llvm-svn: 243480
2015-07-28 21:01:42 +00:00
Evgeniy Stepanov 7eeb02bd09 [asan] Read process name from /proc/self/cmdline on Linux.
Rename getBinaryBasename() to getProcessName() and, on Linux,
read it from /proc/self/cmdline instead of /proc/self/exe. The former
can be modified by the process. The main motivation is Android, where
application processes re-write cmdline to a package name. This lets
us setup per-application ASAN_OPTIONS through include=/some/path/%b.

llvm-svn: 243473
2015-07-28 20:27:51 +00:00
Bill Schmidt 66c8b9ce82 Add commentary explaining PPC access to return address
llvm-svn: 243470
2015-07-28 20:05:06 +00:00
Bill Schmidt a32fa81c09 PowerPC's ABIs differ from those of other architectures in that the
callee-saved return address is stored in the caller's stack frame, not
the callee's.  This patch adjusts the logic to find the LR in the
correct place for PowerPC.

Patch joint with Bill Seurer.

llvm-svn: 243467
2015-07-28 19:41:49 +00:00
Douglas Katzman c4ffd48aba Let cmake infer source file language by the file extension.
This applies default compiler flags to .S files, in particular removing
the "-pedantic" option, which is desirable because there is nothing to
reasonably warn about; and the only thing that gcc warns about is that
you allegedly can't correctly invoke GLUE2 in lib/builtins/assembly.h
on platforms for which USER_LABEL_PREFIX is the empty string.

In the gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33305 that
added the warning, a commenter notes that giving a macro of zero characters
to another macro is not precisely the same as failing to supply an argument,
and "there is a widespread belief in C++ community that such usage is valid".
Unfortunately the only way to silence the warning is to avoid -pedantic.

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

llvm-svn: 243446
2015-07-28 16:52:42 +00:00
Kuba Brecka cd7720c970 Fix typo from r243418. Should fix the failing `abort_on_error.cc` test.
See http://reviews.llvm.org/D7203

llvm-svn: 243426
2015-07-28 15:43:45 +00:00
Kuba Brecka a0905079d5 Applying the Darwin-specific default lit ASAN_OPTIONS to UBSan+ASan tests as
well. Should fix the test failures after r243418, see review at
http://reviews.llvm.org/D7203.

llvm-svn: 243423
2015-07-28 15:35:04 +00:00
Kuba Brecka 873855e291 [asan] Set abort_on_error=1 by default on OS X
This sets the default ASan flags to abort_on_error=1 on OS X. For unit tests and lit tests we set ASAN_OPTIONS back to abort_on_error=0 before running the tests (to avoid crashing). I added two tests that intentionally don't respect the default ASAN_OPTIONS to test the behavior of an empty ASAN_OPTIONS (on OS X we should crash, on Linux we should exit()).

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

llvm-svn: 243418
2015-07-28 14:34:13 +00:00
Sagar Thakur 13af03286e [UBSan][MIPS] Fix cast-overflow tests for mips big endian
This fixes the bug https://llvm.org/bugs/show_bug.cgi?id=24152
The float value resides in the first 4 bytes of ValueHandle for both mips and mipsel.

Reviewers: dsanders, samsonov
Subscibers: rsmith, hans, mohit.bhakkad, jaydeep, llvm-commits
Differential: http://reviews.llvm.org/D11448
llvm-svn: 243384
2015-07-28 05:51:51 +00:00
Kostya Serebryany c520f17c6f [dfsan/libFuzzer] correctly ignore sanitizer coverage calls in dfsan
llvm-svn: 243362
2015-07-28 00:57:07 +00:00
Evgeniy Stepanov 80414569b8 [sanitizer] Fix FreeBSD build of sanitizer_common.
Broken in r243051.

llvm-svn: 243359
2015-07-28 00:29:47 +00:00
Dmitry Vyukov d161fcba17 tsan: fix shift overflow
3<<30 fits into 32-bit unsigned, but does not fit into int.
Found by ubsan.

llvm-svn: 243241
2015-07-26 07:45:26 +00:00
Alexey Samsonov 398a301893 [CMake] Workaround for PR24222: don't fail if we can't target COMPILER_RT_TEST_TARGET_TRIPLE unless it was explicitly set.
Summary:
Although we assume that we can always target host triple, relax
this check to avoid failing at configure-time for cases when we are
not able to correctly infer/verify host triple for some reasons.

See http://llvm.org/bugs/show_bug.cgi?id=24222 for more details.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 243170
2015-07-24 22:01:07 +00:00
Ismail Pazarbasi 0193c3a40e __tsan::ThreadCreate takes incorrect value for detached argument
Summary:
PTHREAD_CREATE_DETACHED has a different value on Mac OS X. Since both
PTHREAD_CREATE_JOINABLE and PTHREAD_CREATE_DETACHED are non-zero,
`__tsan::ThreadCreate` always creates detached threads.

Reviewers: kcc, samsonov, glider

Subscribers: llvm-commits

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

llvm-svn: 243151
2015-07-24 20:00:49 +00:00
Evgeniy Stepanov 7fb865ea8e [asan] Only link liblog on Android when it exists.
With r242975, liblog is only used on certain older platforms.

llvm-svn: 243139
2015-07-24 19:00:16 +00:00
Evgeniy Stepanov f021b9b3b3 [asan] Fix android system property access on aarch64.
__system_property_get is gone from the NDK headers and libs in 64-bit
toolchains, but it is still exported by platform libc.so.

llvm-svn: 243137
2015-07-24 18:57:44 +00:00
Evgeniy Stepanov 6bd82ce870 [sanitizer] Fix double definition of a function.
llvm-svn: 243055
2015-07-23 22:37:39 +00:00
Evgeniy Stepanov 5a268b10b3 [sanitizer] Implement logging to syslog.
Previously, Android target had a logic of duplicating all sanitizer
output to logcat. This change extends it to all posix platforms via
the use of syslog, controlled by log_to_syslog flag. Enabled by
default on Android, off everywhere else.

A bit of cmake magic is required to allow Printf() to call a libc
function. I'm adding a stub implementation to support no-libc builds
like dfsan and safestack.

This is a second attempt. I believe I've fixed all the issues that
prompted the revert: Mac build, and all kinds of non-CMake builds
(there are 3 of those).

llvm-svn: 243051
2015-07-23 22:05:20 +00:00
Kuba Brecka 94da66a92f [asan] Trying to make peace with the Windows bots, take 2
There are some test failures after r243003 and r243004 ("Rename the ABI
versioning symbol to '__asan_version_mismatch_check' instead abusing
'__asan_init'"). See http://reviews.llvm.org/D11004

llvm-svn: 243007
2015-07-23 11:53:58 +00:00
Kuba Brecka 0caef4c8d6 [asan] Trying to make peace with the Windows bots
There are some test failures after r243003 and r243004 ("Rename the ABI
versioning symbol to '__asan_version_mismatch_check' instead abusing
'__asan_init'"). See http://reviews.llvm.org/D11004

llvm-svn: 243005
2015-07-23 11:20:14 +00:00
Kuba Brecka a11cfb990a [asan] Rename the ABI versioning symbol to '__asan_version_mismatch_check' instead of abusing '__asan_init'
We currently version `__asan_init` and when the ABI version doesn't match, the linker gives a `undefined reference to '__asan_init_v5'` message. From this, it might not be obvious that it's actually a version mismatch error. This patch makes the error message much clearer by changing the name of the undefined symbol to be `__asan_version_mismatch_check_xxx` (followed by the version string). We obviously don't want the initializer to be named like that, so it's a separate symbol that is used only for the purpose of version checking.

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

llvm-svn: 243004
2015-07-23 10:55:13 +00:00
Evgeniy Stepanov ffbc4ec790 Revert r242975.
Breaks Mac build.

llvm-svn: 242978
2015-07-23 01:29:26 +00:00
Evgeniy Stepanov 4f03227fa2 [sanitizer] Implement logging to syslog.
Previously, Android target had a logic of duplicating all sanitizer
output to logcat. This change extends it to all posix platforms via
the use of syslog, controlled by log_to_syslog flag. Enabled by
default on Android, off everywhere else.

A bit of cmake magic is required to allow Printf() to call a libc
function. I'm adding a stub implementation to support no-libc builds
like dfsan and safestack.

llvm-svn: 242975
2015-07-22 23:57:19 +00:00
Evgeniy Stepanov abb966d57e [asan] Enable build of asan-rt on android/aarch64.
llvm-svn: 242966
2015-07-22 23:31:50 +00:00
Reid Kleckner d2a8dc88ff [asan] Remove CHECK line for kernel32.dll
Windows 8 users report that it isn't present in the address space by
default anymore.

Fixes PR23773.

llvm-svn: 242958
2015-07-22 22:39:36 +00:00
Reid Kleckner 24e5ee7708 [asan] Disable ctrl+c test until I figure out how to make it portable
llvm-svn: 242952
2015-07-22 22:25:07 +00:00
Reid Kleckner 33b9cd2191 [asan] Make __asan_handle_no_return tolerate unregistered threads
Summary:
On Windows, thread injection by the kernel or other running processes is
a fairly common occurrence, so ASan should be resilient to it.  The
comments on GetCurrentThread() say that it can return null, so we
shouldn't be CHECK failing if it does.

Sending control-C is one way to get the kernel to inject a thread into
your process, so I wrote a test around it.

Reviewers: llvm-commits

Subscribers: samsonov

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

llvm-svn: 242948
2015-07-22 21:58:31 +00:00
Reid Kleckner 83a019d427 [asan] Test clang's SEH implementation as well as MSVC's
llvm-svn: 242933
2015-07-22 20:54:24 +00:00
Evgeniy Stepanov df9ed542b5 [sanitizer] Implement include_if_exists with process name substitution.
include_if_exists=/path/to/sanitizer/options reads flags from the
file if it is present. "%b" in the include file path (for both
variants of the flag) is replaced with the basename of the main
executable.

llvm-svn: 242853
2015-07-21 23:03:13 +00:00
Reid Kleckner 12f6b9c8c0 [asan] Remove AsanPlatformThreadInit
Since the CoreFoundation allocator replacement was moved in r173134, all
implementations of this function have been empty.

Reviewers: samsonov

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

llvm-svn: 242811
2015-07-21 17:42:37 +00:00
Kuba Brecka 8c5db0f852 Reverting r242787, attempt 2.
llvm-svn: 242799
2015-07-21 16:31:35 +00:00
Kuba Brecka e40677434b Reverting r242787 ("[asan] Fix the freopen interceptor to allow NULL instead of a filename") to investigate buildbot failure.
llvm-svn: 242791
2015-07-21 15:27:40 +00:00
Kuba Brecka 4c0cdec138 [asan] Fix the freopen interceptor to allow NULL instead of a filename
According to man freopen, passing NULL instead of a filename is valid, however the current implementation of the interceptor assumes this parameter is non-NULL. Let's fix that and add a test case.

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

llvm-svn: 242787
2015-07-21 14:23:27 +00:00
Kuba Brecka 25b2f754b5 [asan] Speed up ASan unit tests by turning off symbolication
ASan unit tests don't depend on the symbolizer and they never test its output, but currently they still run it for every crash. This patch simply disables the symbolizer for unit tests, which provides some speed up. On my system (OS X) that's about 1.4x faster, but this could be potentially much more e.g. when using atos on OS X.

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

llvm-svn: 242677
2015-07-20 15:03:39 +00:00
Dmitry Vyukov 2e2ac45655 asan: fix a test
Page size is not necessary 4096.
Use sysconf to obtain page size.

llvm-svn: 242651
2015-07-19 21:44:49 +00:00
Evgeniy Stepanov 3b78716207 [sanitizer] De-flake one test.
signal_segv_handler.cc occasionally fails due to a suspected kernel bug.
Increasing the mapped region size seems to make the test pass reliably.

llvm-svn: 242647
2015-07-19 19:57:13 +00:00
Alexey Samsonov e6c614d48a [Sanitizer] Teach ReadFileToBuffer to distinguish empty file from inaccessible file.
Summary:
This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=399
(sanitizers crash with empty suppression files).

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 242594
2015-07-17 23:50:08 +00:00
Naomi Musgrave 41b3226637 added test file
llvm-svn: 242590
2015-07-17 23:28:02 +00:00
Naomi Musgrave 9a5e3922bf re-added changes due to svn config setting issues
llvm-svn: 242589
2015-07-17 23:28:00 +00:00
Evgeniy Stepanov fdcaafa2b8 [asan] Fix sanitizer_allocator_test on AArch64.
llvm-svn: 242582
2015-07-17 22:29:05 +00:00
Reid Kleckner c27de5b279 Add missing chkstk.S files from r242539
llvm-svn: 242540
2015-07-17 16:31:59 +00:00
Reid Kleckner fbfed86910 compiler-rt: add support for mingw-w64 in builtins
The is so that we can avoid using libgcc and use compiler-rt with
mingw-w64.

Related driver patch
http://reviews.llvm.org/D11077

I have tested this with mingw-w64 and everything seems to be in order.
I also sent this patch to the mingw-w64 mailing list for them to look at.

Patch by Martell Malone.

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

llvm-svn: 242539
2015-07-17 16:23:05 +00:00
Evgeniy Stepanov 8e2fb681e3 [msan] Fix open_memstream handling.
For open_memstream() files, buffer pointer is only valid immediately after
fflush() or fclose(). Fix the fclose() interceptor to unpoison after the
REAL(fclose) call, not before it.

llvm-svn: 242535
2015-07-17 16:10:37 +00:00
Alexey Samsonov fd5211a5b3 [ASan] PR24150: restrict test case to i386.
llvm-svn: 242449
2015-07-16 21:46:58 +00:00
Alexey Samsonov 9e694e590c [CMake] One more attempt to fix PR24144.
This time, exclude ExternalProject from build using set_target_properties.

llvm-svn: 242444
2015-07-16 21:20:05 +00:00
Alexey Samsonov 70231d68dc [CMake] Workaround for PR24144: avoid installing libcxx_tsan and libcxx_msan by default "ninja install" command.
Summary:
Exclude external libc++ builds from "all" target, so that they are only
build on demand, and are not installed together with LLVM/Clang.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 242424
2015-07-16 17:53:01 +00:00
Alexey Samsonov c880084928 [CMake] Revisit PR23539: allow to override SANITIZER_MIN_OSX_VERSION at configure time.
Some users may need to configure Clang/compiler-rt with
-DMACOSX_DEPLOYMENT_TARGET=10.6, as they expect Clang to produce working
(non-sanitized) binaries on 10.6. In this case they would need to
additionally provide -DSANITIZER_MIN_OSX_VERSION=10.7 to mark
that sanitizer runtimes may only be used on 10.7+ (where they are
supported).

llvm-svn: 242363
2015-07-16 00:20:50 +00:00
Alexey Samsonov 6585b76800 [probile] Fix memory leak introduced in r241824.
llvm-svn: 242350
2015-07-15 22:50:39 +00:00
Peter Collingbourne 1d14b0757d CFI: Add a default blacklist.
Differential Revision: http://reviews.llvm.org/D11095

llvm-svn: 242287
2015-07-15 12:16:25 +00:00
Alexey Samsonov 41bcf0bca2 [Sanitizer] Fix fopencookie() interceptor to work with null hook functions.
llvm-svn: 242193
2015-07-14 20:13:42 +00:00
Justin Bogner f8f780ccc5 profile: Autoconf build system support for r241824
r241824 didn't update the autoconf build system to handle the new file
in the profile library.

llvm-svn: 242013
2015-07-13 06:39:53 +00:00