[compiler-rt] 3ab3671 - [hwasan] RunMallocHooks with orig_size

Jin Xin Ng via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 11:19:56 PDT 2023


Author: Jin Xin Ng
Date: 2023-05-31T18:19:30Z
New Revision: 3ab36712da6e43588dc15c8672949fa12fe5f74f

URL: https://github.com/llvm/llvm-project/commit/3ab36712da6e43588dc15c8672949fa12fe5f74f
DIFF: https://github.com/llvm/llvm-project/commit/3ab36712da6e43588dc15c8672949fa12fe5f74f.diff

LOG: [hwasan] RunMallocHooks with orig_size

This matches behaviour of asan. sanitizer_common/TestCases/malloc_hook.cpp
should've caught this- but hwasan was on XFAIL.

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_allocator.cpp
    compiler-rt/test/sanitizer_common/TestCases/malloc_hook.cpp
    compiler-rt/test/sanitizer_common/TestCases/malloc_hook_get_allocated_size_fast.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 6e6e63517b762..48f1873ed6821 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -265,7 +265,7 @@ static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment,
                                                   : __lsan::kDirectlyLeaked);
 #endif
   meta->SetAllocated(StackDepotPut(*stack), orig_size);
-  RunMallocHooks(user_ptr, size);
+  RunMallocHooks(user_ptr, orig_size);
   return user_ptr;
 }
 

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/malloc_hook.cpp b/compiler-rt/test/sanitizer_common/TestCases/malloc_hook.cpp
index 076f5fc77a4e4..44dffcd47a51a 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/malloc_hook.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/malloc_hook.cpp
@@ -6,9 +6,6 @@
 // Must not be implemented, no other reason to install interceptors.
 // XFAIL: ubsan
 
-// FIXME: Implement.
-// XFAIL: hwasan
-
 #include <stdlib.h>
 #include <unistd.h>
 #include <sanitizer/allocator_interface.h>

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/malloc_hook_get_allocated_size_fast.cpp b/compiler-rt/test/sanitizer_common/TestCases/malloc_hook_get_allocated_size_fast.cpp
index 7acd2f698d642..68b22d4f99f63 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/malloc_hook_get_allocated_size_fast.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/malloc_hook_get_allocated_size_fast.cpp
@@ -6,9 +6,6 @@
 // Must not be implemented, no other reason to install interceptors.
 // XFAIL: ubsan
 
-// FIXME: Implement.
-// XFAIL: hwasan
-
 #include <assert.h>
 #include <sanitizer/allocator_interface.h>
 #include <stdlib.h>


        


More information about the llvm-commits mailing list