glibc.malloc.check: Wean away from malloc hooks

System Internals / glibc - Siddhesh Poyarekar [sourceware.org] - 22 July 2021 13:08 UTC

The malloc-check debugging feature is tightly integrated into glibc malloc, so thanks to an idea from Florian Weimer, much of the malloc implementation has been moved into libc_malloc_debug.so to support malloc-check. Due to this, glibc malloc and malloc-check can no longer work together; they use altogether different (but identical) structures for heap management. This should not make a difference though since the malloc check hook is not disabled anywhere. malloc_set_state does, but it does so early enough that it shouldn't cause any problems.

The malloc check tunable is now in the debug DSO and has no effect when the DSO is not preloaded.

b5bd5bfe88 glibc.malloc.check: Wean away from malloc hooks
malloc/Makefile | 3 +-
malloc/Versions | 12 ++
malloc/arena.c | 17 +--
malloc/hooks.c | 9 --
malloc/malloc-check.c | 63 +++++----
malloc/malloc-debug.c | 154 ++++++++++++++++++---
malloc/malloc.c | 35 +++--
sysdeps/aarch64/Makefile | 3 +
sysdeps/mach/hurd/i386/libc_malloc_debug.abilist | 7 +
.../sysv/linux/aarch64/libc_malloc_debug.abilist | 7 +
.../sysv/linux/alpha/libc_malloc_debug.abilist | 7 +
.../unix/sysv/linux/arc/libc_malloc_debug.abilist | 7 +
.../sysv/linux/arm/be/libc_malloc_debug.abilist | 7 +
.../sysv/linux/arm/le/libc_malloc_debug.abilist | 7 +
.../unix/sysv/linux/csky/libc_malloc_debug.abilist | 7 +
.../unix/sysv/linux/hppa/libc_malloc_debug.abilist | 7 +
.../unix/sysv/linux/i386/libc_malloc_debug.abilist | 7 +
.../unix/sysv/linux/ia64/libc_malloc_debug.abilist | 7 +
.../linux/m68k/coldfire/libc_malloc_debug.abilist | 7 +
.../linux/m68k/m680x0/libc_malloc_debug.abilist | 7 +
.../linux/microblaze/be/libc_malloc_debug.abilist | 7 +
.../linux/microblaze/le/libc_malloc_debug.abilist | 7 +
.../mips/mips32/fpu/libc_malloc_debug.abilist | 7 +
.../mips/mips32/nofpu/libc_malloc_debug.abilist | 7 +
.../mips/mips64/n32/libc_malloc_debug.abilist | 7 +
.../mips/mips64/n64/libc_malloc_debug.abilist | 7 +
.../sysv/linux/nios2/libc_malloc_debug.abilist | 7 +
.../powerpc32/fpu/libc_malloc_debug.abilist | 7 +
.../powerpc32/nofpu/libc_malloc_debug.abilist | 7 +
.../powerpc/powerpc64/be/libc_malloc_debug.abilist | 7 +
.../powerpc/powerpc64/le/libc_malloc_debug.abilist | 7 +
.../linux/riscv/rv32/libc_malloc_debug.abilist | 7 +
.../linux/riscv/rv64/libc_malloc_debug.abilist | 7 +
.../linux/s390/s390-32/libc_malloc_debug.abilist | 7 +
.../linux/s390/s390-64/libc_malloc_debug.abilist | 7 +
.../sysv/linux/sh/be/libc_malloc_debug.abilist | 7 +
.../sysv/linux/sh/le/libc_malloc_debug.abilist | 7 +
.../linux/sparc/sparc32/libc_malloc_debug.abilist | 7 +
.../linux/sparc/sparc64/libc_malloc_debug.abilist | 7 +
.../sysv/linux/x86_64/64/libc_malloc_debug.abilist | 7 +
.../linux/x86_64/x32/libc_malloc_debug.abilist | 7 +
41 files changed, 447 insertions(+), 80 deletions(-)

Upstream: sourceware.org


  • Share