Add an unsigned shift base sanitizerIt's not undefined behavior for an unsigned left shift to overflow (i.e. toshift bits out), but it has been the source of bugs and exploits in certaincodebases
Add an unsigned shift base sanitizerIt's not undefined behavior for an unsigned left shift to overflow (i.e. toshift bits out), but it has been the source of bugs and exploits in certaincodebases in the past. As we do in other parts of UBSan, this patch adds adynamic checker which acts beyond UBSan and checks other sources of errors. Theoption is enabled as part of -fsanitize=integer.The flag is named: -fsanitize=unsigned-shift-baseThis matches shift-base and shift-exponent flags.<rdar://problem/46129047>Differential Revision: https://reviews.llvm.org/D86000
show more ...
[ubsan][test] Restore float-divide-by-zero testRemoved by rCTE365307 to fix buildbots. It can be restored now because D64317/rC365587 brought back -fsanitize=float-divide-by-zerollvm-svn: 365591
[ubsan][test] Fix cast-overflow.cpp and delete float-divide-by-zero test after D63793/rC365272llvm-svn: 365307
[ubsan] Make suppressions.cpp test pass for me on WindowsThe test seems to be failing because the module suppression filecontains a colon. I found that it was sufficient to just use thebasename o
[ubsan] Make suppressions.cpp test pass for me on WindowsThe test seems to be failing because the module suppression filecontains a colon. I found that it was sufficient to just use thebasename of the suppression file.While I was here, I noticed that we don't implement IsAbsolutePath forWindows, so I added it.llvm-svn: 352921
[compiler-rt][UBSan] silence_unsigned_overflow: do *NOT* ignore *fatal* unsigned overflowsSummary:D48660 / rL335762 added a `silence_unsigned_overflow` env flag for [[ https://github.com/google/os
[compiler-rt][UBSan] silence_unsigned_overflow: do *NOT* ignore *fatal* unsigned overflowsSummary:D48660 / rL335762 added a `silence_unsigned_overflow` env flag for [[ https://github.com/google/oss-fuzz/pull/1717 | oss-fuzz needs ]],that allows to silence the reports from unsigned overflows.It makes sense, it is there because `-fsanitize=integer` sanitizer is not enabled on oss-fuzz,so this allows to still use it as an interestingness signal, without getting the actual reports.However there is a slight problem here.All types of unsigned overflows are ignored.Even if `-fno-sanitize-recover=unsigned` was used (which means the program will die after the report)there will still be no report, the program will just silently die.At the moment there are just two projects on oss-fuzz that care:* [[ https://github.com/google/oss-fuzz/blob/8eeffa627f937040aaf8ba1b7d93f43f77d74fb9/projects/llvm_libcxx/build.sh#L18-L20 | libc++ ]]* [[ https://github.com/google/oss-fuzz/blob/8eeffa627f937040aaf8ba1b7d93f43f77d74fb9/projects/librawspeed/build.sh | RawSpeed ]] (me)I suppose this could be overridden there ^, but i really don't think this is intended behavior in any case..Reviewers: kcc, Dor1s, #sanitizers, filcab, vsk, kubamracekReviewed By: Dor1sSubscribers: dberris, mclow.lists, llvm-commitsTags: #sanitizersDifferential Revision: https://reviews.llvm.org/D54771llvm-svn: 347415
[UBSan] Followup for silence_unsigned_overflow flag to handle negate overflows.Summary:That flag has been introduced in https://reviews.llvm.org/D48660 forsuppressing UIO error messages in an eff
[UBSan] Followup for silence_unsigned_overflow flag to handle negate overflows.Summary:That flag has been introduced in https://reviews.llvm.org/D48660 forsuppressing UIO error messages in an efficient way. The main motivation is tobe able to use UIO checks in builds used for fuzzing as it might provide aninteresting signal to a fuzzing engine such as libFuzzer.See https://github.com/google/oss-fuzz/issues/910 for more information.Reviewers: morehouse, kccReviewed By: morehouseSubscribers: kubamracek, delcypher, #sanitizers, llvm-commitsDifferential Revision: https://reviews.llvm.org/D49324llvm-svn: 337068
[UBsan] Enable subset of unit tests for OpenBSDReviewers: kubamracek, krytarowskiReviewed By: krytarowskiDifferential Revision: https://reviews.llvm.org/D48805llvm-svn: 336053
[UBSan] Add silence_unsigned_overflow flag.Summary:Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIOreports. This feature, combined with-fsanitize-recover=unsigned-integer-
[UBSan] Add silence_unsigned_overflow flag.Summary:Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIOreports. This feature, combined with-fsanitize-recover=unsigned-integer-overflow, is useful for providingfuzzing signal without the excessive log output.Helps with https://github.com/google/oss-fuzz/issues/910.Reviewers: kcc, vskReviewed By: vskSubscribers: vsk, kubamracek, Dor1s, llvm-commitsDifferential Revision: https://reviews.llvm.org/D48660llvm-svn: 335762
[sanitizer] Test ubsan and cfi on android.Summary:Enable check-cfi and check-ubsan on Android.Check-ubsan includes standalone and ubsan+asan, but not tsan or msan.Cross-dso cfi tests are disable
[sanitizer] Test ubsan and cfi on android.Summary:Enable check-cfi and check-ubsan on Android.Check-ubsan includes standalone and ubsan+asan, but not tsan or msan.Cross-dso cfi tests are disabled for now.Reviewers: vitalybuka, pccSubscribers: srhines, kubamracek, llvm-commits, mgornyDifferential Revision: https://reviews.llvm.org/D38608llvm-svn: 315105
Fix negate-overflow.cpp test on Windows after r303440lit would interpret the exit code as failuire.llvm-svn: 303809
[ubsan] Use the correct tool name in diagnosticsWhen using ASan and UBSan together, the common sanitizer tool name isset to "AddressSanitizer". That means that when a UBSan diagnostic isprinted o
[ubsan] Use the correct tool name in diagnosticsWhen using ASan and UBSan together, the common sanitizer tool name isset to "AddressSanitizer". That means that when a UBSan diagnostic isprinted out, it looks like this: SUMMARY: AddressSanitizer: ...This can confuse users. Fix it so that we always use the correct toolname when printing out UBSan diagnostics.Differential Revision: https://reviews.llvm.org/D32066llvm-svn: 300358
When building without DIA SDK, don't set suppressions.cpp failThis test requires llvm-symbolizer to be able to convert a stackaddress into a function name. It is only able to do this if theDIA S
When building without DIA SDK, don't set suppressions.cpp failThis test requires llvm-symbolizer to be able to convert a stackaddress into a function name. It is only able to do this if theDIA SDK was found at cmake time. Add a lit feature for this,and let the test depend on it.See also discussion in D15363.llvm-svn: 258545
Re-disable suppressions.cpp on Windows.See discussion in http://reviews.llvm.org/D15363llvm-svn: 257952
Make ubsan suppression test pass on Windows.llvm-svn: 257183
XFAIL ubsan suppressions.cpp test on Windows for now.llvm-svn: 256307
[UBSan] Implement runtime suppressions (PR25066).Summary:Add the ability to suppress UBSan reports for files/functions/modulesat runtime. The user can now pass UBSAN_OPTIONS=suppressions=supp.txt
[UBSan] Implement runtime suppressions (PR25066).Summary:Add the ability to suppress UBSan reports for files/functions/modulesat runtime. The user can now pass UBSAN_OPTIONS=suppressions=supp.txtwith the contents of the form:signed-integer-overflow:file-with-known-overflow.cppalignment:function_doing_unaligned_accessvptr:shared_object_with_vptr_failures.soSuppression categories match the arguments passed to -fsanitize=flag (although, see below). There is no overhead if suppressions arenot provided. Otherwise there is extra overhead for symbolization.Limitations:1) sometimes suppressions need debug info / symbol table to function properly (although sometimes frontend generates enough info to do the match).2) it's only possible to suppress recoverable UB kinds - if you've built the code with -fno-sanitize-recover=undefined, suppressions will not work.3) categories are fine-grained check kinds, not groups like "undefined" or "integer", so you can't write "undefined:file_with_ub.cc".Reviewers: rsmith, kccSubscribers: cfe-commitsDifferential Revision: http://reviews.llvm.org/D15363llvm-svn: 256018
Fix the RUN on UBSAN unit testsFor the build set up which runs the unit tests using an emulator like QEMU,the unit tests must be run using %run.Differential Revision: http://reviews.llvm.org/D15
Fix the RUN on UBSAN unit testsFor the build set up which runs the unit tests using an emulator like QEMU,the unit tests must be run using %run.Differential Revision: http://reviews.llvm.org/D15081llvm-svn: 254467
[ubsan] Invoke test program using %run.llvm-svn: 250063
[UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit tests.Introduce %env_ubsan_opts= substitution instead of specifyingUBSAN_OPTIONS manually in the RUN-lines. This will com
[UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit tests.Introduce %env_ubsan_opts= substitution instead of specifyingUBSAN_OPTIONS manually in the RUN-lines. This will come in handyonce we introduce some default UBSAN_OPTIONS for the whole testsuite(for instance, make abort_on_error common option).llvm-svn: 245967
[UBSan] Add the ability to print more precise error kind in summary line.Reviewers: rsmith, pccSubscribers: cfe-commitsDifferential Revision: http://reviews.llvm.org/D12215llvm-svn: 245897
UBSan: Enable runtime library tests on Windows, and get most tests passing.Specifically:- Disable int128 tests on Windows, as MSVC cl.exe does not support int128, so we might not have been able
UBSan: Enable runtime library tests on Windows, and get most tests passing.Specifically:- Disable int128 tests on Windows, as MSVC cl.exe does not support int128, so we might not have been able to build the runtime with int128 support.- XFAIL the vptr tests as we lack Microsoft ABI support.- XFAIL enum.cpp as UBSan fails to add the correct instrumentation code for some reason.- Modify certain tests that build executables multiple times to use unique names for each executable. This works around a race condition observed on Windows.- Implement IsAccessibleMemoryRange for Windows to fix the last misaligned.cpp test.- Introduce a substitution for testing crashes on Windows using KillTheDoctor.Differential Revision: http://reviews.llvm.org/D10864llvm-svn: 241303
[UBSan] Unify the way we report overflow in increment/decrement operator.llvm-svn: 235569
Revert "Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.""Re-land r231151 now that -fsanitize=shift-base implementation should notintroduce undefined behavior
Revert "Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.""Re-land r231151 now that -fsanitize=shift-base implementation should notintroduce undefined behavior.llvm-svn: 231712
Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent."The test case fails on AArch64.llvm-svn: 231410
[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.llvm-svn: 231151
12