From 5bb826d569ccd80e28aedd682db39b8cddd44e53 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Wed, 29 Mar 2023 17:34:16 +0000 Subject: [PATCH] Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia This reverts commit 3b4cb1e96c645bb833fe710856479c31383859bb. Reland D145718 but unconditionally define __sanitizer_mallinfo which is exposed as part of the hwasan interface. Differential Revision: https://reviews.llvm.org/D145718 --- compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp index ad359b1..6807691 100644 --- a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp +++ b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp @@ -16,10 +16,9 @@ #include "interception/interception.h" #include "sanitizer_common/sanitizer_allocator_dlsym.h" #include "sanitizer_common/sanitizer_allocator_interface.h" +#include "sanitizer_common/sanitizer_mallinfo.h" #include "sanitizer_common/sanitizer_tls_get_addr.h" -#if !SANITIZER_FUCHSIA - using namespace __hwasan; struct DlsymAlloc : public DlSymAllocator { @@ -155,12 +154,9 @@ void *__sanitizer_malloc(uptr size) { } // extern "C" -#if HWASAN_WITH_INTERCEPTORS -# define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE RET WRAP(FN)(ARGS) \ - ALIAS("__sanitizer_" #FN); \ - extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE RET FN( \ - ARGS) ALIAS("__sanitizer_" #FN) +#define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ + extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE RET FN( \ + ARGS) ALIAS("__sanitizer_" #FN) INTERCEPTOR_ALIAS(int, posix_memalign, void **memptr, SIZE_T alignment, SIZE_T size); @@ -182,6 +178,3 @@ INTERCEPTOR_ALIAS(__sanitizer_struct_mallinfo, mallinfo); INTERCEPTOR_ALIAS(int, mallopt, int cmd, int value); INTERCEPTOR_ALIAS(void, malloc_stats, void); # endif -#endif // #if HWASAN_WITH_INTERCEPTORS - -#endif // SANITIZER_FUCHSIA -- 2.7.4