Commit Graph

332 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 255958391d [ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails
llvm-svn: 215203
2014-08-08 13:25:55 +00:00
Viktor Kutuzov c68a37c531 Add FreeBSD support to the address sanitizer's malloc_context_size.cc test case
Differential Revision: http://reviews.llvm.org/D4665

llvm-svn: 215081
2014-08-07 04:58:41 +00:00
Timur Iskhodzhanov 0575694729 [ASan/Win] Handle SEH exceptions even with -GS
This is a follow-up to r213654, r213656, r213667 and r213668.

llvm-svn: 214861
2014-08-05 13:26:26 +00:00
Kostya Serebryany 1cd57ebb6b [asan] intercept sized operator delete[]
llvm-svn: 214704
2014-08-04 10:10:50 +00:00
Viktor Kutuzov f164bee0e0 Add FreeBSD support to the address sanitizer's deep_stack_uaf.cc test case
Differential Revision: http://reviews.llvm.org/D4668

llvm-svn: 214544
2014-08-01 19:37:05 +00:00
Ehsan Akhgari 9e5b6a08d4 [ASan] Support the asan_loadN/asan_storeN functions in the DLL thunk library
Summary:
This is required for linking DLLs with large functions exceeding
san-instrumentation-with-call-threshold.  One such function is
vp9_fdct16x16_sse2 in libvpx.

Reviewers: timurrrr

Subscribers: llvm-commits

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

llvm-svn: 214532
2014-08-01 18:04:53 +00:00
Evgeniy Stepanov c3478490ed [asan] XFAIL sized-delete test on Android.
llvm-svn: 214303
2014-07-30 12:39:30 +00:00
Kostya Serebryany e7532e59c0 [asan] rename new-delete-size-mismatch to new-delete-type-mismatch and make the report more verbose
llvm-svn: 214299
2014-07-30 11:20:37 +00:00
Kostya Serebryany 69852a843c [asan] add a feature to detect new-delete-size-mismatch (when used with -Xclang -fsized-deallocation). Not yet on Mac. Also, remove some unused code.
llvm-svn: 214296
2014-07-30 09:48:23 +00:00
Viktor Kutuzov 545ff90d47 Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON
Differential Revision: http://reviews.llvm.org/D4561

llvm-svn: 213858
2014-07-24 12:05:13 +00:00
Timur Iskhodzhanov 4bea5a83bd [ASan/Win tests] Bring back -GS- as SEH tests fail otherwise
llvm-svn: 213668
2014-07-22 16:09:11 +00:00
Timur Iskhodzhanov 74487a7c32 [ASan/Win tests] Don't generate debug info where it is not needed
Otherwise it results in flaky tests

llvm-svn: 213667
2014-07-22 15:53:10 +00:00
Timur Iskhodzhanov cb5bf58f3d [ASan/Win] Add SEH handling to the DLL thunk as well
llvm-svn: 213656
2014-07-22 14:02:53 +00:00
Timur Iskhodzhanov 6d4a6cd68f [ASan/Win] Handle SEH exceptions (best-effort, similar to longjmp)
llvm-svn: 213654
2014-07-22 13:44:18 +00:00
Timur Iskhodzhanov f2b96e3009 [ASan/Win] Add handling of C++ exceptions to the RTL
Also add a longjmp() test

llvm-svn: 213649
2014-07-22 12:37:51 +00:00
Timur Iskhodzhanov 8f41c3eb74 [ASan] Simplify exception/longjmp tests even further
llvm-svn: 213646
2014-07-22 12:25:51 +00:00
Timur Iskhodzhanov 723c81ff80 [ASan] Split throw_catch tests into two files: throw/catch + longjmp
Also add some more assertions into these tests

llvm-svn: 213642
2014-07-22 11:46:24 +00:00
Alexey Samsonov a89ad664b1 [ASan] Fix __asan_describe_address and add a test for it.
llvm-svn: 213583
2014-07-21 21:33:46 +00:00
Viktor Kutuzov 838afd799d Add FreeBSD support to the address sanitizer's waitid.cc test case
Differential Revision: http://reviews.llvm.org/D4422

llvm-svn: 213368
2014-07-18 12:02:42 +00:00
Timur Iskhodzhanov bdf23a51b1 [ASan/Win] Handle situations when the client app has used DbgHelp before
Reviewed at http://reviews.llvm.org/D4533

llvm-svn: 213151
2014-07-16 14:11:02 +00:00
Timur Iskhodzhanov 5d96f44da1 [ASan] Adjust 'sed' invocation to work on OS X
This is a follow-up to r213053

llvm-svn: 213144
2014-07-16 12:56:47 +00:00
Viktor Kutuzov 4a9638324a Add FreeBSD support to the address sanitizer's assign_large_valloc_to_global.cc test case
Differential Revision: http://reviews.llvm.org/D4525

llvm-svn: 213135
2014-07-16 10:14:01 +00:00
Viktor Kutuzov f7dfafe712 Add FreeBSD support to the address sanitizer's atexit_stats.cc test case
Differential Revision: http://reviews.llvm.org/D4524

llvm-svn: 213134
2014-07-16 10:05:29 +00:00
Viktor Kutuzov 39c28e86a6 Remove explicit references to libdl from Asan test cases
Differential Revision: http://reviews.llvm.org/D4499

llvm-svn: 213131
2014-07-16 09:53:00 +00:00
Viktor Kutuzov 82041bbc08 Add FreeBSD support to the address sanitizer's null_deref.cc test case
Differential Revision: http://reviews.llvm.org/D4421

llvm-svn: 213130
2014-07-16 09:37:40 +00:00
Kuba Brecka 58f44dce96 [ASan] Add ASan debugging API to get malloc/free stack traces and shadow memory mapping info
Reviewed at http://reviews.llvm.org/D4466

llvm-svn: 213080
2014-07-15 17:33:23 +00:00
Timur Iskhodzhanov 9e4580c8ee [ASan] Only define macros in asan_init_version.h, move the __asan_init declaration back to asan_interface_internal.h
This fixes the issues we've uncovered after landing r212815.

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

llvm-svn: 213053
2014-07-15 08:16:04 +00:00
Timur Iskhodzhanov 0aad92e0d6 [ASan/Win] Add a test for the case when dll_thunk is linked twice to the same DLL
This is a test case for r212815.

llvm-svn: 212959
2014-07-14 17:04:03 +00:00
Timur Iskhodzhanov 9b8fa878ea [ASan] Fix a couple of nits in NULL deref tests
This is a follow-up to r212807

llvm-svn: 212943
2014-07-14 14:26:35 +00:00
Evgeniy Stepanov 6c254aa70e [asan] Remove XFAIL:android from 2 newly passing tests.
Fixed in r212872.

llvm-svn: 212926
2014-07-14 08:54:10 +00:00
Alexey Samsonov 15c9669615 [ASan] Collect unmangled names of global variables in Clang to print them in error reports.
Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

llvm-svn: 212872
2014-07-12 00:42:52 +00:00
Alexey Samsonov ae9d59e8c4 [ASan] Improve ODR-violation error reports.
Demangle names of involved globals. Print a more consistent summary line.

llvm-svn: 212857
2014-07-11 23:34:26 +00:00
Timur Iskhodzhanov f6827cef73 [ASan] Print register values in a consistent way
llvm-svn: 212809
2014-07-11 12:14:46 +00:00
Timur Iskhodzhanov 19853dd28c [ASan/Win] Catch NULL derefs and page faults
Reviewed at http://reviews.llvm.org/D4471

llvm-svn: 212807
2014-07-11 11:57:41 +00:00
Timur Iskhodzhanov 3eb1f4bb90 [ASan/Win] Don't hardcode ASan runtime version in ASan dll thunk
Reviewed at http://reviews.llvm.org/D4459

llvm-svn: 212699
2014-07-10 10:33:48 +00:00
Alexey Samsonov c1856835d1 [Sanitizer] Move test for malloc/free hooks under test/sanitizer_common
llvm-svn: 212474
2014-07-07 18:47:29 +00:00
Alexey Samsonov 91bb8e0e3a Generalize sanitizer allocator public interface.
Introduce new public header <sanitizer/allocator_interface.h> and a set
of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc.
that will eventually replace their tool-specific equivalents
(__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific
functions are now deprecated and implemented as stubs redirecting
to __sanitizer_ versions (which are implemented differently in each tool).

Replace all uses of __xsan_ versions with __sanitizer_ versions in unit
and lit tests.

llvm-svn: 212469
2014-07-07 17:39:31 +00:00
Timur Iskhodzhanov 575180dbd2 [ASan/Win] Unbreak the build after r211216
llvm-svn: 212465
2014-07-07 16:22:04 +00:00
Alexey Samsonov cf009f8a53 XFAIL test on Android (this is a known issue)
llvm-svn: 212211
2014-07-02 20:18:41 +00:00
Alexey Samsonov 4f319cca42 [ASan] Print exact source location of global variables in error reports.
See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the
original feature request.

Introduce llvm.asan.globals metadata, which Clang (or any other frontend)
may use to report extra information about global variables to ASan
instrumentation pass in the backend. This metadata replaces
llvm.asan.dynamically_initialized_globals that was used to detect init-order
bugs. llvm.asan.globals contains the following data for each global:
  1) source location (file/line/column info);
  2) whether it is dynamically initialized;
  3) whether it is blacklisted (shouldn't be instrumented).

Source location data is then emitted in the binary and can be picked up
by ASan runtime in case it needs to print error report involving some global.
For example:

  0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40

These source locations are printed even if the binary doesn't have any
debug info.

This is an ABI-breaking change. ASan initialization is renamed to
__asan_init_v4(). Pre-built libraries compiled with older Clang will not work
with the fresh runtime.

llvm-svn: 212188
2014-07-02 16:54:41 +00:00
Daniel Sanders 4dc8a78b04 [asan] adding support of 32-bit address sanitizer for MIPS
Summary: The patch supports both the clang cross-compiler and native compiler

Patch by Kumar Sukhani <Kumar.Sukhani@imgtec.com>

Test Plan:
Kumar had the following asan test results when compiled on a MIPS board:

  Expected Passes    : 96
  Expected Failures  : 2
  Unsupported Tests  : 84
  Unexpected Passes  : 4
  Unexpected Failures: 19

The list of unexpected failures can be found in the review.

Reviewers: kcc, petarj, dsanders

Reviewed By: kcc

Subscribers: farazs, kcc, llvm-commits

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

llvm-svn: 211587
2014-06-24 12:08:18 +00:00
Kostya Serebryany cd60ed53f6 [asan] when reporting an ODR violation, also print the stack traces where the globals have been registered (thus show the name of shared library or exe to which the global belongs). The reports become a bit too verbose but I do not see any *simple* way to make them more compact. This should be especially helpful when the ODR happens because the same .cc file is used twice in the project in differend DSOs
llvm-svn: 211343
2014-06-20 08:24:12 +00:00
Alexander Potapenko 853a232e66 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time() and frexp()
Add a test for the frexp() interceptor.
Annotate the interceptors that may potentially corrupt stack IDs of freed buffers with FIXME comments.

llvm-svn: 211153
2014-06-18 09:27:40 +00:00
Alexey Samsonov e595e1ade0 Remove top-level Clang -fsanitize= flags for optional ASan features.
Init-order and use-after-return modes can currently be enabled
by runtime flags. use-after-scope mode is not really working at the
moment.

The only problem I see is that users won't be able to disable extra
instrumentation for init-order and use-after-scope by a top-level Clang flag.
But this instrumentation was implicitly enabled for quite a while and
we didn't hear from users hurt by it.

llvm-svn: 210924
2014-06-13 17:53:44 +00:00
Evgeniy Stepanov dfa5439652 [asan] Fix mmap-ed coverage with coverage=0.
llvm-svn: 210655
2014-06-11 15:11:26 +00:00
Evgeniy Stepanov 9ae3d02193 [asan] Run Android test with asanwrapper.
This better replicates the target environment.

llvm-svn: 210650
2014-06-11 10:37:06 +00:00
Evgeniy Stepanov 46fa9f2d9e [asan] One more coverage test.
Test that coverage is dumped correctly (and completely) even when the processed
gets SIGKILL-ed.

llvm-svn: 210647
2014-06-11 09:23:25 +00:00
Evgeniy Stepanov 125a302257 [asan] Fix coverage-android test to avoid name conflict.
And re-enable it.

llvm-svn: 210646
2014-06-11 09:09:09 +00:00
Evgeniy Stepanov 48eccb7fb3 [asan] Disable a flaky test.
llvm-svn: 210517
2014-06-10 08:32:01 +00:00
Evgeniy Stepanov b22b963669 [asan] Remove dependency of tests on runtime library in standalone build.
llvm-svn: 210465
2014-06-09 11:17:37 +00:00
Greg Fitzgerald e124a30fbe Un-xfail passing ARM Android tests
llvm-svn: 210360
2014-06-06 18:06:58 +00:00
Evgeniy Stepanov 474e70aeb7 [asan] Add 'asan' to asan test deps.
This sound like a good idea in general.
Also, without this on Android we get add_lit_testsuite() with empty DEPENDS
list, and it does not work well.

llvm-svn: 210257
2014-06-05 12:31:22 +00:00
Evgeniy Stepanov 785108b0fc [asan] Fix lit tests setup on Android.
Pass cflags in a way that's compatible with standalone compiler-rt build.

llvm-svn: 210256
2014-06-05 12:29:47 +00:00
Evgeniy Stepanov fe18102649 [sancov] Handle fork.
Reset coverage data on fork().
For memory-mapped mode (coverage_direct=1) this helps avoid loss of data
(before this change two processes would write to the same file simultaneously).
For normal mode, this reduces coverage dump size, because PCs from the parent
process are no longer inherited by the child.

llvm-svn: 210180
2014-06-04 12:13:54 +00:00
Greg Fitzgerald 547f536bcf Disable unstable test on ARM
llvm-svn: 210140
2014-06-04 00:06:41 +00:00
Kostya Serebryany 7d4fc2c6a7 [asan] enable detect_odr_violation=2; https://code.google.com/p/address-sanitizer/wiki/OneDefinitionRuleViolation . This feature has been working quite well so far, found a few bugs and zero false positives. The main problem is that there could be lots of true positives and users will have to disable this checking until the bugs are fixed.
llvm-svn: 210106
2014-06-03 15:06:13 +00:00
Evgeniy Stepanov bb2fc7e4bb [sancov] Fix map update logic on Android.
dlopen()/dlclose() are not interceptable on Android,
so we update .sancov.map in module constructor callbacks.

llvm-svn: 210098
2014-06-03 12:15:43 +00:00
Timur Iskhodzhanov b1415c46fb [ASan Win] Manually call __asan_init early in the DLL initialization process to avoid a null function call in cout/cerr constructors
llvm-svn: 210030
2014-06-02 14:40:07 +00:00
Timur Iskhodzhanov 51fadc387a [ASan Win] Fix memset interception in DLLs
llvm-svn: 210027
2014-06-02 13:23:42 +00:00
Greg Fitzgerald 52f61086ab Disable stack-overflow test on ARM
llvm-svn: 209925
2014-05-30 22:44:35 +00:00
Timur Iskhodzhanov 8f655fc0fb [ASan Win] Fix a couple of warnings in tests and enable -WX
llvm-svn: 209887
2014-05-30 11:58:32 +00:00
Timur Iskhodzhanov 5bed4206c8 [ASan Win] DLL thunk: make each INTERFACE_FUNCTION unique to prevent ICF linker optimizations
llvm-svn: 209881
2014-05-30 09:01:17 +00:00
Greg Fitzgerald 1316a0e0e0 Mark currently failing ARM tests with XFAIL.
Differential Revision: http://reviews.llvm.org/D3857

llvm-svn: 209862
2014-05-29 23:34:47 +00:00
Greg Fitzgerald c5fd7305cb Mark unstable tests as Unsupported on ARM
This is half the patch from: http://reviews.llvm.org/D3857

It lets us get deterministic results from the rest of the test suite.

llvm-svn: 209861
2014-05-29 23:34:39 +00:00
Greg Fitzgerald 11b49c3818 light up sanitizers for ARM, take 2
Differential Revision: http://reviews.llvm.org/D3794

llvm-svn: 209856
2014-05-29 22:38:13 +00:00
Greg Fitzgerald c1146ec5ba Revert "light up sanitizers for ARM"
This commit broke the Windows build, where CMAKE_C_COMPILER can
compile and link with -march=armv7-a but the just-built-clang
cannot.

llvm-svn: 209851
2014-05-29 21:33:36 +00:00
Greg Fitzgerald 32685ec5fd light up sanitizers for ARM
You can expect the sanitizers to be built under any of the following conditions:

1) CMAKE_C_COMPILER is GCC built to cross-compile to ARM
2) CMAKE_C_COMPILER is Clang built to cross-compile to ARM (ARM is default target)
3) CMAKE_C_COMPILER is Clang and CMAKE_C_FLAGS contains -target and --sysroot

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

