[PATCH] D148989: [compiler-rt][asan] Add report on intercept fail to more places

Alvin Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 06:25:52 PDT 2023


alvinhochun created this revision.
alvinhochun added reviewers: vitalybuka, mstorsjo.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
alvinhochun requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

Use `ASAN_INTERCEPT_FUNC` instead of `INTERCEPT_FUNCTION` so it checks
the return value and reports a message if verbosity >= 1.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148989

Files:
  compiler-rt/lib/asan/asan_interceptors.cpp
  compiler-rt/lib/asan/asan_malloc_win.cpp


Index: compiler-rt/lib/asan/asan_malloc_win.cpp
===================================================================
--- compiler-rt/lib/asan/asan_malloc_win.cpp
+++ compiler-rt/lib/asan/asan_malloc_win.cpp
@@ -508,10 +508,10 @@
   TryToOverrideFunction("_expand_base", (uptr)_expand);
 
   if (flags()->windows_hook_rtl_allocators) {
-    INTERCEPT_FUNCTION(HeapSize);
-    INTERCEPT_FUNCTION(HeapFree);
-    INTERCEPT_FUNCTION(HeapReAlloc);
-    INTERCEPT_FUNCTION(HeapAlloc);
+    ASAN_INTERCEPT_FUNC(HeapSize);
+    ASAN_INTERCEPT_FUNC(HeapFree);
+    ASAN_INTERCEPT_FUNC(HeapReAlloc);
+    ASAN_INTERCEPT_FUNC(HeapAlloc);
 
     // Undocumented functions must be intercepted by name, not by symbol.
     __interception::OverrideFunction("RtlSizeHeap", (uptr)WRAP(RtlSizeHeap),
Index: compiler-rt/lib/asan/asan_interceptors.cpp
===================================================================
--- compiler-rt/lib/asan/asan_interceptors.cpp
+++ compiler-rt/lib/asan/asan_interceptors.cpp
@@ -706,11 +706,11 @@
 #endif
   // Indirectly intercept std::rethrow_exception.
 #if ASAN_INTERCEPT__UNWIND_RAISEEXCEPTION
-  INTERCEPT_FUNCTION(_Unwind_RaiseException);
+  ASAN_INTERCEPT_FUNC(_Unwind_RaiseException);
 #endif
   // Indirectly intercept std::rethrow_exception.
 #if ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION
-  INTERCEPT_FUNCTION(_Unwind_SjLj_RaiseException);
+  ASAN_INTERCEPT_FUNC(_Unwind_SjLj_RaiseException);
 #endif
 
   // Intercept threading-related functions


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148989.516064.patch
Type: text/x-patch
Size: 1478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230422/0d9cf47c/attachment.bin>


More information about the llvm-commits mailing list