summaryrefslogtreecommitdiff
path: root/lib/asan/asan_malloc_win.cc
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-08-15 12:56:52 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-08-15 12:56:52 +0000
commitf6cc004ee6490760c7b304ce740eb2fa3e553577 (patch)
treefa015413ff134debb21543cb0c29ccf89acb2872 /lib/asan/asan_malloc_win.cc
parentb77dd3bbb65e41fc833a633036003cc84b11b213 (diff)
[ASan/Win] Remove old, unused and non-functional code that will be re-written soon
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_malloc_win.cc')
-rw-r--r--lib/asan/asan_malloc_win.cc29
1 files changed, 1 insertions, 28 deletions
diff --git a/lib/asan/asan_malloc_win.cc b/lib/asan/asan_malloc_win.cc
index b6d20d895..0e313c44b 100644
--- a/lib/asan/asan_malloc_win.cc
+++ b/lib/asan/asan_malloc_win.cc
@@ -133,37 +133,10 @@ int _CrtSetReportMode(int, int) {
}
} // extern "C"
-using __interception::GetRealFunctionAddress;
-
-// We don't want to include "windows.h" in this file to avoid extra attributes
-// set on malloc/free etc (e.g. dllimport), so declare a few things manually:
-extern "C" int __stdcall VirtualProtect(void* addr, size_t size,
- DWORD prot, DWORD *old_prot);
-const int PAGE_EXECUTE_READWRITE = 0x40;
-
namespace __asan {
void ReplaceSystemMalloc() {
#if defined(_DLL)
-# ifdef _WIN64
-# error ReplaceSystemMalloc was not tested on x64
-# endif
- char *crt_malloc;
- if (GetRealFunctionAddress("malloc", (void**)&crt_malloc)) {
- // Replace malloc in the CRT dll with a jump to our malloc.
- DWORD old_prot, unused;
- CHECK(VirtualProtect(crt_malloc, 16, PAGE_EXECUTE_READWRITE, &old_prot));
- REAL(memset)(crt_malloc, 0xCC /* int 3 */, 16); // just in case.
-
- ptrdiff_t jmp_offset = (char*)malloc - (char*)crt_malloc - 5;
- crt_malloc[0] = 0xE9; // jmp, should be followed by an offset.
- REAL(memcpy)(crt_malloc + 1, &jmp_offset, sizeof(jmp_offset));
-
- CHECK(VirtualProtect(crt_malloc, 16, old_prot, &unused));
-
- // FYI: FlushInstructionCache is needed on Itanium etc but not on x86/x64.
- }
-
- // FIXME: investigate whether anything else is needed.
+# error MD CRT is not yet supported, see PR20214.
#endif
}
} // namespace __asan