llvm-svn: 209835
2014-05-29 19:01:32 +00:00
Evgeniy Stepanov fa5c0750f0 [sanitizer] Add coverage_dir flag.
llvm-svn: 209815
2014-05-29 14:33:16 +00:00
Timur Iskhodzhanov 9e44e590d5 [ASan Win tests] Add a couple more memcpy/memset tests
llvm-svn: 209806
2014-05-29 12:15:17 +00:00
Evgeniy Stepanov 0e56b623a5 [asan] Mass-xfail 17 tests on Android.
This makes check-asan pass on Android, which should help prevent future
regressions.

https://code.google.com/p/address-sanitizer/issues/detail?id=316

llvm-svn: 209736
2014-05-28 13:45:18 +00:00
Evgeniy Stepanov 15d71b598e [sanitizer] Replace -lpthread with -pthread in tests.
-lpthread does not work on Android.

llvm-svn: 209735
2014-05-28 13:13:30 +00:00
Evgeniy Stepanov 4b42df03de [asan] XFAIL:android several tests.
llvm-svn: 209734
2014-05-28 13:07:39 +00:00
Timur Iskhodzhanov 7f29181323 [ASan tests] Exclude some tests from Windows runs
Some features are not supported yet and some are not planned to be fixed soon

llvm-svn: 209733
2014-05-28 13:06:14 +00:00
Evgeniy Stepanov 0651b561a6 [asan] Fix android test setup.
llvm-svn: 209724
2014-05-28 09:58:58 +00:00
Timur Iskhodzhanov a09b70579a [ASan tests] Move one more test to POSIX-only directory
llvm-svn: 209722
2014-05-28 09:38:51 +00:00
Timur Iskhodzhanov 82ee0433da [ASan/Win] Use clang rather than clang-cl by default for lit tests. Make Windows-only tests explicitly use clang-cl.
Reviewed at http://reviews.llvm.org/D3893

