summaryrefslogtreecommitdiff
path: root/lib/ubsan
AgeCommit message (Collapse)Author
2018-06-27[UBSan] Add silence_unsigned_overflow flag.Matt Morehouse
Summary: Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIO reports. This feature, combined with -fsanitize-recover=unsigned-integer-overflow, is useful for providing fuzzing signal without the excessive log output. Helps with https://github.com/google/oss-fuzz/issues/910. Reviewers: kcc, vsk Reviewed By: vsk Subscribers: vsk, kubamracek, Dor1s, llvm-commits Differential Revision: https://reviews.llvm.org/D48660 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335762 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26CFI: Print DSO names for failed cross-DSO icallsVlad Tsyrklevich
Reviewers: pcc Reviewed By: pcc Subscribers: kubamracek, delcypher, llvm-commits, kcc, #sanitizers Differential Revision: https://reviews.llvm.org/D48583 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335644 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26Implement CFI for indirect calls via a member function pointer.Peter Collingbourne
Similarly to CFI on virtual and indirect calls, this implementation tries to use program type information to make the checks as precise as possible. The basic way that it works is as follows, where `C` is the name of the class being defined or the target of a call and the function type is assumed to be `void()`. For virtual calls: - Attach type metadata to the addresses of function pointers in vtables (not the functions themselves) of type `void (B::*)()` for each `B` that is a recursive dynamic base class of `C`, including `C` itself. This type metadata has an annotation that the type is for virtual calls (to distinguish it from the non-virtual case). - At the call site, check that the computed address of the function pointer in the vtable has type `void (C::*)()`. For non-virtual calls: - Attach type metadata to each non-virtual member function whose address can be taken with a member function pointer. The type of a function in class `C` of type `void()` is each of the types `void (B::*)()` where `B` is a most-base class of `C`. A most-base class of `C` is defined as a recursive base class of `C`, including `C` itself, that does not have any bases. - At the call site, check that the function pointer has one of the types `void (B::*)()` where `B` is a most-base class of `C`. Differential Revision: https://reviews.llvm.org/D47567 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335569 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-22[ubsan] Fix __ubsan_on_report interface definitionVedant Kumar
Speculative fix for the interface definition of __ubsan_on_report for the Windows bots: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/30528 lib\ubsan\ubsan_interface.inc(55): error C2065: '__ubsan_on_report': undeclared identifier INTERCEPT_SANITIZER_WEAK_FUNCTION was the wrong macro to use to begin with because __ubsan_on_report isn't weak. Reading through that macro, it's still not clear to me why there is an undefined reference, though, because it appears to define a dummy __ubsan_on_report shim. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-22[ubsan] Add support for reporting diagnostics to a monitor processVedant Kumar
Add support to the ubsan runtime for reporting diagnostics to a monitor process (e.g a debugger). The Xcode IDE uses this by setting a breakpoint on __ubsan_on_report and collecting diagnostic information via __ubsan_get_current_report_data, which it then surfaces to users in the editor UI. Testing for this functionality already exists in upstream lldb, here: lldb/packages/Python/lldbsuite/test/functionalities/ubsan Apart from that, this is `ninja check-{a,ub}san` clean. Differential Revision: https://reviews.llvm.org/D48446 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335371 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18[sanitizer] Trivial portion of the port to Myriad RTEMSWalter Lee
This commit contains the trivial portion of the port of ASan to Myriad RTEMS. - Whitelist platform in sanitizer_platform.h, ubsan_platform.h - Turn off general interception - Use memset for FastPoisonShadow - Define interception wrappers - Set errno symbol correctly - Enable ASAN_LOW_MEMORY - Enable preinit array - Disable slow unwinding - Use fuchsia offline symbolizer - Disable common code for: InitializeShadowMemory, CreateMainThread, AsanThread::ThreadStart, StartReportDeadlySignal, MaybeReportNonExecRegion. Differential Revision: https://reviews.llvm.org/D46454 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332681 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09[CMake] Build shared version of runtimes for FuchsiaPetr Hosek
Fuchsia is no longer treated as UNIX which means we need to explicitly enable building of shared versions of runtimes. Differential Revision: https://reviews.llvm.org/D46609 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331922 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16[sanitizer] Fix OSX build failure post D45457Kostya Kortchinsky
Summary: It looks like OSX's UBSan needs a "NoHooks" version of `RTSanitizerCommonSymbolizer` to work build properly. Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45696 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330146 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16[sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommonKostya Kortchinsky
Summary: Host symbolizer & stacktraces related code in their own RT: `RTSanitizerCommonSymbolizer`, which is "libcdep" by nature. Symbolizer & stacktraces specific code that used to live in common files is moved to a new file `sanitizer_symbolizer_report.cc` as is. The purpose of this is the enforce a separation between code that relies on symbolization and code that doesn't. This saves the inclusion of spurious code due to the interface functions with default visibility, and the extra data associated. The following sanitizers makefiles were modified & tested locally: - dfsan: doesn't require the new symbolizer RT - esan: requires it - hwasan: requires it - lsan: requires it - msan: requires it - safestack: doesn't require it - xray: doesn't require it - tsan: requires it - ubsan: requires it - ubsan_minimal: doesn't require it - scudo: requires it (but not for Fuchsia that has a minimal runtime) This was tested locally on Linux, Android, Fuchsia. Reviewers: alekseyshl, eugenis, dberris, kubamracek, vitalybuka, dvyukov, mcgrathr Reviewed By: alekseyshl, vitalybuka Subscribers: srhines, kubamracek, mgorny, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330131 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-22[sanitizer] Split coverage into separate RT in sanitizer_commonKostya Kortchinsky
Summary: `sanitizer_common`'s coverage support is fairly well separated, and libcdep by default. Several sanitizers don't make use of coverage, and as far as I can tell do no benefit from the extra dependencies pulled in by the coverage public interface functions. The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan, LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan. So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc anyway), XRay, and the upcoming Scudo minimal runtime. I tested this with all the sanitizers check-* with gcc & clang, and in standalone on Linux & Android, and there was no issue. I couldn't test this on Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of people for additional scrunity. I couldn't test HWAsan either. Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44701 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328204 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-02OpenBSD UBsan support / ubsan partKamil Rytarowski
Summary: UBsan, enable OpenBSD platform Patch by: David CARLIER Reviewers: krytarowski, kettenis, visa, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43894 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326543 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-17Recognize all NetBSD architectures in UBSanKamil Rytarowski
Summary: Use uniform accessors for Program Pointer, Stack Pointer and Frame Pointer. Remove CPU check in UBSan supported platforms and rely only on the OS type. This adds NetBSD support in GetPcSpBp() for: - ARM - ARM64 - HPPA - PowerPC/PowerPC64 - SPARC/SPARC64 - MIPS - DEC Alpha AXP - DEC VAX - M68K and M68010 - SH3 - IA64 - OR1K - RISCV Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, ro Reviewed By: vitalybuka Subscribers: aemerson, jyknight, sdardis, kubamracek, arichardson, llvm-commits, kristof.beyls, fedor.sergeev, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43021 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325431 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23[ubsan] Add preinit initializer for ubsanFrancis Ricci
Summary: Now that ubsan does function interception (for signals), we need to ensure that ubsan is initialized before any library constructors are called. Otherwise, if a constructor calls sigaction, ubsan will intercept in an unitialized state, which will cause a crash. This patch is a partial revert of r317757, which removed preinit arrays for ubsan. Reviewers: vitalybuka, eugenis, pcc Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42389 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323249 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22[ubsan] Disable signal handling on Android.Evgeniy Stepanov
Summary: See rationale in the comments. Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D42329 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28-fsanitize=vptr warnings on bad static types in dynamic_cast and typeidStephan Bergmann
...when such an operation is done on an object during con-/destruction. (This adds a test case to compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp that, unlike the existing test cases there, wants to detect multiple UBSan warnings in one go. Therefore, that file had to be changed from globally using -fno-sanitize-recover to individually using halt_on_error only where appropriate.) This is the compiler-rt part of a patch covering both cfe and compiler-rt. Differential Revision: https://reviews.llvm.org/D40295 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[ubsan] Diagnose noreturn functions which return (compiler-rt)Vedant Kumar
This is paired with the clang change: https://reviews.llvm.org/D40698 Differential Revision: https://reviews.llvm.org/D40700 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18Revert r320977 "No -fsanitize=function warning when calling noexcept ↵Stephan Bergmann
function through non-noexcept pointer in C++17" At least <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/ builds/6013/steps/annotate/logs/stdio> complains about __ubsan::__ubsan_handle_function_type_mismatch_abort (compiler-rt lib/ubsan/ubsan_handlers.cc) returning now despite being declared 'noreturn', so looks like a different approach is needed for the function_type_mismatch check to be called also in cases that may ultimately succeed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320981 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18No -fsanitize=function warning when calling noexcept function through ↵Stephan Bergmann
non-noexcept pointer in C++17 As discussed in the mail thread <https://groups.google.com/a/isocpp.org/forum/ #!topic/std-discussion/T64_dW3WKUk> "Calling noexcept function throug non- noexcept pointer is undefined behavior?", such a call should not be UB. However, Clang currently warns about it. There is no cheap check whether two function type_infos only differ in noexcept,so pass those two type_infos as additional data to the function_type_mismatch handler (with the optimization of passing a null "static callee type" info when that is already noexcept, so the additional check can be avoided anyway). For the Itanium ABI (which appears to be the only one that happens to be used on platforms that support -fsanitize=function, and which appears to only record noexcept information for pointer-to-function type_infos, not for function type_infos themselves), we then need to check the mangled names for occurrence of "Do" representing "noexcept". This is the compiler-rt part of a patch covering both cfe and compiler-rt. Differential Revision: https://reviews.llvm.org/D40720 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[Sanitizers] Basic sanitizer Solaris support (PR 33274)Kamil Rytarowski
Summary: This is the first mostly working version of the Sanitizer port to 32-bit Solaris/x86. It is currently based on Solaris 11.4 Beta. This part was initially developed inside libsanitizer in the GCC tree and should apply to both. Subsequent parts will address changes to clang, the compiler-rt build system and testsuite. I'm not yet sure what the right patch granularity is: if it's profitable to split the patch up, I'd like to get guidance on how to do so. Most of the changes are probably straightforward with a few exceptions: * The Solaris syscall interface isn't stable, undocumented and can change within an OS release. The stable interface is the libc interface, which I'm using here, if possible using the internal _-prefixed names. * While the patch primarily target 32-bit x86, I've left a few sparc changes in. They cannot currently be used with clang due to a backend limitation, but have worked fine inside the gcc tree. * Some functions (e.g. largefile versions of functions like open64) only exist in 32-bit Solaris, so I've introduced a separate SANITIZER_SOLARIS32 to check for that. The patch (with the subsequent ones to be submitted shortly) was tested on i386-pc-solaris2.11. Only a few failures remain, some of them analyzed, some still TBD: AddressSanitizer-i386-sunos :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos :: TestCases/malloc-no-intercept.c AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/start-deactivated.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/default_options.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/malloc-no-intercept.c SanitizerCommon-Unit :: ./Sanitizer-i386-Test/MemoryMappingLayout.DumpListOfModules SanitizerCommon-Unit :: ./Sanitizer-i386-Test/SanitizerCommon.PthreadDestructorIterations Maybe this is good enough the get the ball rolling. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, jyknight, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40898 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320740 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[sanitizers] Rename GetStackTraceWithPcBpAndContextVitaly Buka
Name does not need to enumerate arguments. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09ubsan: Allow programs to use setenv to configure ubsan_standalone.Peter Collingbourne
Previously ubsan_standalone used the GetEnv function to read the environment variables UBSAN_OPTIONS and UBSAN_SYMBOLIZER_PATH. The problem with GetEnv is that it does not respect changes to the environment variables made using the libc setenv function, which prevents clients from setting environment variables to configure ubsan before loading ubsan-instrumented libraries. The reason why we have GetEnv is that some runtimes need to read environment variables while they initialize using .preinit_array, and getenv does not work while .preinit_array functions are being called. However, it is unnecessary for ubsan_standalone to initialize that early. So this change switches ubsan_standalone to using getenv and removes the .preinit_array entry. The static version of the runtime still ends up being initialized using a C++ constructor that exists to support the shared runtime. Differential Revision: https://reviews.llvm.org/D39827 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[sanitizer] Don't intercept signal and sigaction on FuchsiaPetr Hosek
Fuchsia doesn't support signals, so don't use interceptors for signal or sigaction. Differential Revision: https://reviews.llvm.org/D38669 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-07[ubsan] Add a static runtime on DarwinVedant Kumar
As a follow-up to r315142, this makes it possible to use ubsan with a static runtime on Darwin. I've also added a new StandaloneStatic testing configuration so the new setup can be tested. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04[sanitizer] Move cxx-abi library earlier in link flags.Evgeniy Stepanov
Summary: This change moves cxx-abi library in asan/ubsan/dd link command line ahead of other libraries, such as pthread/rt/dl/c/gcc. Given that cxx-abi may be the full libstdc++/libc++, it makes sense for it to be ahead of libc and libgcc, at least. The real motivation is Android, where in the arm32 NDK toolchain libstdc++.a is actually a linker script that tries to sneak LLVM's libunwind ahead of libgcc's. Wrong library order breaks unwinding. Reviewers: srhines, danalbert Subscribers: aemerson, kubamracek, mgorny, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D38520 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[ubsan] Merge ubsan_standalone_cxx shared library.Evgeniy Stepanov
Summary: Link everything, including the C++ bits, in the single ubsan_standalone SHARED library. This matches ASan setup. Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38340 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-23[ubsan] Replace CommonSanitizerReportMutex with ScopedErrorReportLockVitaly Buka
Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314053 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-23[ubsan] Support signal specific options in ubsanVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Standalone ubsan needs signal and sigaction handlers and interceptors. Plugin mode should rely on parent tool. Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D37895 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[ubsan] Split ubsan_init_standaloneVitaly Buka
Summary: On Linux we may need preinit_array in static lib and ubsan_standalone_initializer in shared lib. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38013 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18Revert "[ubsan] Split ubsan_init_standalone"Vitaly Buka
Breaks build. This reverts commit r313583 and r313584. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313585 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Add file missing from r313583Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313584 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Split ubsan_init_standaloneVitaly Buka
On Linux we may need preinit_array in static lib and ubsan_standalone_initializer in shared lib. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313583 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Fix conflict with previous declaration on MacVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313572 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Fix interface_symbols_windows testVitaly Buka
Summary: 1. Update ubsan_interface.inc to make the test happy. 2. Switch interface_symbols_linux and interface_symbols_darwin to C++ to import __ubsan_handle_dynamic_type_cache_miss 3. Switch interface_symbols_windows to C++ for consistency. Reviewers: rnk, zturner Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37986 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313551 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18Revert "[ubsan] Add RTUbsan_standalone into UBSAN standalone shared"Vitaly Buka
Error: .preinit_array section is not allowed in DSO This reverts commit r313519. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Add RTUbsan_standalone into UBSAN standalone sharedVitaly Buka
Same as for Apple. This also fixes flags related tests on Android as without this flags are not initialized. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313519 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16Revert "[ubsan] Update ubsan_interface.inc"Vitaly Buka
This brakes interface_symbols_linux.c test. This reverts commit r313432. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[ubsan] Update ubsan_interface.incVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15Try to fix check-asan.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313423 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15ubsan: Unbreak ubsan_cxx runtime library on Windows.Peter Collingbourne
This was originally broken by r258744 which introduced a weak reference from ubsan to ubsan_cxx. This reference does not work directly on Windows because COFF has no direct concept of weak symbols. The fix is to use /alternatename to create a weak external reference to ubsan_cxx. Also fix the definition (and the name, so that we drop cached values) of the cmake flag that controls whether to build ubsan_cxx. Now the user-controllable flag is always on, and we turn it off internally depending on whether we support building it. Differential Revision: https://reviews.llvm.org/D37882 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15ubsan: Stop building the DLL version of the runtime library on Windows.Peter Collingbourne
As far as I know we never use it. Differential Revision: https://reviews.llvm.org/D37884 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313378 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15[ubsan] Extract GetStackTraceWithPcBpAndContext similar to asan versionVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[ubsan] Make ubsan version of __sanitizer_print_stack_trace consistent with ↵Vitaly Buka
other sanitizers Summary: Other sanitizers include __sanitizer_print_stack_trace into stack trace. Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37657 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312954 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[ubsan] Save binary name before parsing optionsVitaly Buka
Summary: To parser "include" we may need to do binary name substitution. Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37658 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11Revert "[ubsan] Save binary name before parsing options"Vitaly Buka
Patch was corrupted by rebase. This reverts commit r312933 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312952 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[compiler-rt] Cleanup decoratorsVitaly Buka
Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[ubsan] Save binary name before parsing optionsVitaly Buka
Summary: To parser "include" we may need to do binary name substitution. Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37658 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312933 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28Reland r311842 - [cmake] Remove i686 target that is duplicate to i386Michal Gorny
Remove the explicit i686 target that is completely duplicate to the i386 target, with the latter being used more commonly. 1. The runtime built for i686 will be identical to the one built for i386. 2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion on the clang end which has to expect either of them. 3. The checks are based on wrong assumption that __i686__ is defined for all newer x86 CPUs. In fact, it is only declared when -march=i686 is explicitly used. It is not available when a more specific (or newer) -march is used. Curious enough, if CFLAGS contain -march=i686, the runtime will be built both for i386 and i686. For any other value, only i386 variant will be built. Differential Revision: https://reviews.llvm.org/D26764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27Revert r311842 - [cmake] Remove i686 target that is duplicate to i386Michal Gorny
The required change in clang is being reverted because of the Android build bot failure. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27[cmake] Remove i686 target that is duplicate to i386Michal Gorny
Remove the explicit i686 target that is completely duplicate to the i386 target, with the latter being used more commonly. 1. The runtime built for i686 will be identical to the one built for i386. 2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion on the clang end which has to expect either of them. 3. The checks are based on wrong assumption that __i686__ is defined for all newer x86 CPUs. In fact, it is only declared when -march=i686 is explicitly used. It is not available when a more specific (or newer) -march is used. Curious enough, if CFLAGS contain -march=i686, the runtime will be built both for i386 and i686. For any other value, only i386 variant will be built. Differential Revision: https://reviews.llvm.org/D26764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08Enable ubsan on NetBSDKamil Rytarowski
Summary: Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, filcab, fjricci Reviewed By: fjricci Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36483 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310412 91177308-0d34-0410-b5e6-96231b3b80d8