Commit Graph

100 Commits

Author SHA1 Message Date
Sagar Thakur 3ee5bd9377 [sanitizer][MIPS] Add --target flag for MIPS32
Without the --target flag, clang uses the mips64 triple which selects the n64 abi. We need to add --target=mips-linux-gnu, so that clang can select the correct abi for mips32r2.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9249

llvm-svn: 237675
2015-05-19 09:07:37 +00:00
Alexey Samsonov 8e5e8fb2f3 [SanitizerCoverage] Upgrade lit tests to new -fsanitize-coverage= flags.
llvm-svn: 236796
2015-05-07 23:20:47 +00:00
Alexey Samsonov 085bede949 [UBSan] Make stacktrace-matching CHECK-lines in tests Linux-specific.
Darwin doesn't yet allow to print stack trace, as it lacks the slow
unwinder. This is one more attempt to fix vptr.cpp on Mac OS X.

llvm-svn: 236195
2015-04-30 01:21:57 +00:00
Alexey Samsonov 3965cdeb39 [UBSan] Disable vptr.cpp on Darwin again.
llvm-svn: 236165
2015-04-29 21:51:23 +00:00
Alexey Samsonov 299c21474c [UBSan] Various improvements to vptr.cpp test case
* Remove __ubsan_default_options, so that test would work on Darwin
* Fix unintentional undefined behavior in the code (missing return)
* Build the test with -fno-sanitize-recover to distinguish expected
  failures and expected passes by return code.

llvm-svn: 236152
2015-04-29 20:39:12 +00:00
Alexey Samsonov ff46ebe5a4 [UBSan] Add a testcase for __ubsan_default_options() function.
llvm-svn: 236151
2015-04-29 20:39:10 +00:00
Ahmed Bougacha 69b5f93cb5 Re-XFAIL UBSan vptr testcase on darwin.
Partial revert of r235961; the test still fails on Green Dragon bots.

llvm-svn: 236135
2015-04-29 17:49:05 +00:00
Alexey Samsonov 09bff88fc4 [UBSan] Fix CMake rules for tests after r235954.
Make sure we don't run tests under TSan and MSan if they are
unavailable.

llvm-svn: 235962
2015-04-28 01:33:56 +00:00
Alexey Samsonov 4df0ebef47 Address old FIXMEs in UBSan test cases.
llvm-svn: 235961
2015-04-28 01:29:36 +00:00
Alexey Samsonov b3053d9cbe Allow UBSan+MSan and UBSan+TSan combinations (Clang part).
Embed UBSan runtime into TSan and MSan runtimes in the same as we do
in ASan. Extend UBSan test suite to also run tests for these
combinations.

llvm-svn: 235954
2015-04-28 00:56:48 +00:00
Alexey Samsonov 98d79dace3 [UBSan] Reenable ASan+UBSan tests on Darwin now that PR21112 is fixed.
llvm-svn: 235929
2015-04-27 22:09:27 +00:00
Alexey Samsonov 8c80e7420a [UBSan] Unify the way we report overflow in increment/decrement operator.
llvm-svn: 235569
2015-04-23 01:50:56 +00:00
Alexey Samsonov 434984ef58 [UBSan] Make sure proper error summary is printed for -fsanitize=float-cast-overflow.
float-cast-overflow handler doesn't have source location provided by the
compiler, but we still have *some* source location if we have a
symbolizer.

llvm-svn: 235567
2015-04-23 01:08:31 +00:00
Daniel Sanders 7ea4cfcf83 [ubsan] Stop cast-overflow.cpp test leaking undefined behaviour into the exit code.
Summary:
ubsan was correctly catching the undefined behaviour but lit's shell was
failing the test anyway because the exit code was non-zero as a result of the
undefined behaviour.

This fixes the test on a mips-linux-gnu target.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits, rsmith, sagar

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

llvm-svn: 235518
2015-04-22 16:14:01 +00:00
Hal Finkel 0423483bab Make ubsan respect log_path
As with the other sanitizers, it is desirable to allow ubsan's output to be
redirected to somewhere other than stderr (and into per-process log files).

llvm-svn: 235277
2015-04-19 20:16:13 +00:00
Alexey Samsonov 09dce3b7e5 [UBSan] Embed UBSan into ASan runtime (compiler-rt part).
Summary:
Change the way we use ASan and UBSan together. Instead of keeping two
separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan
into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on
a platform, all UBSan sources are just compiled into dummy empty object
files. UBSan initialization code (e.g. flag parsing) is directly called
from ASan initialization, so we are able to enforce correct
initialization order.