llvm-svn: 209719
2014-05-28 08:38:13 +00:00
Greg Fitzgerald 329912f54c [asan] use relative line numbers in tests
llvm-svn: 209699
2014-05-27 23:13:52 +00:00
Evgeniy Stepanov 567e516015 [asancov] Write coverage directly to a memory-mapped file.
This way does not require a __sanitizer_cov_dump() call. That's
important on Android, where apps can be killed at arbitrary time.

We write raw PCs to disk instead of module offsets; we also write
memory layout to a separate file. This increases dump size by the
factor of 2 on 64-bit systems.

llvm-svn: 209653
2014-05-27 12:37:52 +00:00
Timur Iskhodzhanov d67df369cf [ASan tests] Use ASAN_OPTIONS in a portable way
llvm-svn: 209629
2014-05-26 13:44:57 +00:00
Sergey Matveev a531058d2b [MSan] Implement __sanitizer_print_stack_trace().
llvm-svn: 209625
2014-05-26 13:08:08 +00:00
Timur Iskhodzhanov 9011eb81cf [ASan/Win tests] Remove the extra 'cat' in front of FileCheck now that it's clear we should use GnuWin32 rather than Cygwin on the PATH on Windows (see PR19744)
llvm-svn: 209622
2014-05-26 11:54:20 +00:00
Timur Iskhodzhanov 5873419af7 [ASan/Win tests] Use the env keyword in the SUAR tests to work with gnuwin/lit correctly
llvm-svn: 209620
2014-05-26 11:25:32 +00:00
Sergey Matveev 2be4a28297 [sanitizer] Make stack traces from dlclose()'d modules more meaningful.
Previously, they silently omitted PCs belonging to unknown modules. Now we print
(<unknown module>) instead.

