summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/interception
Commit message (Collapse)AuthorAgeFilesLines
* [asan] Intercept all Heap* related imports from ucrtbase.dllReid Kleckner2016-03-242-8/+86
| | | | | | | | | | | | | | | | | | | | | | ucrtbase.dll appears to be built with some kind of cross-module inlining, because there are calls to imported Heap* routines sprinkled throughout the code. This inlining defeats our attempts to hotpatch malloc, _malloc_base, and related functions. Failing to intercept an allocation or deallocation results in a crash when the program attempts to deallocate or reallocate memory with the wrong allocator. This change patches the IAT of ucrtbase.dll to replace the addresses of the imported Heap* functions with implementations provided by ASan. We don't globally intercept the win32 Heap* functions because they are typically used by system DLLs that run before ASan initializes. Eventually, we may want to intercept them, but for now I think this is the minimal change that will keep ASan stable. Reviewers: samsonov Differential Revision: http://reviews.llvm.org/D18413 llvm-svn: 264327
* [asan] Add ucrtbase.dll to the list of DLLs to interceptReid Kleckner2016-03-221-0/+1
| | | | | | Reduces number of test failures in check-asan-dynamic with VS 2015. llvm-svn: 264061
* [asan] Add one more x86 encoding to the interceptor for strrchrReid Kleckner2016-03-221-0/+1
| | | | llvm-svn: 264060
* [asan] Intercept strdup on WindowsReid Kleckner2016-03-221-1/+4
| | | | | | | | Some unit tests were failing because we didn't intercept strdup. It turns out it works just fine on 2013 and 2015 with a small patch to the interception logic. llvm-svn: 264013
* [asan] Update hotpatch code for VS 2015 memset implementationReid Kleckner2016-03-211-0/+5
| | | | | | | | | In VS 2015, the memset fill parameter is zero extended from one byte instead of being copied wholesale. The issue reproduces with existing tests if you use VS2015. llvm-svn: 263966
* [cmake] Address Samsonov's post-commit review of r262723Filipe Cabecinhas2016-03-051-1/+1
| | | | | | | | | | Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17896 llvm-svn: 262770
* Remove autoconf support for building runtime libraries.Chris Bieneman2016-01-261-23/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I am the punishment of God... If [autoconf] had not committed great sins, God would not have sent a punishment like me upon [it]." -Genghis Khan Reviewers: chandlerc, grosbach, bob.wilson, zaks.anna, kubabrecka, samsonov, echristo Subscribers: iains, llvm-commits Differential Revision: http://reviews.llvm.org/D16473 llvm-svn: 258863
* Tell clang-format that (most) sanitizers are written using Google style guide.Alexey Samsonov2015-11-191-0/+1
| | | | llvm-svn: 253608
* Sanitizer: define WIN32_LEAN_AND_MEANSaleem Abdulrasool2015-10-291-0/+1
| | | | | | | | Define WIN32_LEAN_AND_MEAN before including Windows.h. This is already being done in some places. This does it more broadly. This permits building ASAN on Linux for Winndows, as well as reduces the amount of included declarations. llvm-svn: 251649
* [asan] Versioned interceptor for pthread_create.Evgeniy Stepanov2015-09-221-5/+5
| | | | | | | | | This fixes a crash in pthread_create on linux/i386 due to abi incompatibility between intercepted and non-intercepted functions. See the test case for more details. llvm-svn: 248325
* [windows] Implement GetProcAddress internally to avoid initializing the CRTReid Kleckner2015-08-182-4/+59
| | | | | | | | | | | | | | | | | ASan uses GetProcAddress to get the address of malloc so it can patch it. Newer versions of Windows make GetProcAddress initialize the DLL before returning a function pointer into it. That's perfectly reasonable, but ASan needs to finish patching malloc before CRT initialization. So now we roll our own GetProcAddress. Fixes PR24237 Based on a patch by David Major Originally written by David Major as part of: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h llvm-svn: 245377
* CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Use CMake's cmake_parse_arguments() instead. It's called in a slightly different way, but supports all our use cases. It's in CMake 2.8.8, which is our minimum supported version. CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc): http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments Since I was already changing these calls, I changed ARCH and LIB into ARCHS and LIBS to make it more clear that they're lists of arguments. Reviewers: eugenis, samsonov, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10529 llvm-svn: 240120
* [CMake] Cleanup add_compiler_rt_object_library to be platform-agnosticChris Bieneman2015-06-101-15/+5
| | | | | | | | | | | | | | | | | Summary: This change takes darwin-specific goop that was scattered around CMakeLists files and spread between add_compiler_rt_object_library and add_compiler_rt_darwin_object_library and moves it all under add_compiler_rt_object_library. The goal of this is to try to push platform handling as low in the utility functions as possible. Reviewers: rnk, samsonov Reviewed By: rnk, samsonov Subscribers: rnk, rsmith, llvm-commits Differential Revision: http://reviews.llvm.org/D10250 llvm-svn: 239498
* [ASan/Win] Fix a CHECK failure when an exception is thrown from a callback ↵Timur Iskhodzhanov2015-03-171-4/+9
| | | | | | | | passed to BindIoCompletionCallback This also simplifies how we handle QueueUserWorkItem llvm-svn: 232499
* [ASan] NFC: Factor out platform-specific interceptorsTimur Iskhodzhanov2015-03-161-1/+0
| | | | | | Reviewed at http://reviews.llvm.org/D8321 llvm-svn: 232377
* Revert "Remove support for building sanitizers from Makefile/autoconf build."Matthias Braun2015-02-171-0/+23
| | | | | | | | | This reverts commit r229556. Reverting this for now as internal apple builds rely on this functionality. llvm-svn: 229585
* Remove support for building sanitizers from Makefile/autoconf build.Alexey Samsonov2015-02-171-23/+0
| | | | | | | | They autotools build has a number of missing features, supports less OS, architectures, build configurations, doesn't have any tests and is hard to support in sync with CMake build. llvm-svn: 229556
* [sanitizer] Android build cleanup.Evgeniy Stepanov2014-09-291-4/+0
| | | | | | | | | | | | * Detect Android toolchain target arch and set correct runtime library name. * Merged a lot of Android and non-Android code paths. * Android is only supported in standalone build of compiler-rt now. * Linking lsan-common in ASan-Android (makes lsan annotations work). * Relying on -fsanitize=address linker flag when building tests (again, unification with non-Android path). * Runtime library moved from lib/asan to lib/linux. llvm-svn: 218605
* Add support for intercepting functions from msvcr110.dllEhsan Akhgari2014-09-251-1/+4
| | | | | | | | | | | | | | Summary: This finishes support for ASAN on MSVC2012. Test Plan: |ninja check-asan| passes locally with this on MSVC2012. Reviewers: timurrrr Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5494 llvm-svn: 218465
* [ASan/Win] Intercept memory allocation functions in the MD CRTTimur Iskhodzhanov2014-08-252-11/+44
| | | | llvm-svn: 216382
* [ASan/Win] Land the trivial bits of -MD RTL support (PR20214)Timur Iskhodzhanov2014-08-222-9/+4
| | | | llvm-svn: 216265
* [ASan/Win] Remove one more reference to ↵Timur Iskhodzhanov2014-08-151-3/+1
| | | | | | __interception::GetRealFunctionAddress (follow-up to r215707) llvm-svn: 215722
* [ASan/Win] Remove old, unused and non-functional code that will be ↵Timur Iskhodzhanov2014-08-152-16/+0
| | | | | | re-written soon llvm-svn: 215707
* Add support for intercepting thunks of the formEhsan Akhgari2014-07-141-0/+1
| | | | llvm-svn: 212979
* Make sanitizers' interceptors non-weak on FreeBSDViktor Kutuzov2014-07-101-0/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D4418 llvm-svn: 212693
* [Sanitizer/interception Win] Break into the debugger on unknown instructionsTimur Iskhodzhanov2014-06-021-1/+2
| | | | llvm-svn: 210028
* [ASan Win] Fix memset interception in DLLsTimur Iskhodzhanov2014-06-021-0/+1
| | | | llvm-svn: 210027
* [ASan/Win] Use the new function interception approach to handle function ↵Timur Iskhodzhanov2014-05-221-3/+3
| | | | | | | | wrappers too; wrap strlen() in DLLs Reviewed at http://reviews.llvm.org/D3871 llvm-svn: 209427
* [ASan/Win] Refactor __interception::OverrideFunction a bit, allow the ↵Timur Iskhodzhanov2014-05-161-49/+72
| | | | | | | | orig_old_func parameter to be zero Reviewed at http://reviews.llvm.org/D3798 llvm-svn: 208989
* [sanitizer] Interception macros for sanitizers on FreeBSD; patch by Viktor ↵Kostya Serebryany2014-02-243-13/+14
| | | | | | Kutuzov llvm-svn: 202009
* [CMake] Simplify setting compile flag disabling RTTIAlexey Samsonov2014-02-181-9/+2
| | | | llvm-svn: 201547
* Move /FS to SANITIZER_COMMON_CFLAGSTimur Iskhodzhanov2014-01-301-1/+1
| | | | llvm-svn: 200485
* Quick-fix a typoTimur Iskhodzhanov2014-01-301-1/+1
| | | | llvm-svn: 200483
* Add an /FS flag to the lib/interception CMake to make it buildable with ↵Timur Iskhodzhanov2014-01-301-1/+9
| | | | | | VS2013 too llvm-svn: 200482
* Add support for more instruction prefixes so we can intercept functions in ↵Timur Iskhodzhanov2014-01-291-0/+22
| | | | | | the VS2013 RTL llvm-svn: 200366
* [msan] Wrap indirect calls to REAL(x) in interceptors.Evgeniy Stepanov2013-12-201-5/+5
| | | | llvm-svn: 197806
* PR16532: work around old GCC bug in interception_type_test.ccAlexey Samsonov2013-12-051-6/+6
| | | | llvm-svn: 196506
* [sanitizer] Avoid needless use of stringification (#symver) in ↵Evgeniy Stepanov2013-11-121-1/+1
| | | | | | | | INTERCEPT_FUNCTION_VER. This is a workaround for clang-format bug (PR17874). llvm-svn: 194468
* [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib Alexander Potapenko2013-11-071-4/+6
| | | | | | | | | | CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code. The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime. llvm-svn: 194199
* Make some pthread_mutex_* and pthread_cond_* interceptors common.Alexey Samsonov2013-10-164-3/+16
| | | | | | | | | | | | Reviewers: eugenis, dvyukov Reviewed By: dvyukov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1937 llvm-svn: 192774
* tsan: fix linking of tsan runtime into dynamic librariesDmitry Vyukov2013-09-191-3/+2
| | | | | | | versioned symbols can not be linked into dynamic library w/o linker script also simplifies code as side effect llvm-svn: 191056
* [ASan] Remove the explicit function prototypes for intercepted functions on ↵Timur Iskhodzhanov2013-09-101-2/+5
| | | | | | Windows llvm-svn: 190411
* tsan: fix linking when -ltsan is passed before -lpthreadDmitry Vyukov2013-09-031-1/+1
| | | | | | | | | | libpthread is weird: /lib/x86_64-linux-gnu/libpthread.so.0:000000000000b9b0 T pthread_cond_init@@GLIBC_2.3.2 /lib/x86_64-linux-gnu/libpthread.so.0:000000000000c720 T pthread_cond_init@GLIBC_2.2.5 let's do it with @@ for now we can always introduce more macros parameters later llvm-svn: 189788
* asan: fix android buildDmitry Vyukov2013-09-032-0/+4
| | | | | | android does not have dlvsym llvm-svn: 189781
* tsan: properly intercept pthread_cond functionsDmitry Vyukov2013-09-022-1/+11
| | | | llvm-svn: 189767
* [libsanitizer] Introduce INTERCEPTOR_WITH_SUFFIX which is to be used for ↵Alexander Potapenko2013-05-201-3/+22
| | | | | | | | appending the __DARWIN_ALIAS() version suffixes to function names on Darwin. This should fix asan/lit_tests/wait.cc under ASan. llvm-svn: 182259
* add Linux syscall wrappers and ThreadLister to sanitizer_commonKostya Serebryany2013-02-271-14/+6
| | | | | | | | ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code. Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself. Patch by Sergey Matveev llvm-svn: 176179
* [ASan] Refactoring: nuke the redundant function declarations in ↵Alexander Potapenko2013-02-211-5/+46
| | | | | | | | | | asan_intercepted_functions.h that had been used on OS X only. The INTERCEPTOR() macro on OS X is now responsible for declaring the wrapped function, the wrapper and the pair of pointers to them in __DATA,__interposition section. Thus adding an interceptor requires editing a single file now. llvm-svn: 175740
* [asan] fix x32 build (H.J. Lu)Kostya Serebryany2013-02-141-2/+2
| | | | llvm-svn: 175140
* [sanitizer] OFF_T on Mac is u64.Evgeniy Stepanov2013-02-071-0/+5
| | | | llvm-svn: 174600
OpenPOWER on IntegriCloud