From 074b5b5d073137762a3bbef3cece5646cea537b5 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Sat, 12 Mar 2022 09:52:36 +0100 Subject: [PATCH 1/2] __sanitizer_struct_mallinfo vs mallinfo2 size assertion libsanitizer/Changelog: * configure.ac: add mallinfo2 probe * sanitizer_common/sanitizer_platform_limits_posix.h (struct __sanitizer_struct_mallinfo): use mallinfo2 probe Signed-off-by: Reini Urban --- libsanitizer/configure.ac | 3 ++- .../sanitizer_common/sanitizer_platform_limits_posix.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git libsanitizer/configure.ac libsanitizer/configure.ac index 04cd8910ed6..227c2644ecd 100644 --- libsanitizer/configure.ac +++ libsanitizer/configure.ac @@ -103,7 +103,8 @@ AM_CONDITIONAL(LSAN_SUPPORTED, [test "x$LSAN_SUPPORTED" = "xyes"]) AM_CONDITIONAL(HWASAN_SUPPORTED, [test "x$HWASAN_SUPPORTED" = "xyes"]) # Check for functions needed. -AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime lstat readlink) +AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime lstat readlink \ + mallinfo mallinfo2) # Common libraries that we need to link against for all sanitizer libs. link_sanitizer_common='-lpthread -lm' diff --git libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index 44dd3d9e22d..918ee95ef82 100644 --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -213,7 +213,12 @@ struct __sanitizer_struct_mallinfo { #if SANITIZER_LINUX && !SANITIZER_ANDROID struct __sanitizer_struct_mallinfo { + // e.g ubuntu uses mallinfo, fedora mallinfo2 +#ifdef HAVE_MALLINFO2 + long v[10]; +#else int v[10]; +#endif }; extern unsigned struct_ustat_sz; -- 2.34.1