Windows ASan GetProcAddress replacement
David Major via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 14:18:49 PDT 2015
On Windows, it's not possible to hook malloc using
GetProcAddress(...,"malloc") because the GetProcAddress API will run the
target DLL's initialize routine, which can cause mallocs to happen
before the hook is installed. This was observed in
https://llvm.org/bugs/show_bug.cgi?id=24237#c2.
This patch adds a GetProcAddress replacement that manually walks the
target library's export table, without calling the initialization
routine.
(A large part of this is taken from Mozilla code at
https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h.
I hope that's okay license-wise.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GetProcAddress.patch
Type: application/octet-stream
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150819/ad62284f/attachment.obj>
More information about the llvm-commits
mailing list