Commit Graph

60 Commits

Author SHA1 Message Date
Alexey Samsonov 889e3ab83c [ASan] create separate configs for running ASan lit tests in both 32- and 64-bit mode. Clean up RUN-lines in tests.
llvm-svn: 183498
2013-06-07 09:38:55 +00:00
Alexey Samsonov e3bf521b7c Remove a bunch of copy-paste: use common config for sanitizer lit/unit tests
llvm-svn: 183407
2013-06-06 13:28:37 +00:00
Alexey Samsonov 9c2bcf8c15 Improve support for compiler-rt tests in CMake build.
Now compiler-rt tests run correctly if compiler-rt is checked out into
arbitrary directory (not necessarily projects/compiler-rt).
Patch by Greg Fitzgerald!

llvm-svn: 182726
2013-05-27 09:35:24 +00:00
Alexey Samsonov 9f3938e271 Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers.
llvm-svn: 179293
2013-04-11 15:49:52 +00:00
Alexey Samsonov 734aab4066 [Sanitizer] Use a common mutex to prevent mixing reports from different sanitizers. This fixes PR15516
llvm-svn: 178853
2013-04-05 07:30:29 +00:00
Richard Smith 74e3d39710 compiler-rt part of r178194. Remove ubsan test for diagnostic on inf/nan conversion between floating-point types.
llvm-svn: 178195
2013-03-27 23:21:10 +00:00
Richard Smith c91e327cba Build and install .syms files alongside sanitizer runtimes. These are used to
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.

llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Richard Smith b30d11194c ubsan: Pass floating-point arguments to the runtime by value if they fit the
value argument.

llvm-svn: 177689
2013-03-22 00:47:05 +00:00
Richard Smith b6f3905450 Per discussion on cxx-abi-dev, switch from comparing type_info objects to
comparing type_info names, since the latter have better uniqueness guarantees
in practice.

llvm-svn: 177618
2013-03-21 00:42:03 +00:00
Richard Smith e86b7b0bb9 Split ubsan runtime into three pieces (compiler-rt part):
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other
   sanitizer runtime is present.
 * libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on
   a C++ ABI library, and is always linked in.
 * libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a
   C++ ABI library, and is only linked in when linking a C++ binary.

The Darwin ubsan runtime is unchanged.

For more details, see Clang change r177605.

llvm-svn: 177606
2013-03-20 23:49:17 +00:00
Richard Smith 807e4dced5 Update ubsan test for clang change r177362.
llvm-svn: 177363
2013-03-19 00:04:20 +00:00
Alexey Samsonov 46a36d5019 [UBSan] Use common report decorator to print colorful diagnostics in UBSan, and be more consistent w/ Printf/RawWrite
llvm-svn: 176182
2013-02-27 12:58:24 +00:00
Richard Smith 0404ec8396 ubsan: Runtime handlers for array indexing checks.
llvm-svn: 175948
2013-02-23 02:40:07 +00:00
Richard Smith 6d9f13127c ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type. Runtime library part.

llvm-svn: 175079
2013-02-13 21:18:23 +00:00
Richard Smith 60261eadbd Highlight caret in bold green, to match Clang diagnostics.
llvm-svn: 175013
2013-02-12 22:12:10 +00:00
Alexey Samsonov b399118cad CMake: add functions creating universal runtime libraries for several architectures on OS X and use them in ASan and UBSan build rules
llvm-svn: 173011
2013-01-21 08:12:20 +00:00
Alexey Samsonov b068483d4d CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
llvm-svn: 172829
2013-01-18 16:51:07 +00:00
Alexey Samsonov 193b45f4fe CMake variables renaming: X86_64->x86_64 I386->i386
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Will Dietz 149d952e86 [ubsan] Add SANITIZER_INTERFACE_ATTRIBUTE to __ubsan_vptr_type_cache
Missed this one previously.

llvm-svn: 172730
2013-01-17 17:14:12 +00:00
Will Dietz 9d3209b5c7 [ubsan] Use __sanitizer::atomic_exchange(), prefer shared impl.
Specify weaker memory order in case we optimize for it in the future,
presently still doing same __sync_lock_test_and_set() as before.

Change suggested by Alexey Samsonov, thanks!

llvm-svn: 172429
2013-01-14 16:13:52 +00:00
Richard Smith ffbe87eba2 UBSan: use %p not 0x%zx when printing pointers.
llvm-svn: 172129
2013-01-10 22:39:40 +00:00
Will Dietz ad5180d774 [ubsan] Move attribute specifier to fix build with gcc.
llvm-svn: 172078
2013-01-10 17:01:13 +00:00
Will Dietz e4b1d2e32c [ubsan] Give entry methods default (not hidden) visibility.
Fixes using ubsan on shared libraries in linux, for example.

llvm-svn: 172041
2013-01-10 03:37:30 +00:00
Will Dietz b50565b21a [ubsan] Drop use of __atomic_exchange_n for now to fix build for some.
Need a more reliable way to check for support of this intrinsic.

