[PATCH] D55684: Windows ASan: Instrument _msize_base()

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 16:07:16 PST 2018


vlad.tsyrklevich created this revision.
Herald added subscribers: llvm-commits, kubamracek.

A recent update to the VS toolchain in chromium [1] broke the windows
ASan bot because the new toolchain calls _msize_base() instead of
_msize() in a number of _aligned_* UCRT routines. Instrument
_msize_base() as well.

[1] https://crbug.com/914947


Repository:
  rL LLVM

https://reviews.llvm.org/D55684

Files:
  compiler-rt/lib/asan/asan_malloc_win.cc
  compiler-rt/lib/asan/asan_win_dll_thunk.cc


Index: compiler-rt/lib/asan/asan_win_dll_thunk.cc
===================================================================
--- compiler-rt/lib/asan/asan_win_dll_thunk.cc
+++ compiler-rt/lib/asan/asan_win_dll_thunk.cc
@@ -48,6 +48,7 @@
 INTERCEPT_WRAP_W_WWW(_recalloc_base)
 
 INTERCEPT_WRAP_W_W(_msize)
+INTERCEPT_WRAP_W_W(_msize_base)
 INTERCEPT_WRAP_W_W(_expand)
 INTERCEPT_WRAP_W_W(_expand_dbg)
 
Index: compiler-rt/lib/asan/asan_malloc_win.cc
===================================================================
--- compiler-rt/lib/asan/asan_malloc_win.cc
+++ compiler-rt/lib/asan/asan_malloc_win.cc
@@ -140,6 +140,11 @@
   return asan_malloc_usable_size(ptr, pc, bp);
 }
 
+ALLOCATION_FUNCTION_ATTRIBUTE
+size_t _msize_base(void *ptr) {
+  return _msize(ptr);
+}
+
 ALLOCATION_FUNCTION_ATTRIBUTE
 void *_expand(void *memblock, size_t size) {
   // _expand is used in realloc-like functions to resize the buffer if possible.
@@ -235,6 +240,7 @@
   TryToOverrideFunction("_recalloc_base", (uptr)_recalloc);
   TryToOverrideFunction("_recalloc_crt", (uptr)_recalloc);
   TryToOverrideFunction("_msize", (uptr)_msize);
+  TryToOverrideFunction("_msize_base", (uptr)_msize);
   TryToOverrideFunction("_expand", (uptr)_expand);
   TryToOverrideFunction("_expand_base", (uptr)_expand);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55684.178157.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181214/d1b2cfd7/attachment.bin>


More information about the llvm-commits mailing list