[compiler-rt] 571b94f - [compiler-rt][asan] Add report on intercept fail to more places

Alvin Wong via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 04:26:48 PDT 2023


Author: Alvin Wong
Date: 2023-04-25T19:21:48+08:00
New Revision: 571b94f3d77606cb439db1fd64d4483bc409dd33

URL: https://github.com/llvm/llvm-project/commit/571b94f3d77606cb439db1fd64d4483bc409dd33
DIFF: https://github.com/llvm/llvm-project/commit/571b94f3d77606cb439db1fd64d4483bc409dd33.diff

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

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

Differential Revision: https://reviews.llvm.org/D148989

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index 013bdb64038d8..0f1600552481b 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -706,11 +706,11 @@ void InitializeAsanInterceptors() {
 #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

diff  --git a/compiler-rt/lib/asan/asan_malloc_win.cpp b/compiler-rt/lib/asan/asan_malloc_win.cpp
index 4b76d4ebd3eb4..ff78d7646a90d 100644
--- a/compiler-rt/lib/asan/asan_malloc_win.cpp
+++ b/compiler-rt/lib/asan/asan_malloc_win.cpp
@@ -508,10 +508,10 @@ void ReplaceSystemMalloc() {
   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),


        


More information about the llvm-commits mailing list