llvm-svn: 171955
2013-01-09 06:18:40 +00:00
Will Dietz 765c266892 [ubsan] Add deduplication functionality, always enabled.
llvm-svn: 171948
2013-01-09 03:40:03 +00:00
Will Dietz 2b40b7ef84 [ubsan] Check for appropriate types on compound assignment overflow diagnostics.
llvm-svn: 171802
2013-01-07 22:25:54 +00:00
Will Dietz 82f61bf4b6 [ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
Fixed version of r171273.

llvm-svn: 171278
2012-12-31 06:36:44 +00:00
Chandler Carruth 5f8061bc36 Revert r171273 which doesn't actually compile.
Original commit message:
[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.

llvm-svn: 171277
2012-12-31 06:16:47 +00:00
Will Dietz d6cd3203f6 [ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.
llvm-svn: 171273
2012-12-31 02:20:55 +00:00
Will Dietz 2a5f569d88 [ubsan] Update test now that check recovery is default and has driver flag.
llvm-svn: 171265
2012-12-30 20:53:39 +00:00
Alexey Samsonov c20f5d2246 Define COMPILER_RT_CAN_EXECUTE_TESTS variable on platforms where we can produce working binaries and use it in build rules for sanitizers tests
llvm-svn: 171160
2012-12-27 13:19:23 +00:00
Richard Smith 64e25ce53d Move C++ name demangling support from ubsan into sanitizer_common.
llvm-svn: 170666
2012-12-20 05:00:13 +00:00
Alexey Samsonov f37c45c20d [Sanitizer] Expose StackTrace::GetPreviousInstructionPc() to get PC of call instruction from return address
llvm-svn: 170424
2012-12-18 09:57:34 +00:00
Richard Smith 7e45562ad0 ubsan: Demangle class names, and be more informative when a reinterpret_cast
has got us to the wrong offset within an object.

llvm-svn: 170423
2012-12-18 09:30:21 +00:00
Richard Smith cf56ebd52a ubsan: When diagnosing something wrong somewhere in memory, emit a note
pointing at the bad location and a snippet of nearby memory values. This is
strictly best-effort; reading these bytes to display the note could lead to a
seg fault, and that's explicitly OK.

llvm-svn: 170415
2012-12-18 06:30:32 +00:00
Richard Smith 52987120f9 ubsan: if the frontend didn't provide us with a source location, try to work
one out from the return address. Currently, we can only resolve this address to
a file and line number if we have an external symbolizer.

llvm-svn: 170407
2012-12-18 04:23:18 +00:00
Richard Smith 37a913ae8f Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.

llvm-svn: 170388
2012-12-18 00:23:12 +00:00
Richard Smith 177f80376d ubsan unit tests for -fsanitize=bool and -fsanitize=enum.
llvm-svn: 170109
2012-12-13 07:12:20 +00:00
Richard Smith 32952215b6 ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.

llvm-svn: 170107
2012-12-13 07:00:14 +00:00
Will Dietz 2c36c71f5b [ubsan] Refactor handlers to have separate entry points for aborting.
If user specifies aborting after a recoverable failed check is
appropriate, frontend should emit call to the _abort variant.

Test this behavior with newly added -fsanitize-recover flag.

llvm-svn: 169113
2012-12-02 19:47:29 +00:00
Will Dietz b28179be10 [ubsan] Replace "fatal error" with "runtime error".
llvm-svn: 169112
2012-12-02 18:43:33 +00:00
Richard Smith 57000c38fc ubsan: Disable __int128 tests if the host Clang does not support it. These
tests will still fail if compiler-rt was built with a compiler without __int128
support, but the host compiler has __int128 support.

llvm-svn: 168955
2012-11-29 23:03:58 +00:00
Richard Smith 99507e6c10 ubsan: Don't assume that Clang provides __int128 unless it advertises that it does.
llvm-svn: 168857
2012-11-29 05:59:30 +00:00
Will Dietz 2631aaf939 ubsan: Support unsigned overflows, and divide-by-zero int/float split.
llvm-svn: 168700
2012-11-27 15:01:43 +00:00
Alexey Samsonov 56f1ef7d3b ubsan: fix broken test case by using brand new [[@LINE]] FileCheck feature
llvm-svn: 168170
2012-11-16 13:38:03 +00:00
Alexey Samsonov be9a293dda UBSan: enable CMake build on Darwin. Fix two failing tests and disable the test which produces linker errors on Darwin.
llvm-svn: 168169
2012-11-16 12:57:07 +00:00
Richard Smith 2674c6e39b Fix typo from code review (thanks to Alexey Samsonov). This is also caught by the existing tests when building for i386.
llvm-svn: 167890
2012-11-13 23:58:20 +00:00
Richard Smith 6122d0692b Support for building the ubsan runtime when using the autoconf build system on
Darwin. Patch by Jean-Daniel Dupas, tweaked by Jonathan Sauer, simplified
somewhat by me.

llvm-svn: 167889
2012-11-13 23:55:06 +00:00
Richard Smith 05dce7e644 -fsanitize=undefined: Switch to using sanitizer_common for output. This gets us much closer to not depending on any system headers.
llvm-svn: 167888
2012-11-13 23:42:05 +00:00
Richard Smith 77930919ad Update compiler-rt tests to match flag renaming/deprecation in Clang.
llvm-svn: 167434
2012-11-06 02:31:42 +00:00