llvm-project/compiler-rt/lib/interception
Reid Kleckner 3b0290570b [asan] Intercept all Heap* related imports from ucrtbase.dll
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
2016-03-24 20:19:48 +00:00
..
.clang-format Tell clang-format that (most) sanitizers are written using Google style guide. 2015-11-19 22:11:10 +00:00
CMakeLists.txt [cmake] Address Samsonov's post-commit review of r262723 2016-03-05 10:01:04 +00:00
interception.h [ASan] NFC: Factor out platform-specific interceptors 2015-03-16 14:22:53 +00:00
interception_linux.cc [sanitizer] Interception macros for sanitizers on FreeBSD; patch by Viktor Kutuzov 2014-02-24 08:37:41 +00:00
interception_linux.h [asan] Versioned interceptor for pthread_create. 2015-09-22 21:34:44 +00:00
interception_mac.cc
interception_mac.h Make some pthread_mutex_* and pthread_cond_* interceptors common. 2013-10-16 08:20:31 +00:00
interception_type_test.cc PR16532: work around old GCC bug in interception_type_test.cc 2013-12-05 13:29:46 +00:00
interception_win.cc [asan] Intercept all Heap* related imports from ucrtbase.dll 2016-03-24 20:19:48 +00:00
interception_win.h [asan] Intercept all Heap* related imports from ucrtbase.dll 2016-03-24 20:19:48 +00:00