This mirrors the approach we already use for ASan+LSan. This change
doesn't modify the way we use standalone UBSan.

Test Plan: regression test suite

Reviewers: kubabrecka, zaks.anna, rsmith, kcc

Subscribers: llvm-commits

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

llvm-svn: 233861
2015-04-01 22:42:36 +00:00
Bill Seurer f1b82e3ad1 Remove XFAILs from cast-overflow.cpp
My fix for power also fixed armv7l-unknown-linux-gnueabihf and aarch64

llvm-svn: 233827
2015-04-01 17:50:39 +00:00
Bill Seurer 4c41366510 [PPC64]This activates UBSan for the power architecture.
One test case is updated to allow for differences between power and other architectures in behavior when returning from main in certain instances

http://reviews.llvm.org/D8743

llvm-svn: 233813
2015-04-01 15:33:22 +00:00
Alexey Samsonov ee449b68d0 Revert "Revert "[UBSan] Use shared library for UBSan on OS X" and its followup"
Fix the build/tests by providing -lc++abi for UBSan runtime only.

llvm-svn: 233122
2015-03-24 21:57:07 +00:00
Justin Bogner cc7e7cabd5 Revert "[UBSan] Use shared library for UBSan on OS X" and its followup
This change caused test failures on darwin, and the followup which was
meant to fix those caused compiler-rt to start failing to link.
Reverting to get the build working again.

This reverts r233071 and r233036.

llvm-svn: 233097
2015-03-24 17:43:31 +00:00
Alexey Samsonov c4eb977b0f [UBSan] Use shared library for UBSan on OS X (compiler-rt part).
Summary:
Switch to shared library for UBSan. Add support for building
UBSan on OSX and iossim by cargo-culting ASan build rules.

Test Plan: regression test suite

Reviewers: zaks.anna, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 233036
2015-03-23 23:14:16 +00:00
Kuba Brecka 3c53266ca8 Make the UBSan coverage-levels.cc test be Linux specific
Reviewed at http://reviews.llvm.org/D8278

llvm-svn: 232025
2015-03-12 10:44:34 +00:00
Alexey Samsonov de34ec0193 Revert "Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.""
Re-land r231151 now that -fsanitize=shift-base implementation should not
introduce undefined behavior.

llvm-svn: 231712
2015-03-09 21:50:40 +00:00
Alexey Samsonov 4833452c0c Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent."
The test case fails on AArch64.

