Commit Graph

142 Commits

Author SHA1 Message Date
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