about summary refs log tree commit diff
path: root/malloc/hooks.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-07-22 18:38:08 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-07-22 18:38:08 +0530
commitb5bd5bfe88f496463ec9fab680a8edf64d7c2a42 (patch)
tree51978efe075143c64fcd622b051faa49572928db /malloc/hooks.c
parent9dad716d4d2993f50b165747781244bd7c43bc95 (diff)
downloadglibc-b5bd5bfe88f496463ec9fab680a8edf64d7c2a42.tar.gz
glibc-b5bd5bfe88f496463ec9fab680a8edf64d7c2a42.tar.xz
glibc-b5bd5bfe88f496463ec9fab680a8edf64d7c2a42.zip
glibc.malloc.check: Wean away from malloc hooks
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.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r--malloc/hooks.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 8e9fefe6c3..6c212fbc21 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -39,8 +39,6 @@ void *weak_variable (*__malloc_hook) (size_t, const void *) = NULL;
 void *weak_variable (*__realloc_hook) (void *, size_t, const void *) = NULL;
 void *weak_variable (*__memalign_hook) (size_t, size_t, const void *) = NULL;
 
-#include "malloc-check.c"
-
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25)
 
 /* Support for restoring dumped heaps contained in historic Emacs
@@ -108,13 +106,6 @@ malloc_set_state (void *msptr)
      calls calloc and thus must be called only afterwards, so there
      cannot be more than one thread when we reach this point.  */
 
-  /* Disable the malloc hooks (and malloc checking).  */
-  __malloc_hook = NULL;
-  __realloc_hook = NULL;
-  __free_hook = NULL;
-  __memalign_hook = NULL;
-  using_malloc_checking = 0;
-
   /* Patch the dumped heap.  We no longer try to integrate into the
      existing heap.  Instead, we mark the existing chunks as mmapped.
      Together with the update to dumped_main_arena_start and