summaryrefslogtreecommitdiff
path: root/lib/cfi
AgeCommit message (Collapse)Author
2017-11-07(NFC) Rename GetMax{,User}VirtualAddress.Evgeniy Stepanov
Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317638 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09Limit CFI blacklist entries to specific CFI modeVlad Tsyrklevich
Summary: Since D37924 and D37925 were merged, it's now possible to specify individual sanitizers or CFI modes in sanitizer blacklists. Update the CFI blacklist entries to only apply to cfi-unrelated-cast checks. Reviewers: eugenis, pcc Reviewed By: eugenis Subscribers: kcc Differential Revision: https://reviews.llvm.org/D38385 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315216 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09Make the cfi target available on more platforms.Peter Collingbourne
On non-Linux targets it just installs the blacklist. Differential Revision: https://reviews.llvm.org/D38661 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315215 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04CFI: Move STL allocator blacklist to clangVlad Tsyrklevich
Summary: The regular expression to match STL allocators can't easily account for C++ mangling compression and fails to match some valid instances of STL allocators. Perform this logic in clang instead. Motivated by crbug.com/751385. Reviewers: pcc, kcc, llvm-commits Reviewed By: pcc Differential Revision: https://reviews.llvm.org/D36291 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310109 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31Remove STL/microsoft-specific CFI blacklist entriesPeter Collingbourne
Patch by Vlad Tsyrklevich! Differential Revision: https://reviews.llvm.org/D35855 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05CFI: Add a blacklist entry for ↵Peter Collingbourne
std::_Sp_counted_ptr_inplace::_Sp_counted_ptr_inplace(). This ctor is used by std::make_shared and needs to cast to uninitialized T* in order to call std::allocator_traits<T>::construct. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302272 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-07[cfi] Accept weak definition of __cfi_check.Evgeniy Stepanov
https://reviews.llvm.org/D31796 results in LLD emitting __cfi_check as a weak symbol, while Gold keeps it strong. Accept both. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06[cfi] Fix symbol lookup hack in cross-dso cfi to handle LLD binaries.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299604 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky
This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12[sancov] moving sancov rt to sancov/ directoryMike Aizatsky
Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15[compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks
The definitions in sanitizer_common may conflict with definitions from system headers because: The runtime includes the system headers after the project headers (as per LLVM coding guidelines). lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry. Differential Revision: https://reviews.llvm.org/D21947 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18[sancov] common flags initialization.Mike Aizatsky
Summary: Introducing InitializeCommonFlags accross all sanitizers to simplify common flags management. Setting coverage=1 when html_cov_report is requested. Differential Revision: http://reviews.llvm.org/D18273 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Assign components and dependencies during add_compiler_rt_resource_fileChris Bieneman
This makes it so that component-based installations will include resource files (i.e. blacklists). My next patch will add support for component-based installations. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261699 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03[cfi] Safe handling of unaddressable vtable pointers (compiler-rt).Evgeniy Stepanov
Avoid crashing when printing diagnostics for vtable-related CFI errors. In diagnostic mode, the frontend does an additional check of the vtable pointer against the set of all known vtable addresses and lets the runtime handler know if it is safe to inspect the vtable. http://reviews.llvm.org/D16824 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259717 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02Cast the fifth arg to mremap to void *Alexey Samsonov
Summary: Since the prototype of mremap is ``` void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address*/); ``` we need to cast new_address to void * when calling mremap. Otherwise, the wrong value will be passed to mremap on x32. Patch by H.J Lu! Reviewers: kcc, eugenis, samsonov Subscribers: samsonov, llvm-commits Differential Revision: http://reviews.llvm.org/D16805 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259540 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28[cfi] Simplify the code in CfiSlowPathCommon.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28[cfi] Fix recovery from out-of-bounds vtable error.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27[cfi] Fix gcc build.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26[cfi] Exclude __cfi_slowpath_diag from the non-diag rtl.Evgeniy Stepanov
Calls to __cfi_slowpath_diag are only emitted when building with diagnostics, and linking the diag rtl. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26[cfi] Better handling of wild target address.Evgeniy Stepanov
This change enables diagnostics when the target address for a CFI check is out of bounds of any known library, or even not in the limits of the address space. This happens when casting pointers to uninitialized memory. Ubsan code does not yet handle some of these situations correctly, so it is still possible to see a segmentation fault instead of a proper diagnostic message once in a while. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258879 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26[cfi] Hide runtime implementation in a namespace.Evgeniy Stepanov
Move all internal stuff into namespace __cfi. Remove the double underscore prefix from anything that's now inside the namespace. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258859 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26[cfi] Support for dlopen and dlclose.Evgeniy Stepanov
Add dlopen/dlclose interceptors to update CFI shadow for loaded/unloaded libraries. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258857 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25[cfi] Cross-DSO CFI diagnostic mode (compiler-rt part)Evgeniy Stepanov
* add __cfi_slowpath_diag with a 3rd parameter which is a pointer to the diagnostic info for the ubsan handlers. *__cfi_check gets a 3rd parameter as well. * unify vcall/cast/etc and icall diagnostic info format, and merge the handlers to have a single entry point (actually two points due to abort/noabort variants). * tests Note that this comes with a tiny overhead in the non-diag mode: cfi_slowpath must pass 0 as the 3rd argument to cfi_check. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258744 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08[cfi] Fix __cfi_slowpath and __cfi_check signature.Evgeniy Stepanov
The first argument is uint64_t, not uintptr_t. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257233 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22[cfi] Fix handling of uninstrumented libraries.Evgeniy Stepanov
CFI shadow for non-CFI libraries should be "unchecked", not "invalid". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[cfi] Exclude ubsan runtime library from non-diag CFI builds.Evgeniy Stepanov
Split the CFI runtime in two: cfi and cfi_diag. The latter includes UBSan runtime to allow printing diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255735 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[cfi] Fix GCC build.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[cfi] Fix shadow sanity check.Evgeniy Stepanov
The current check may break if the starting address in fill_shadow is not page-aligned. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255725 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Cross-DSO control flow integrity (compiler-rt part).Evgeniy Stepanov
This is an initial version of the runtime cross-DSO CFI support library. It contains a number of FIXMEs, ex. it does not support the diagnostic mode nor dlopen/dlclose, but it works and can be tested. Diagnostic mode, in particular, would require some refactoring (we'd like to gather all CFI hooks in the UBSan library into one function so that we could easier pass the diagnostic information down to __cfi_check). It will be implemented later. Once the diagnostic mode is in, I plan to create a second test configuration to run all existing tests in both modes. For now, this patch includes only a few new cross-DSO tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02CFI: Make the cfi target a dependency of compiler-rt.Peter Collingbourne
This causes the blacklist to be copied into place as a default build step. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01CFI: Add blacklist entries for various standard library functions.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-15CFI: Add a default blacklist.Peter Collingbourne
Differential Revision: http://reviews.llvm.org/D11095 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@242287 91177308-0d34-0410-b5e6-96231b3b80d8