llvm-svn: 209522
2014-05-23 16:04:41 +00:00
Timur Iskhodzhanov d6ac15dd5f Quick-fix a copy-and-paste mistake in one of the ASan test
llvm-svn: 209448
2014-05-22 15:14:05 +00:00
Timur Iskhodzhanov b2eb3131f4 [ASan/Win] Make sure the list of wrappers exported by the main module and imported by the DLL thunk always matches
llvm-svn: 209444
2014-05-22 14:49:56 +00:00
Timur Iskhodzhanov 8ff177ede3 [ASan/Win] Thread more library functions from the DLL thunk to the main module
llvm-svn: 209441
2014-05-22 13:57:22 +00:00
Timur Iskhodzhanov 498e56adb6 [ASan/Win] Add more tests for operator new[]
llvm-svn: 209439
2014-05-22 13:28:27 +00:00
Timur Iskhodzhanov 0c7c78f1d1 [ASan/Win] Use the new function interception approach to handle function wrappers too; wrap strlen() in DLLs
Reviewed at http://reviews.llvm.org/D3871

llvm-svn: 209427
2014-05-22 12:03:40 +00:00
Sergey Matveev 162d7cb9d1 [sanitizer] Attempt to fix test.
llvm-svn: 209301
2014-05-21 14:36:05 +00:00
Sergey Matveev 83f91e786c [sanitizer] Add __sanitizer_maybe_open_cov_file().
Summary: Add a new interface function required for coverage sandboxing support.
llvm-svn: 209298
2014-05-21 13:43:52 +00:00
Kostya Serebryany 301a38b0b7 [asan] add a test which ensures that we dump coverage after SEGV
llvm-svn: 209295
2014-05-21 13:20:14 +00:00
Timur Iskhodzhanov e7894f3b14 [ASan Win] Simplify and improve the way we forward ASan interface calls from DLLs
Reviewed at http://reviews.llvm.org/D3848

