summaryrefslogtreecommitdiff
path: root/lib/interception/interception_win.h
AgeCommit message (Collapse)Author
2017-12-06[Sanitizers] Use SANITIZER_* macros in lib/interceptionKamil Rytarowski
Summary: Unlike the rest of the sanitizer code, lib/interception uses native macros like __linux__ to check for specific targets instead of the common ones like SANITIZER_LINUX. When working on the Solaris port of the sanitizers, the current style was found to not only be inconsistent, but clumsy to use because the canonical way to check for Solaris is to check for __sun__ && __svr4__ which is a mouthful. Therefore, this patch switches to use SANITIZER_* macros instead. Tested on x86_64-pc-linux-gnu. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: #sanitizers, srhines, krytarowski, llvm-commits, fedor.sergeev Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39798 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Refactor the interception code on windows.Etienne Bergeron
Summary: This is a cleanup and refactoring of the interception code on windows Enhancement: * Adding the support for 64-bits code * Adding several hooking technique: * Detour * JumpRedirect * HotPatch * Trampoline * Adding a trampoline memory pool (64-bits) and release the allocated memory in unittests Cleanup: * Adding unittests for 64-bits hooking techniques * Enhancing the RoundUpInstruction by sharing common decoder Reviewers: rnk Subscribers: llvm-commits, wang0109, chrisha Differential Revision: http://reviews.llvm.org/D22111 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275123 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24[asan] Intercept all Heap* related imports from ucrtbase.dllReid Kleckner
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264327 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18[windows] Implement GetProcAddress internally to avoid initializing the CRTReid Kleckner
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25[ASan/Win] Intercept memory allocation functions in the MD CRTTimur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216382 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15[ASan/Win] Remove one more reference to ↵Timur Iskhodzhanov
__interception::GetRealFunctionAddress (follow-up to r215707) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215722 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15[ASan/Win] Remove old, unused and non-functional code that will be ↵Timur Iskhodzhanov
re-written soon git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16Make some pthread_mutex_* and pthread_cond_* interceptors common.Alexey Samsonov
Reviewers: eugenis, dvyukov Reviewed By: dvyukov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1937 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192774 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02Follow-up for r161168 for WindowsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15[asan] move lib/asan/interception to lib/interception so that other tools ↵Kostya Serebryany
(e.g. tsan) can use it git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@156816 91177308-0d34-0410-b5e6-96231b3b80d8