llvm-svn: 231410
2015-03-05 21:57:47 +00:00
Alexey Samsonov 987666d57c [UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.
llvm-svn: 231151
2015-03-03 22:15:44 +00:00
Alexey Samsonov 0b0cafc8fc [Sanitizer] Print column number in SUMMARY line if it's available.
llvm-svn: 230721
2015-02-27 02:29:25 +00:00
Alexey Samsonov 1c915782b9 [UBSan] Run all UBSan tests in 32-bit mode as well.
We build and support UBSan on 32-bit platforms. We should run tests
there as well. Fixes PR22683.

llvm-svn: 230662
2015-02-26 19:19:44 +00:00
Alexey Samsonov d1c318657b [Sanitizer] Refactor SuppressionContext class.
SuppressionContext is no longer a singleton, shared by all sanitizers,
but a regular class. Each of ASan, LSan, UBSan and TSan now have their
own SuppressionContext, which only parses suppressions specific to
that sanitizer.

"suppressions" flag is moved away from common flags into tool-specific
flags, so the user now may pass
  ASAN_OPTIONS=suppressions=asan_supp.txt LSAN_OPIONS=suppressions=lsan_supp.txt
in a single invocation.

llvm-svn: 230026
2015-02-20 17:41:59 +00:00
Filipe Cabecinhas 8cabc53215 Use @LINE instead of hardcoded line numbers
llvm-svn: 229190
2015-02-14 00:09:09 +00:00
Filipe Cabecinhas 22bba5dd4b Add -frtti to tests that need rtti
llvm-svn: 229184
2015-02-13 23:19:23 +00:00
Alexey Samsonov fa8b3db54b [UBSan] Add report deduplication for -fsanitize=function.
Summary:
Make sure we don't print the error report from -fsanitize=function
twice for the same source location, as we do in another UBSan handlers.

Test Plan: check-ubsan test suite

Reviewers: rsmith, pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 228772
2015-02-11 00:05:31 +00:00
David Blaikie 4da5edbebe Update for tests failing due to improvements in clang's column information for aggregate expressions
llvm-svn: 226393
2015-01-18 02:17:55 +00:00
Evgeniy Stepanov f294d5b829 [sanitizer] Flag parser rewrite.
The new parser is a lot stricter about syntax, reports unrecognized
flags, and will make it easier to implemented some of the planned features.

llvm-svn: 226169
2015-01-15 15:13:43 +00:00
Alexey Samsonov f3b61be2ee Update test cases for new -fsanitize-recover= semantics.
llvm-svn: 225725
2015-01-12 23:02:42 +00:00
Renato Golin ea56f08b3f XFAIL AArch64 UBsan test, just like ARM
llvm-svn: 225370
2015-01-07 20:03:47 +00:00
Kostya Serebryany 4e781371d1 [ubsan] disable coverage-levels.cc on darwin until we can investigate what's wrong there.
llvm-svn: 225281
2015-01-06 18:48:49 +00:00
Kostya Serebryany fb42a5a292 [ubsan] partially enable -fsanitize-coverage=N with ubsan. It will work as usual in most cases but will not dump coverage on error with -fno-sanitize-recover (that'll be a separate fix)
llvm-svn: 225234
2015-01-06 01:31:23 +00:00
Alexey Samsonov 93c064968d Revert "UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases"
This reverts commit r221445. This change leads to false positives
reports from -fsanitize=vptr. See original commit thread for more
details.

llvm-svn: 224972
2014-12-30 00:33:50 +00:00
Filipe Cabecinhas 9fd326d4d6 Fix suppressions file usage
Summary:
Always quote suppressions files given to *_OPTIONS.
This will make it not break when given full Windows paths (otherwise,
parsing would stop after the drive's letter + ':').

Also fix one or two cases where the suppression files' extensions were
not *.supp.

Reviewers: samsonov, kcc

Subscribers: llvm-commits

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

llvm-svn: 224529
2014-12-18 18:25:18 +00:00
Kumar Sukhani 3176f9b65d [ubsan][arm] supporting misaligned testcase
After previous commit: http://reviews.llvm.org/rL224242, misaligned testcase is now supported on ARM also

llvm-svn: 224243
2014-12-15 12:16:36 +00:00
Kumar Sukhani fef606cf0a [UBSan][MIPS] Adding support of MIPS64 in UBSan testing
On mips64 addresses are 40-bit. Where as a 48 bit address is used in TypeCheck/misaligned.cpp.
Using regular expression for that address.

reviewed by : samsonov
submitted by: sagar

llvm-svn: 224242
2014-12-15 10:52:06 +00:00
David Blaikie c4fbfee4ff Update test case with more accurate column information now that Clang produces same
llvm-svn: 224222
2014-12-14 18:49:31 +00:00
Viktor Kutuzov d98b348cb9 Enable running Ubsan tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D6089

llvm-svn: 221599
2014-11-10 15:31:56 +00:00
Viktor Kutuzov eb5e79550a [Ubsan] Fix the missing_return.cpp test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D6088

llvm-svn: 221597
2014-11-10 15:27:13 +00:00
Viktor Kutuzov f686063f57 [Ubsan] Fix the cast-overflow.cpp test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D6087

llvm-svn: 221596
2014-11-10 15:25:01 +00:00
David Majnemer 3400563ea6 UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases
When the __virtual_mask is set, __offset_flags >> __offset_shift yields
an offset into the vtable.  Dereferencing this vtable slot gets us the
vbase offset.

Adjust a test case to verify that this, in fact, works.

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

llvm-svn: 221445
2014-11-06 08:55:23 +00:00
Renato Golin 6d41f7ae22 UBSAN stable runtime more generic with arm* targets
llvm-svn: 219924
2014-10-16 12:43:10 +00:00
Renato Golin 45abb8c969 Adds stable-runtime to ubsan to avoid broken ARM tests with asan
llvm-svn: 219906
2014-10-16 07:48:27 +00:00
Renato Golin 498b223eec Re-enable ASAN/UBSAN tests on ARM, with VFP3 they began to pass
When compiling with -mfpu=vfpv3, those tests began to pass, like the others
with "Illegal Instruction" error, so removing the XFAIL from them should
get the bot green (and have more tests!).

llvm-svn: 219721
2014-10-14 21:00:22 +00:00
Alexey Samsonov 37efdf0033 [UBSan] XFAIL test added in r219642 on Darwin
llvm-svn: 219699
2014-10-14 17:31:15 +00:00