llvm-svn: 209210
2014-05-20 14:26:19 +00:00
Sergey Matveev 6cb47a083b [sanitizer] Support sandboxing in sanitizer coverage.
Summary:
Sandboxed code may now pass additional arguments to
__sanitizer_sandbox_on_notify() to force all coverage data to be dumped to a
single file (the default is one file per module). The user may supply a file or
socket to write to. The latter option can be used to broker out the file writing
functionality. If -1  is passed, we pre-open a file.

llvm-svn: 209121
2014-05-19 12:53:03 +00:00
Sergey Matveev 73f64a8f9f [asan] Make the coverage tests clean up after themselves.
llvm-svn: 209119
2014-05-19 11:34:35 +00:00
Alexey Samsonov 995bdd43f8 Exclude several ASan tests from test suite if we're using GCC
llvm-svn: 209013
2014-05-16 20:12:27 +00:00
Timur Iskhodzhanov bd6cee7cc3 [ASan/Win tests] Add memcpy/strdup/strlen interception tests
llvm-svn: 208899
2014-05-15 16:02:56 +00:00
Timur Iskhodzhanov 5910d6d126 [ASan/Win tests] Add more DLL tests
llvm-svn: 208893
2014-05-15 15:13:06 +00:00
Timur Iskhodzhanov e23889692b [ASan/Win tests] Add more DLL tests: malloc & friends
llvm-svn: 208889
2014-05-15 14:42:41 +00:00
Timur Iskhodzhanov 3bd2c2fe90 [ASan/Win tests] Add the first DLL test
llvm-svn: 208884
2014-05-15 14:27:46 +00:00
Timur Iskhodzhanov 130b5651d1 [ASan/Win tests] Add tests for malloc/calloc/realloc
llvm-svn: 208881
2014-05-15 13:50:12 +00:00
Timur Iskhodzhanov a357badc58 [ASan/Win tests] Add tests for stack array manipulation, as well as a use-after-return test
llvm-svn: 208873
2014-05-15 12:09:45 +00:00
Timur Iskhodzhanov 2dbedf5e93 [ASan/Win tests] Add tests for operator new/new[]/delete/delete[]
llvm-svn: 208871
2014-05-15 11:55:40 +00:00
Timur Iskhodzhanov dd2d84a223 [ASan/Win tests] Add tests for downcast-related overflows, as well as CRT initiazliers
llvm-svn: 208865
2014-05-15 11:14:00 +00:00
Timur Iskhodzhanov f32b690f69 [ASan/Win tests] Add tests for aligned mallocs, bitfields and global strings
llvm-svn: 208859
2014-05-15 10:58:35 +00:00
Timur Iskhodzhanov 8bf36cae28 [ASan tests] Add ASan Windows threading tests
llvm-svn: 208854
2014-05-15 09:12:55 +00:00
Alp Toker 1ee7fc7a1a Fix typos
llvm-svn: 208841
2014-05-15 02:22:34 +00:00
Timur Iskhodzhanov 07109b4161 [ASan/Win tests] Add a PR reference for the FileCheck bug
llvm-svn: 208807
2014-05-14 19:47:58 +00:00
Timur Iskhodzhanov 78dccb0822 Remove an unneeded stderr redirection
llvm-svn: 208805
2014-05-14 19:34:13 +00:00
Timur Iskhodzhanov 3653790410 Remove --check-prefix=CHECK as it's useless
llvm-svn: 208803
2014-05-14 19:31:56 +00:00
Timur Iskhodzhanov 2bdca20069 [ASan tests] Add the first Windows-only lit test
Reviewed at http://reviews.llvm.org/D3767

llvm-svn: 208802
2014-05-14 19:10:43 +00:00
Timur Iskhodzhanov 9de6fe7b83 [ASan tests] Get rid of SharedLibs/
llvm-svn: 208780
2014-05-14 14:41:38 +00:00
Timur Iskhodzhanov b2e723e448 [ASan tests] Update relative paths from POSIX-only tests to their shared libraries
llvm-svn: 208778
2014-05-14 14:16:09 +00:00
Timur Iskhodzhanov 6a9121904d [ASan tests] Create a Posix/ directory for tests that we don't plan to run on Windows
llvm-svn: 208777
2014-05-14 14:12:02 +00:00
Kostya Serebryany 7534a60753 [asan] Respect personality in kernel area detector, patch by Yuri Gribov
llvm-svn: 208760
2014-05-14 08:13:11 +00:00
Greg Fitzgerald fb1d83a978 Add %run to new lit test
llvm-svn: 208624
2014-05-12 20:17:14 +00:00
Kostya Serebryany 118d469660 [asan] one more attempt to enable lsan by default (PR19521)
llvm-svn: 208545
2014-05-12 12:49:48 +00:00
Sergey Matveev aeb18fc787 [asan] Further fix the test from r208333.
Remove a debug print and some copypasta.

llvm-svn: 208535
2014-05-12 10:33:31 +00:00
Kostya Serebryany d7992fc921 [asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
llvm-svn: 208525
2014-05-12 08:01:51 +00:00
Alexey Samsonov 0b9b36623a Fixup test added in r208333
llvm-svn: 208356
2014-05-08 20:21:11 +00:00
Sergey Matveev 76e02e90c5 [ASan] Fix coverage behavior when a PC belongs to an unknown address range.
This happens, e.g., when coverage data is collected for a module which is then
dlclose()'d. Currently this causes CovDump() to ignore all PCs that are greater
than the unrecognized PC. In other words, unloading a module causes ASan to
silently ignore any coverage data for modules loaded at higher addresses.
Instead we should just skip the unrecognized PCs.

llvm-svn: 208333
2014-05-08 16:09:54 +00:00
Evgeniy Stepanov 5ee9fd5f45 [asan] Update tests for r208290.
sprintf output buffer is now always sanitized.

llvm-svn: 208291
2014-05-08 09:24:53 +00:00
Greg Fitzgerald dda7f8cfd0 [asan] fix i386 tests broken from r207707
llvm-svn: 208240
2014-05-07 19:22:16 +00:00
Kostya Serebryany 7a733480c8 [asan] introduce interface function __sanitizer_verify_contiguous_container to verify annotations in vector-like containers
llvm-svn: 208092
2014-05-06 14:41:01 +00:00
Kostya Serebryany 12963b54a8 [asan] disable GetKernelStartAddress as it misbehaves in schroot
llvm-svn: 207768
2014-05-01 16:20:23 +00:00
Greg Fitzgerald b8aae5405b Add %run to all lit tests
llvm-svn: 207709
2014-04-30 21:34:17 +00:00
Greg Fitzgerald 6759fd9fdd Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR:

  $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT"

llvm-svn: 207707
2014-04-30 21:32:30 +00:00
Kostya Serebryany cacbac7ba9 [asan] fix a test
llvm-svn: 207417
2014-04-28 13:18:59 +00:00
Kostya Serebryany 4f9c31a2fa [asan] split detect_odr_violation into two: =2 detects all ODR violations, =1 detects only those where the variable sizes are different. BTW, the detector seems to be working well and finding nice bugs. Early adopters are welcome.
llvm-svn: 207415
2014-04-28 12:47:58 +00:00
Kostya Serebryany e91930a7e6 [asan] implement an experimental detector of ODR violations. Not tested yet outside of a tiny test, may need tuning.
llvm-svn: 207210
2014-04-25 08:58:28 +00:00
Kostya Serebryany 7afc6b2c72 [asan] enable use_sigaltstack by default (this will provide verbose reports on stack-overflow instead of silently crashing with SEGV)
llvm-svn: 207099
2014-04-24 11:55:17 +00:00
Kostya Serebryany 8cd3d27879 [asan] disable lsan back. :( -- It appears that quite a few lit tests have leaks and they were not covered by out buildbot
llvm-svn: 206955
2014-04-23 08:15:16 +00:00
Kostya Serebryany c9db838267 [asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default.
llvm-svn: 206896
2014-04-22 13:56:56 +00:00
Alexander Potapenko 6e647c13e4 [ASan] Fixed the expectation for Darwin memset test.
Added a comment about keeping the Linux/Darwin test versions in sync.

llvm-svn: 206881
2014-04-22 10:53:57 +00:00
Kostya Serebryany 26c4e96455 [sanitizer] enable check_printf by default for asan and tsan. We've been using this flag for a while and it seems to be stable enough for the rest of the world.
llvm-svn: 206872
2014-04-22 09:17:08 +00:00
Kostya Serebryany 38bb53b2c5 [asan] add a run-time flag detect_container_overflow=true/false
llvm-svn: 206753
2014-04-21 14:18:45 +00:00
Kostya Serebryany 632751539e [asan] add __asan_memset and friends
llvm-svn: 206748
2014-04-21 11:58:25 +00:00
Kostya Serebryany 498b18a01e [asan] try to harden __tls_get_addr interceptor against signals (no good test still); update the comment in a test.
llvm-svn: 206367
2014-04-16 09:07:27 +00:00
Alexander Potapenko 65a6c57013 [ASan] Replace a CHECK for mmap_limit_mb with a RAW_CHECK.
In the case of a CHECK failure the program tries to fork and launch llvm-symbolizer,
but hangs in mz_force_lock because one of the allocator locks is already acquired.

llvm-svn: 206274
2014-04-15 11:36:18 +00:00
Kostya Serebryany b1232474b2 [asan] try fixing the mmap_limit_mb failure on buildbot (tests pass locally)
llvm-svn: 206262
2014-04-15 08:35:43 +00:00
Evgeniy Stepanov 81d80f7578 [asan] Fix mmap_limit_mb test to not use C++11.
llvm-svn: 206182
2014-04-14 15:37:02 +00:00
Evgeniy Stepanov 681016b2ea [asan] Do not use lambda in sanitizer lit tests.
We may be building with a very old C++ library.

llvm-svn: 206180
2014-04-14 15:19:07 +00:00
Kostya Serebryany bcfbea6d4e [asan] added internal flag mmap_limit_mb
llvm-svn: 206178
2014-04-14 14:51:01 +00:00
Kostya Serebryany 90527cb324 [asan] don't use bool in public interface, make sure the interface headers are usable in plain C
llvm-svn: 206160
2014-04-14 11:16:53 +00:00
Kostya Serebryany f694ab1f18 [asan] provide better reports for cases where memcpy/etc get negative size parameter. Also fix a typo found by Tetsuo Kiso
llvm-svn: 206158
2014-04-14 09:50:52 +00:00
Alexey Samsonov 7dc3c0fb2b [ASan] Explicitly specify -ldl/-lpthread in RUN-lines where needed
llvm-svn: 205623
2014-04-04 12:24:46 +00:00
Kostya Serebryany 9f20c9b17c [asan] fix a leak in __tls_get_addr handler; introduce a run-time flag to disable this handler completely; remove a workaround for a bug fixed in glibc
llvm-svn: 205617
2014-04-04 09:10:58 +00:00
Alexey Samsonov 56b6ee9833 [ASan] Optional support for dynamic ASan runtime on Linux.
Based on http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov!

llvm-svn: 205308
2014-04-01 13:16:30 +00:00
Evgeniy Stepanov a6eb1bb59e [sanitizer] Intercept __bzero on Mac.
This should make memset_test pass on Mac.

llvm-svn: 204929
2014-03-27 14:20:34 +00:00
Kostya Serebryany d093b5ac43 [asan] add a test case for r204897.
llvm-svn: 204903
2014-03-27 08:51:32 +00:00
Kostya Serebryany 88d0eac412 [asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri Gribov
llvm-svn: 204897
2014-03-27 07:36:26 +00:00
Evgeniy Stepanov 16d89fc356 [sanitizer] Intercept __aeabi_mem(set|cpy|move).
llvm-svn: 204800
2014-03-26 12:14:34 +00:00
Alexey Samsonov 6c3f7fcb8a Mark this test as 64-bit specific
llvm-svn: 204319
2014-03-20 07:37:45 +00:00
Alexander Potapenko b76ea32834 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=274
by ignoring globals from __TEXT,__cstring,cstring_literals during instrumenation.
Add a regression test.

llvm-svn: 203916
2014-03-14 10:41:49 +00:00
Alexey Samsonov 8ad7a05bb4 Improve llvm-symbolizer discovery in asan_symbolize.py
llvm-svn: 202982
2014-03-05 15:00:36 +00:00
Alexey Samsonov 3d9adc0a73 [ASan] Speed up stack trace unwinding for stacks of size 2.
Summary:
We don't need to do any work in this case - just take
the current PC and caller PC.

Reviewers: eugenis, ygribov

Reviewed By: eugenis

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2936

llvm-svn: 202845
2014-03-04 13:12:25 +00:00
Dmitry Vyukov d8c2fbd57f tsan: another attempt to fix the tls_get_addr crash
llvm-svn: 202405
2014-02-27 15:07:45 +00:00
Alexander Potapenko 4b1a7fe33a [ASan] Split interception-in-shared-lib-test.cc into two tests with platform-specific RUN commands.
Get rid of a TestCases/SharedLibs/shared-lib-test-so.cc dependency in these tests.

llvm-svn: 202267
2014-02-26 14:05:57 +00:00
Evgeniy Stepanov 6697dc6aa3 [asan] Remove extra sonames from libraries in tests.
llvm-svn: 202156
2014-02-25 15:25:37 +00:00
Evgeniy Stepanov e4d8577c69 [asan] Reenable waitid test on Android.
waitid() is present since API level 9 (Android 2.3). That's old enough.

llvm-svn: 202149
2014-02-25 13:24:42 +00:00
Evgeniy Stepanov 4bf7a268e0 [asan] Add a test for interceptors in shared libraries.
llvm-svn: 202037
2014-02-24 14:31:28 +00:00
Evgeniy Stepanov c0ae3dfc3a [asan] A test was reverted, but not "svn rm"-ed in r202016.
llvm-svn: 202025
2014-02-24 11:43:47 +00:00
Evgeniy Stepanov 4c32d16c76 Revert r202014.
Failing on the bots for an unknown reason.

llvm-svn: 202016
2014-02-24 10:21:44 +00:00
Evgeniy Stepanov 567e0eef4c [asan] Add a test for interceptors in shared libraries.
llvm-svn: 202014
2014-02-24 10:04:42 +00:00
Evgeniy Stepanov d512234d7e [asan] Avoid hardcoding library path in test binary.
llvm-svn: 202013
2014-02-24 10:03:33 +00:00
Alexey Samsonov 5e6d83258e [CMake] lit tests shouldn't depend on runtimes in standalone build
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Alexey Samsonov 31043152d3 Add rudimentary support for running compiler-rt lit tests with GCC
llvm-svn: 201680
2014-02-19 15:13:14 +00:00
Evgeniy Stepanov cc8e58bc46 [asan] Ensure that stack is limited before attempting to overflow it.
Very bad things happen otherwise.

llvm-svn: 201670
2014-02-19 12:43:27 +00:00
Alexey Samsonov cd8535a96d [CMake] Introduce COMPILER_RT_INCLUDE_TESTS option
llvm-svn: 201666
2014-02-19 11:18:47 +00:00
Evgeniy Stepanov 2274ba7716 [asan] Improve stack overflow detection.
There are more cases when those manifest as an access below SP.

llvm-svn: 201664
2014-02-19 11:02:46 +00:00
Evgeniy Stepanov b036778bdb [asan] Relax stack-overflow test.
llvm-svn: 201571
2014-02-18 13:11:40 +00:00
Evgeniy Stepanov a50abe6656 [asan] Disable stack-overflow test on main thread.
Failing on some bots.

llvm-svn: 201567
2014-02-18 12:29:39 +00:00
Evgeniy Stepanov 65b959afad [asan] Stack overflow detection.
Report segmentation faults near or below stack bottom as stack-overflow
(not stack-buffer-overflow!).

llvm-svn: 201565
2014-02-18 11:49:52 +00:00
Evgeniy Stepanov 1b16a9d3b0 [asan] Fix one test on OSX.
llvm-svn: 201564
2014-02-18 11:32:24 +00:00
Alexey Samsonov eb6ef12203 Drop test/asan/GenericConfig directory
llvm-svn: 201552
2014-02-18 08:24:28 +00:00
Evgeniy Stepanov 77d9ae6c0f [asan] Replace rand_r with rand in test.
llvm-svn: 201548
2014-02-18 08:03:44 +00:00
Alexey Samsonov 1c9b9bcb5c Simplify defining Clang compile flags in lit configs
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Evgeniy Stepanov 9e629abf1e [asan] Add a test for stack unwinding in new and delete.
llvm-svn: 201511
2014-02-17 11:52:29 +00:00
Evgeniy Stepanov 6c34935292 [asan] Replace posix_memalign with memalign in test.
Android does not provide posix_memalign.

llvm-svn: 201420
2014-02-14 15:02:36 +00:00
Alexey Samsonov 9a70077b47 [ASan] Rename asan_runtime_libraries to asan. Re-enable tests on Android.
llvm-svn: 201417
2014-02-14 14:45:13 +00:00
Evgeniy Stepanov cbb2d5eee4 [asan] Disabled one more test on Android.
llvm-svn: 201416
2014-02-14 14:37:13 +00:00
Evgeniy Stepanov 44f5d8a49f [asan] Change stack uar test to not use ulimit.
Because of how Android test runner is implemented, ulimit in RUN: line
gets executed on the host machine and does not affect the test.

llvm-svn: 201415
2014-02-14 14:36:42 +00:00
Alexey Samsonov 9f20d67034 Move ASan lit-tests under test/asan
llvm-svn: 201413
2014-02-14 14:06:10 +00:00