diff mbox series

[v10,09/11] Move malloc_{g,s}et_state to libc_malloc_debug

Message ID 20210719184637.1225275-10-siddhesh@sourceware.org
State New
Headers show
Series malloc hooks removal | expand

Commit Message

Siddhesh Poyarekar July 19, 2021, 6:46 p.m. UTC
These deprecated functions are only safe to call from
__malloc_initialize_hook and as a result, are not useful in the
general case.  Move the implementations to libc_malloc_debug so that
existing binaries that need it will now have to preload the debug DSO
to work correctly.

This also allows simplification of the core malloc implementation by
dropping all the undumping support code that was added to make
malloc_set_state work.

One known breakage is that of ancient emacs binaries that depend on
this.  They will now crash when running with this libc.  With
LD_BIND_NOW=1, it will terminate immediately because of not being able
to find malloc_set_state but with lazy binding it will crash in
unpredictable ways.  It will need a preloaded libc_malloc_debug.so so
that its initialization hook is executed to allow its malloc
implementation to work properly.
---
 NEWS                                          |   5 +
 malloc/Makefile                               |   5 +
 malloc/Versions                               |   4 +-
 malloc/hooks.c                                | 114 -----------
 malloc/malloc-debug.c                         | 182 +++++++++++++++++-
 malloc/malloc.c                               |  55 +-----
 sysdeps/mach/hurd/i386/libc.abilist           |   2 -
 .../mach/hurd/i386/libc_malloc_debug.abilist  |   2 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   2 -
 .../linux/aarch64/libc_malloc_debug.abilist   |   2 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   2 -
 .../linux/alpha/libc_malloc_debug.abilist     |   2 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   2 -
 .../linux/arm/be/libc_malloc_debug.abilist    |   2 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   2 -
 .../linux/arm/le/libc_malloc_debug.abilist    |   2 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   2 -
 .../sysv/linux/hppa/libc_malloc_debug.abilist |   2 +
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   2 -
 .../sysv/linux/i386/libc_malloc_debug.abilist |   2 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   2 -
 .../sysv/linux/ia64/libc_malloc_debug.abilist |   2 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |   2 -
 .../m68k/coldfire/libc_malloc_debug.abilist   |   2 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   2 -
 .../m68k/m680x0/libc_malloc_debug.abilist     |   2 +
 .../sysv/linux/microblaze/be/libc.abilist     |   2 -
 .../microblaze/be/libc_malloc_debug.abilist   |   2 +
 .../sysv/linux/microblaze/le/libc.abilist     |   2 -
 .../microblaze/le/libc_malloc_debug.abilist   |   2 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   2 -
 .../mips/mips32/fpu/libc_malloc_debug.abilist |   2 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |   2 -
 .../mips32/nofpu/libc_malloc_debug.abilist    |   2 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   2 -
 .../mips/mips64/n32/libc_malloc_debug.abilist |   2 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   2 -
 .../mips/mips64/n64/libc_malloc_debug.abilist |   2 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   2 -
 .../linux/nios2/libc_malloc_debug.abilist     |   2 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   2 -
 .../powerpc32/fpu/libc_malloc_debug.abilist   |   2 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |   2 -
 .../powerpc32/nofpu/libc_malloc_debug.abilist |   2 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   2 -
 .../powerpc64/be/libc_malloc_debug.abilist    |   2 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |   2 -
 .../powerpc64/le/libc_malloc_debug.abilist    |   2 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   2 -
 .../s390/s390-32/libc_malloc_debug.abilist    |   2 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   2 -
 .../s390/s390-64/libc_malloc_debug.abilist    |   2 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   2 -
 .../linux/sh/be/libc_malloc_debug.abilist     |   2 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   2 -
 .../linux/sh/le/libc_malloc_debug.abilist     |   2 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |   2 -
 .../sparc/sparc32/libc_malloc_debug.abilist   |   2 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |   2 -
 .../sparc/sparc64/libc_malloc_debug.abilist   |   2 +
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   2 -
 .../linux/x86_64/64/libc_malloc_debug.abilist |   2 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   2 -
 .../x86_64/x32/libc_malloc_debug.abilist      |   2 +
 64 files changed, 256 insertions(+), 225 deletions(-)

Comments

Carlos O'Donell July 22, 2021, 12:25 p.m. UTC | #1
On 7/19/21 2:46 PM, Siddhesh Poyarekar wrote:
> These deprecated functions are only safe to call from
> __malloc_initialize_hook and as a result, are not useful in the
> general case.  Move the implementations to libc_malloc_debug so that
> existing binaries that need it will now have to preload the debug DSO
> to work correctly.
> 
> This also allows simplification of the core malloc implementation by
> dropping all the undumping support code that was added to make
> malloc_set_state work.
> 
> One known breakage is that of ancient emacs binaries that depend on
> this.  They will now crash when running with this libc.  With
> LD_BIND_NOW=1, it will terminate immediately because of not being able
> to find malloc_set_state but with lazy binding it will crash in
> unpredictable ways.  It will need a preloaded libc_malloc_debug.so so
> that its initialization hook is executed to allow its malloc
> implementation to work properly.

OK for 2.34.

Tested without regression for x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  NEWS                                          |   5 +
>  malloc/Makefile                               |   5 +
>  malloc/Versions                               |   4 +-
>  malloc/hooks.c                                | 114 -----------
>  malloc/malloc-debug.c                         | 182 +++++++++++++++++-
>  malloc/malloc.c                               |  55 +-----
>  sysdeps/mach/hurd/i386/libc.abilist           |   2 -
>  .../mach/hurd/i386/libc_malloc_debug.abilist  |   2 +
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   2 -
>  .../linux/aarch64/libc_malloc_debug.abilist   |   2 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |   2 -
>  .../linux/alpha/libc_malloc_debug.abilist     |   2 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   2 -
>  .../linux/arm/be/libc_malloc_debug.abilist    |   2 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   2 -
>  .../linux/arm/le/libc_malloc_debug.abilist    |   2 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |   2 -
>  .../sysv/linux/hppa/libc_malloc_debug.abilist |   2 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |   2 -
>  .../sysv/linux/i386/libc_malloc_debug.abilist |   2 +
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |   2 -
>  .../sysv/linux/ia64/libc_malloc_debug.abilist |   2 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |   2 -
>  .../m68k/coldfire/libc_malloc_debug.abilist   |   2 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   2 -
>  .../m68k/m680x0/libc_malloc_debug.abilist     |   2 +
>  .../sysv/linux/microblaze/be/libc.abilist     |   2 -
>  .../microblaze/be/libc_malloc_debug.abilist   |   2 +
>  .../sysv/linux/microblaze/le/libc.abilist     |   2 -
>  .../microblaze/le/libc_malloc_debug.abilist   |   2 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |   2 -
>  .../mips/mips32/fpu/libc_malloc_debug.abilist |   2 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |   2 -
>  .../mips32/nofpu/libc_malloc_debug.abilist    |   2 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |   2 -
>  .../mips/mips64/n32/libc_malloc_debug.abilist |   2 +
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |   2 -
>  .../mips/mips64/n64/libc_malloc_debug.abilist |   2 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |   2 -
>  .../linux/nios2/libc_malloc_debug.abilist     |   2 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |   2 -
>  .../powerpc32/fpu/libc_malloc_debug.abilist   |   2 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |   2 -
>  .../powerpc32/nofpu/libc_malloc_debug.abilist |   2 +
>  .../linux/powerpc/powerpc64/be/libc.abilist   |   2 -
>  .../powerpc64/be/libc_malloc_debug.abilist    |   2 +
>  .../linux/powerpc/powerpc64/le/libc.abilist   |   2 -
>  .../powerpc64/le/libc_malloc_debug.abilist    |   2 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |   2 -
>  .../s390/s390-32/libc_malloc_debug.abilist    |   2 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |   2 -
>  .../s390/s390-64/libc_malloc_debug.abilist    |   2 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   2 -
>  .../linux/sh/be/libc_malloc_debug.abilist     |   2 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   2 -
>  .../linux/sh/le/libc_malloc_debug.abilist     |   2 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |   2 -
>  .../sparc/sparc32/libc_malloc_debug.abilist   |   2 +
>  .../sysv/linux/sparc/sparc64/libc.abilist     |   2 -
>  .../sparc/sparc64/libc_malloc_debug.abilist   |   2 +
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |   2 -
>  .../linux/x86_64/64/libc_malloc_debug.abilist |   2 +
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |   2 -
>  .../x86_64/x32/libc_malloc_debug.abilist      |   2 +
>  64 files changed, 256 insertions(+), 225 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index fa80c9685b..e26a9e2c17 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -138,6 +138,11 @@ Deprecated and removed features, and other changes affecting compatibility:
>    features now need to preload a new debugging DSO libc_malloc_debug.so to get
>    this functionality back.
>  
> +* The deprecated functions malloc_get_state and malloc_set_state have been
> +  moved from the core C library into libc_malloc_debug.so.  Legacy applications
> +  that still use these functions will now need to preload libc_malloc_debug.so
> +  in their environment using the LD_PRELOAD environment variable.
> +
>  Changes to build and runtime requirements:
>  
>  * On Linux, the shm_open, sem_open, and related functions now expect the
> diff --git a/malloc/Makefile b/malloc/Makefile
> index 4099d63a2a..a2b4383b68 100644
> --- a/malloc/Makefile
> +++ b/malloc/Makefile
> @@ -330,3 +330,8 @@ tst-compathooks-on-malloc-check-ENV = \
>  	LD_PRELOAD=$(objpfx)libc_malloc_debug.so
>  tst-mallocstate-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
>  tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
> +
> +# The test needs malloc_get_state/malloc_set_state which is in
> +# libc_malloc_debug.so.
> +$(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so
> +$(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so
> diff --git a/malloc/Versions b/malloc/Versions
> index cbb73d18c1..0a0bcf4bb5 100644
> --- a/malloc/Versions
> +++ b/malloc/Versions
> @@ -25,7 +25,7 @@ libc {
>      free;
>  
>      # m*
> -    mallinfo; malloc; malloc_get_state; malloc_set_state; malloc_stats;
> +    mallinfo; malloc; malloc_stats;
>      malloc_trim; malloc_usable_size; mallopt; mcheck; memalign; mprobe; mtrace;
>      muntrace;
>  
> @@ -121,6 +121,8 @@ libc_malloc_debug {
>      muntrace;
>  
>      mallinfo;
> +    malloc_get_state;
> +    malloc_set_state;
>      malloc_stats;
>      malloc_trim;
>      malloc_usable_size;
> diff --git a/malloc/hooks.c b/malloc/hooks.c
> index 6c212fbc21..8e1afe55e5 100644
> --- a/malloc/hooks.c
> +++ b/malloc/hooks.c
> @@ -39,120 +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;
>  
> -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25)
> -
> -/* Support for restoring dumped heaps contained in historic Emacs
> -   executables.  The heap saving feature (malloc_get_state) is no
> -   longer implemented in this version of glibc, but we have a heap
> -   rewriter in malloc_set_state which transforms the heap into a
> -   version compatible with current malloc.  */
> -
> -#define MALLOC_STATE_MAGIC   0x444c4541l
> -#define MALLOC_STATE_VERSION (0 * 0x100l + 5l) /* major*0x100 + minor */
> -
> -struct malloc_save_state
> -{
> -  long magic;
> -  long version;
> -  mbinptr av[NBINS * 2 + 2];
> -  char *sbrk_base;
> -  int sbrked_mem_bytes;
> -  unsigned long trim_threshold;
> -  unsigned long top_pad;
> -  unsigned int n_mmaps_max;
> -  unsigned long mmap_threshold;
> -  int check_action;
> -  unsigned long max_sbrked_mem;
> -  unsigned long max_total_mem;	/* Always 0, for backwards compatibility.  */
> -  unsigned int n_mmaps;
> -  unsigned int max_n_mmaps;
> -  unsigned long mmapped_mem;
> -  unsigned long max_mmapped_mem;
> -  int using_malloc_checking;
> -  unsigned long max_fast;
> -  unsigned long arena_test;
> -  unsigned long arena_max;
> -  unsigned long narenas;
> -};
> -
> -/* Dummy implementation which always fails.  We need to provide this
> -   symbol so that existing Emacs binaries continue to work with
> -   BIND_NOW.  */
> -void *
> -attribute_compat_text_section
> -malloc_get_state (void)
> -{
> -  __set_errno (ENOSYS);
> -  return NULL;
> -}
> -compat_symbol (libc, malloc_get_state, malloc_get_state, GLIBC_2_0);
> -
> -int
> -attribute_compat_text_section
> -malloc_set_state (void *msptr)
> -{
> -  struct malloc_save_state *ms = (struct malloc_save_state *) msptr;
> -
> -  if (ms->magic != MALLOC_STATE_MAGIC)
> -    return -1;
> -
> -  /* Must fail if the major version is too high. */
> -  if ((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl))
> -    return -2;
> -
> -  /* We do not need to perform locking here because malloc_set_state
> -     must be called before the first call into the malloc subsytem
> -     (usually via __malloc_initialize_hook).  pthread_create always
> -     calls calloc and thus must be called only afterwards, so there
> -     cannot be more than one thread when we reach this point.  */
> -
> -  /* 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
> -     dumped_main_arena_end, realloc and free will recognize these
> -     chunks as dumped fake mmapped chunks and never free them.  */
> -
> -  /* Find the chunk with the lowest address with the heap.  */
> -  mchunkptr chunk = NULL;
> -  {
> -    size_t *candidate = (size_t *) ms->sbrk_base;
> -    size_t *end = (size_t *) (ms->sbrk_base + ms->sbrked_mem_bytes);
> -    while (candidate < end)
> -      if (*candidate != 0)
> -	{
> -	  chunk = mem2chunk ((void *) (candidate + 1));
> -	  break;
> -	}
> -      else
> -	++candidate;
> -  }
> -  if (chunk == NULL)
> -    return 0;
> -
> -  /* Iterate over the dumped heap and patch the chunks so that they
> -     are treated as fake mmapped chunks.  */
> -  mchunkptr top = ms->av[2];
> -  while (chunk < top)
> -    {
> -      if (inuse (chunk))
> -	{
> -	  /* Mark chunk as mmapped, to trigger the fallback path.  */
> -	  size_t size = chunksize (chunk);
> -	  set_head (chunk, size | IS_MMAPPED);
> -	}
> -      chunk = next_chunk (chunk);
> -    }
> -
> -  /* The dumped fake mmapped chunks all lie in this address range.  */
> -  dumped_main_arena_start = (mchunkptr) ms->sbrk_base;
> -  dumped_main_arena_end = top;
> -
> -  return 0;
> -}
> -compat_symbol (libc, malloc_set_state, malloc_set_state, GLIBC_2_0);
> -
> -#endif	/* SHLIB_COMPAT */
> -
>  /*
>   * Local variables:
>   * c-basic-offset: 2
> diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
> index f5290aaa6d..b7744460e9 100644
> --- a/malloc/malloc-debug.c
> +++ b/malloc/malloc-debug.c
> @@ -145,6 +145,19 @@ memalign_hook_ini (size_t alignment, size_t sz, const void *caller)
>  
>  static size_t pagesize;
>  
> +/* These variables are used for undumping support.  Chunked are marked
> +   as using mmap, but we leave them alone if they fall into this
> +   range.  NB: The chunk size for these chunks only includes the
> +   initial size field (of SIZE_SZ bytes), there is no trailing size
> +   field (unlike with regular mmapped chunks).  */
> +static mchunkptr dumped_main_arena_start; /* Inclusive.  */
> +static mchunkptr dumped_main_arena_end;   /* Exclusive.  */
> +
> +/* True if the pointer falls into the dumped arena.  Use this after
> +   chunk_is_mmapped indicates a chunk is mmapped.  */
> +#define DUMPED_MAIN_ARENA_CHUNK(p) \
> +  ((p) >= dumped_main_arena_start && (p) < dumped_main_arena_end)
> +
>  /* The allocator functions.  */
>  
>  static void *
> @@ -184,7 +197,9 @@ __debug_free (void *mem)
>    if (__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK))
>      mem = free_mcheck (mem);
>  
> -  if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
> +  if (DUMPED_MAIN_ARENA_CHUNK (mem2chunk (mem)))
> +    /* Do nothing.  */;
> +  else if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
>      free_check (mem);
>    else
>      __libc_free (mem);
> @@ -207,7 +222,32 @@ __debug_realloc (void *oldmem, size_t bytes)
>    if ((!__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK)
>         || !realloc_mcheck_before (&oldmem, &bytes, &oldsize, &victim)))
>      {
> -      if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
> +      mchunkptr oldp = mem2chunk (oldmem);
> +
> +      /* If this is a faked mmapped chunk from the dumped main arena,
> +	 always make a copy (and do not free the old chunk).  */
> +      if (DUMPED_MAIN_ARENA_CHUNK (oldp))
> +	{
> +	  if (bytes == 0 && oldmem != NULL)
> +	    victim = NULL;
> +	  else
> +	    {
> +	      const INTERNAL_SIZE_T osize = chunksize (oldp);
> +	      /* Must alloc, copy, free. */
> +	      victim = __debug_malloc (bytes);
> +	      /* Copy as many bytes as are available from the old chunk
> +		 and fit into the new size.  NB: The overhead for faked
> +		 mmapped chunks is only SIZE_SZ, not CHUNK_HDR_SZ as for
> +		 regular mmapped chunks.  */
> +	      if (victim != NULL)
> +		{
> +		  if (bytes > osize - SIZE_SZ)
> +		    bytes = osize - SIZE_SZ;
> +		  memcpy (victim, oldmem, bytes);
> +		}
> +	    }
> +	}
> +      else if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
>  	victim =  realloc_check (oldmem, bytes);
>        else
>  	victim = __libc_realloc (oldmem, bytes);
> @@ -357,6 +397,13 @@ malloc_usable_size (void *mem)
>    if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
>      return malloc_check_get_size (mem);
>  
> +  if (mem != NULL)
> +    {
> +      mchunkptr p = mem2chunk (mem);
> +     if (DUMPED_MAIN_ARENA_CHUNK (p))
> +       return chunksize (p) - SIZE_SZ;
> +    }
> +
>    return musable (mem);
>  }
>  
> @@ -453,3 +500,134 @@ malloc_trim (size_t s)
>  
>    return LIBC_SYMBOL (malloc_trim) (s);
>  }
> +
> +#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_25)
> +
> +/* Support for restoring dumped heaps contained in historic Emacs
> +   executables.  The heap saving feature (malloc_get_state) is no
> +   longer implemented in this version of glibc, but we have a heap
> +   rewriter in malloc_set_state which transforms the heap into a
> +   version compatible with current malloc.  */
> +
> +#define MALLOC_STATE_MAGIC   0x444c4541l
> +#define MALLOC_STATE_VERSION (0 * 0x100l + 5l) /* major*0x100 + minor */
> +
> +struct malloc_save_state
> +{
> +  long magic;
> +  long version;
> +  mbinptr av[NBINS * 2 + 2];
> +  char *sbrk_base;
> +  int sbrked_mem_bytes;
> +  unsigned long trim_threshold;
> +  unsigned long top_pad;
> +  unsigned int n_mmaps_max;
> +  unsigned long mmap_threshold;
> +  int check_action;
> +  unsigned long max_sbrked_mem;
> +  unsigned long max_total_mem;	/* Always 0, for backwards compatibility.  */
> +  unsigned int n_mmaps;
> +  unsigned int max_n_mmaps;
> +  unsigned long mmapped_mem;
> +  unsigned long max_mmapped_mem;
> +  int using_malloc_checking;
> +  unsigned long max_fast;
> +  unsigned long arena_test;
> +  unsigned long arena_max;
> +  unsigned long narenas;
> +};
> +
> +/* Dummy implementation which always fails.  We need to provide this
> +   symbol so that existing Emacs binaries continue to work with
> +   BIND_NOW.  */
> +void *
> +malloc_get_state (void)
> +{
> +  __set_errno (ENOSYS);
> +  return NULL;
> +}
> +compat_symbol (libc_malloc_debug, malloc_get_state, malloc_get_state,
> +	       GLIBC_2_0);
> +
> +int
> +malloc_set_state (void *msptr)
> +{
> +  struct malloc_save_state *ms = (struct malloc_save_state *) msptr;
> +
> +  if (ms->magic != MALLOC_STATE_MAGIC)
> +    return -1;
> +
> +  /* Must fail if the major version is too high. */
> +  if ((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl))
> +    return -2;
> +
> +  if (debug_initialized == 1)
> +    return -1;
> +
> +  bool check_was_enabled = __is_malloc_debug_enabled (MALLOC_CHECK_HOOK);
> +
> +  /* It's not too late, so disable MALLOC_CHECK_ and all of the hooks.  */
> +  __malloc_hook = NULL;
> +  __realloc_hook = NULL;
> +  __free_hook = NULL;
> +  __memalign_hook = NULL;
> +  __malloc_debug_disable (MALLOC_CHECK_HOOK);
> +
> +  /* We do not need to perform locking here because malloc_set_state
> +     must be called before the first call into the malloc subsytem (usually via
> +     __malloc_initialize_hook).  pthread_create always calls calloc and thus
> +     must be called only afterwards, so there cannot be more than one thread
> +     when we reach this point.  Also handle initialization if either we ended
> +     up being called before the first malloc or through the hook when
> +     malloc-check was enabled.  */
> +  if (debug_initialized < 0)
> +    generic_hook_ini ();
> +  else if (check_was_enabled)
> +    __libc_free (__libc_malloc (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
> +     dumped_main_arena_end, realloc and free will recognize these
> +     chunks as dumped fake mmapped chunks and never free them.  */
> +
> +  /* Find the chunk with the lowest address with the heap.  */
> +  mchunkptr chunk = NULL;
> +  {
> +    size_t *candidate = (size_t *) ms->sbrk_base;
> +    size_t *end = (size_t *) (ms->sbrk_base + ms->sbrked_mem_bytes);
> +    while (candidate < end)
> +      if (*candidate != 0)
> +	{
> +	  chunk = mem2chunk ((void *) (candidate + 1));
> +	  break;
> +	}
> +      else
> +	++candidate;
> +  }
> +  if (chunk == NULL)
> +    return 0;
> +
> +  /* Iterate over the dumped heap and patch the chunks so that they
> +     are treated as fake mmapped chunks.  */
> +  mchunkptr top = ms->av[2];
> +  while (chunk < top)
> +    {
> +      if (inuse (chunk))
> +	{
> +	  /* Mark chunk as mmapped, to trigger the fallback path.  */
> +	  size_t size = chunksize (chunk);
> +	  set_head (chunk, size | IS_MMAPPED);
> +	}
> +      chunk = next_chunk (chunk);
> +    }
> +
> +  /* The dumped fake mmapped chunks all lie in this address range.  */
> +  dumped_main_arena_start = (mchunkptr) ms->sbrk_base;
> +  dumped_main_arena_end = top;
> +
> +  return 0;
> +}
> +compat_symbol (libc_malloc_debug, malloc_set_state, malloc_set_state,
> +	       GLIBC_2_0);
> +#endif
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index b8fcb2f2d3..38b649fcba 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -1921,19 +1921,6 @@ static struct malloc_state main_arena =
>    .attached_threads = 1
>  };
>  
> -/* These variables are used for undumping support.  Chunked are marked
> -   as using mmap, but we leave them alone if they fall into this
> -   range.  NB: The chunk size for these chunks only includes the
> -   initial size field (of SIZE_SZ bytes), there is no trailing size
> -   field (unlike with regular mmapped chunks).  */
> -static mchunkptr dumped_main_arena_start; /* Inclusive.  */
> -static mchunkptr dumped_main_arena_end;   /* Exclusive.  */
> -
> -/* True if the pointer falls into the dumped arena.  Use this after
> -   chunk_is_mmapped indicates a chunk is mmapped.  */
> -#define DUMPED_MAIN_ARENA_CHUNK(p) \
> -  ((p) >= dumped_main_arena_start && (p) < dumped_main_arena_end)
> -
>  /* There is only one instance of the malloc parameters.  */
>  
>  static struct malloc_par mp_ =
> @@ -2083,7 +2070,7 @@ do_check_chunk (mstate av, mchunkptr p)
>            assert (prev_inuse (p));
>          }
>      }
> -  else if (!DUMPED_MAIN_ARENA_CHUNK (p))
> +  else
>      {
>        /* address is outside main heap  */
>        if (contiguous (av) && av->top != initial_top (av))
> @@ -2948,11 +2935,6 @@ munmap_chunk (mchunkptr p)
>  
>    assert (chunk_is_mmapped (p));
>  
> -  /* Do nothing if the chunk is a faked mmapped chunk in the dumped
> -     main arena.  We never free this memory.  */
> -  if (DUMPED_MAIN_ARENA_CHUNK (p))
> -    return;
> -
>    uintptr_t mem = (uintptr_t) chunk2mem (p);
>    uintptr_t block = (uintptr_t) p - prev_size (p);
>    size_t total_size = prev_size (p) + size;
> @@ -3275,8 +3257,7 @@ __libc_free (void *mem)
>  	 Dumped fake mmapped chunks do not affect the threshold.  */
>        if (!mp_.no_dyn_threshold
>            && chunksize_nomask (p) > mp_.mmap_threshold
> -          && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX
> -	  && !DUMPED_MAIN_ARENA_CHUNK (p))
> +          && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX)
>          {
>            mp_.mmap_threshold = chunksize (p);
>            mp_.trim_threshold = 2 * mp_.mmap_threshold;
> @@ -3343,12 +3324,9 @@ __libc_realloc (void *oldmem, size_t bytes)
>    /* Little security check which won't hurt performance: the allocator
>       never wrapps around at the end of the address space.  Therefore
>       we can exclude some size values which might appear here by
> -     accident or by "design" from some intruder.  We need to bypass
> -     this check for dumped fake mmap chunks from the old main arena
> -     because the new malloc may provide additional alignment.  */
> +     accident or by "design" from some intruder.  */
>    if ((__builtin_expect ((uintptr_t) oldp > (uintptr_t) -oldsize, 0)
> -       || __builtin_expect (misaligned_chunk (oldp), 0))
> -      && !DUMPED_MAIN_ARENA_CHUNK (oldp))
> +       || __builtin_expect (misaligned_chunk (oldp), 0)))
>        malloc_printerr ("realloc(): invalid pointer");
>  
>    if (!checked_request2size (bytes, &nb))
> @@ -3359,24 +3337,6 @@ __libc_realloc (void *oldmem, size_t bytes)
>  
>    if (chunk_is_mmapped (oldp))
>      {
> -      /* If this is a faked mmapped chunk from the dumped main arena,
> -	 always make a copy (and do not free the old chunk).  */
> -      if (DUMPED_MAIN_ARENA_CHUNK (oldp))
> -	{
> -	  /* Must alloc, copy, free. */
> -	  void *newmem = __libc_malloc (bytes);
> -	  if (newmem == 0)
> -	    return NULL;
> -	  /* Copy as many bytes as are available from the old chunk
> -	     and fit into the new size.  NB: The overhead for faked
> -	     mmapped chunks is only SIZE_SZ, not CHUNK_HDR_SZ as for
> -	     regular mmapped chunks.  */
> -	  if (bytes > oldsize - SIZE_SZ)
> -	    bytes = oldsize - SIZE_SZ;
> -	  memcpy (newmem, oldmem, bytes);
> -	  return newmem;
> -	}
> -
>        void *newmem;
>  
>  #if HAVE_MREMAP
> @@ -5056,12 +5016,7 @@ musable (void *mem)
>        p = mem2chunk (mem);
>  
>        if (chunk_is_mmapped (p))
> -	{
> -	  if (DUMPED_MAIN_ARENA_CHUNK (p))
> -	    result = chunksize (p) - SIZE_SZ;
> -	  else
> -	    result = chunksize (p) - CHUNK_HDR_SZ;
> -	}
> +	result = chunksize (p) - CHUNK_HDR_SZ;
>        else if (inuse (p))
>  	result = memsize (p);
>  
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index b337d0d45b..c5da10a0cd 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -1267,8 +1267,6 @@ GLIBC_2.2.6 madvise F
>  GLIBC_2.2.6 makecontext F
>  GLIBC_2.2.6 mallinfo F
>  GLIBC_2.2.6 malloc F
> -GLIBC_2.2.6 malloc_get_state F
> -GLIBC_2.2.6 malloc_set_state F
>  GLIBC_2.2.6 malloc_stats F
>  GLIBC_2.2.6 malloc_trim F
>  GLIBC_2.2.6 malloc_usable_size F
> diff --git a/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist b/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
> index c1ff86dfbd..e1d9b10b22 100644
> --- a/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
> +++ b/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2.6 calloc F
>  GLIBC_2.2.6 free F
>  GLIBC_2.2.6 mallinfo F
>  GLIBC_2.2.6 malloc F
> +GLIBC_2.2.6 malloc_get_state F
> +GLIBC_2.2.6 malloc_set_state F
>  GLIBC_2.2.6 malloc_stats F
>  GLIBC_2.2.6 malloc_trim F
>  GLIBC_2.2.6 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 8d49fc0835..21a2e50a88 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -1324,9 +1324,7 @@ GLIBC_2.17 madvise F
>  GLIBC_2.17 makecontext F
>  GLIBC_2.17 mallinfo F
>  GLIBC_2.17 malloc F
> -GLIBC_2.17 malloc_get_state F
>  GLIBC_2.17 malloc_info F
> -GLIBC_2.17 malloc_set_state F
>  GLIBC_2.17 malloc_stats F
>  GLIBC_2.17 malloc_trim F
>  GLIBC_2.17 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
> index 65fb5036bd..c82c88dcf7 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.17 calloc F
>  GLIBC_2.17 free F
>  GLIBC_2.17 mallinfo F
>  GLIBC_2.17 malloc F
> +GLIBC_2.17 malloc_get_state F
>  GLIBC_2.17 malloc_info F
> +GLIBC_2.17 malloc_set_state F
>  GLIBC_2.17 malloc_stats F
>  GLIBC_2.17 malloc_trim F
>  GLIBC_2.17 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index db496e108f..a201fd69ba 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -792,8 +792,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
> index bdf3541c24..15b3293b03 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 1e73617837..eb3207400c 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -1757,8 +1757,6 @@ GLIBC_2.4 madvise F
>  GLIBC_2.4 makecontext F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> -GLIBC_2.4 malloc_get_state F
> -GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
> index 81be491d53..e505469154 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
> @@ -9,6 +9,8 @@ GLIBC_2.4 calloc F
>  GLIBC_2.4 free F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> +GLIBC_2.4 malloc_get_state F
> +GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 2bd1f4a0f4..cdf37e5a3b 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -1754,8 +1754,6 @@ GLIBC_2.4 madvise F
>  GLIBC_2.4 makecontext F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> -GLIBC_2.4 malloc_get_state F
> -GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
> index 81be491d53..e505469154 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
> @@ -9,6 +9,8 @@ GLIBC_2.4 calloc F
>  GLIBC_2.4 free F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> +GLIBC_2.4 malloc_get_state F
> +GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 230eb0c85a..7003962fe2 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -1181,8 +1181,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
> index 22d0bf2d8a..8798ca8653 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index d58620d817..89f8e13f50 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -774,8 +774,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index 5b78b61d4c..dd3a56d3fe 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -1197,8 +1197,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
> index 6d5574a760..554567ab85 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 9b9d0dff9d..f0f25b9feb 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -1741,8 +1741,6 @@ GLIBC_2.4 madvise F
>  GLIBC_2.4 makecontext F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> -GLIBC_2.4 malloc_get_state F
> -GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
> index 81be491d53..e505469154 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
> @@ -9,6 +9,8 @@ GLIBC_2.4 calloc F
>  GLIBC_2.4 free F
>  GLIBC_2.4 mallinfo F
>  GLIBC_2.4 malloc F
> +GLIBC_2.4 malloc_get_state F
> +GLIBC_2.4 malloc_set_state F
>  GLIBC_2.4 malloc_stats F
>  GLIBC_2.4 malloc_trim F
>  GLIBC_2.4 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 6d48dc726c..ac70103870 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -773,8 +773,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 6abbed158e..e917e90c03 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -1326,9 +1326,7 @@ GLIBC_2.18 madvise F
>  GLIBC_2.18 makecontext F
>  GLIBC_2.18 mallinfo F
>  GLIBC_2.18 malloc F
> -GLIBC_2.18 malloc_get_state F
>  GLIBC_2.18 malloc_info F
> -GLIBC_2.18 malloc_set_state F
>  GLIBC_2.18 malloc_stats F
>  GLIBC_2.18 malloc_trim F
>  GLIBC_2.18 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
> index daa80c4772..a082e71f94 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.18 calloc F
>  GLIBC_2.18 free F
>  GLIBC_2.18 mallinfo F
>  GLIBC_2.18 malloc F
> +GLIBC_2.18 malloc_get_state F
>  GLIBC_2.18 malloc_info F
> +GLIBC_2.18 malloc_set_state F
>  GLIBC_2.18 malloc_stats F
>  GLIBC_2.18 malloc_trim F
>  GLIBC_2.18 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 8b9ae1f072..c2e722596b 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -1326,9 +1326,7 @@ GLIBC_2.18 madvise F
>  GLIBC_2.18 makecontext F
>  GLIBC_2.18 mallinfo F
>  GLIBC_2.18 malloc F
> -GLIBC_2.18 malloc_get_state F
>  GLIBC_2.18 malloc_info F
> -GLIBC_2.18 malloc_set_state F
>  GLIBC_2.18 malloc_stats F
>  GLIBC_2.18 malloc_trim F
>  GLIBC_2.18 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
> index daa80c4772..a082e71f94 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.18 calloc F
>  GLIBC_2.18 free F
>  GLIBC_2.18 mallinfo F
>  GLIBC_2.18 malloc F
> +GLIBC_2.18 malloc_get_state F
>  GLIBC_2.18 malloc_info F
> +GLIBC_2.18 malloc_set_state F
>  GLIBC_2.18 malloc_stats F
>  GLIBC_2.18 malloc_trim F
>  GLIBC_2.18 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 095c2ea5da..153528de6d 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -771,8 +771,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index bc1a353726..e36d47bd32 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -771,8 +771,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index 63db2192c9..e57dfb4165 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -771,8 +771,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 35372f6c1a..c68f7e3c6c 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -769,8 +769,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
> index bdf3541c24..15b3293b03 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 2303e12935..451a7a4eb2 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -1369,9 +1369,7 @@ GLIBC_2.21 madvise F
>  GLIBC_2.21 makecontext F
>  GLIBC_2.21 mallinfo F
>  GLIBC_2.21 malloc F
> -GLIBC_2.21 malloc_get_state F
>  GLIBC_2.21 malloc_info F
> -GLIBC_2.21 malloc_set_state F
>  GLIBC_2.21 malloc_stats F
>  GLIBC_2.21 malloc_trim F
>  GLIBC_2.21 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
> index ce6c5f7631..de9a79a6dd 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.21 calloc F
>  GLIBC_2.21 free F
>  GLIBC_2.21 mallinfo F
>  GLIBC_2.21 malloc F
> +GLIBC_2.21 malloc_get_state F
>  GLIBC_2.21 malloc_info F
> +GLIBC_2.21 malloc_set_state F
>  GLIBC_2.21 malloc_stats F
>  GLIBC_2.21 malloc_trim F
>  GLIBC_2.21 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index b51067a81f..84607fa77f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -782,8 +782,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index c5112da9e5..7c5f03520a 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -782,8 +782,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index 0b7700cb84..cf864632d0 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -1301,8 +1301,6 @@ GLIBC_2.3 madvise F
>  GLIBC_2.3 makecontext F
>  GLIBC_2.3 mallinfo F
>  GLIBC_2.3 malloc F
> -GLIBC_2.3 malloc_get_state F
> -GLIBC_2.3 malloc_set_state F
>  GLIBC_2.3 malloc_stats F
>  GLIBC_2.3 malloc_trim F
>  GLIBC_2.3 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
> index 7f134f9b48..9f54dfd562 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.3 calloc F
>  GLIBC_2.3 free F
>  GLIBC_2.3 mallinfo F
>  GLIBC_2.3 malloc F
> +GLIBC_2.3 malloc_get_state F
> +GLIBC_2.3 malloc_set_state F
>  GLIBC_2.3 malloc_stats F
>  GLIBC_2.3 malloc_trim F
>  GLIBC_2.3 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index 47e5a5aa79..d566d675d0 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -1412,9 +1412,7 @@ GLIBC_2.17 madvise F
>  GLIBC_2.17 makecontext F
>  GLIBC_2.17 mallinfo F
>  GLIBC_2.17 malloc F
> -GLIBC_2.17 malloc_get_state F
>  GLIBC_2.17 malloc_info F
> -GLIBC_2.17 malloc_set_state F
>  GLIBC_2.17 malloc_stats F
>  GLIBC_2.17 malloc_trim F
>  GLIBC_2.17 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
> index 65fb5036bd..c82c88dcf7 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.17 calloc F
>  GLIBC_2.17 free F
>  GLIBC_2.17 mallinfo F
>  GLIBC_2.17 malloc F
> +GLIBC_2.17 malloc_get_state F
>  GLIBC_2.17 malloc_info F
> +GLIBC_2.17 malloc_set_state F
>  GLIBC_2.17 malloc_stats F
>  GLIBC_2.17 malloc_trim F
>  GLIBC_2.17 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index f803a1093c..6d9e7c1463 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -772,8 +772,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 3ec521cf52..83e542aa8c 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -1191,8 +1191,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
> index 6d5574a760..554567ab85 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index fcb9c99713..ebe10d06ed 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -1184,8 +1184,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
> index 22d0bf2d8a..8798ca8653 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index aa294c7685..c5dfc4045a 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -1184,8 +1184,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
> index 22d0bf2d8a..8798ca8653 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index f5f6bf24fd..e2c658d091 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -774,8 +774,6 @@ GLIBC_2.0 lseek F
>  GLIBC_2.0 madvise F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> -GLIBC_2.0 malloc_get_state F
> -GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
> index 6b3c5bfd0b..55ef952885 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
> @@ -6,6 +6,8 @@ GLIBC_2.0 calloc F
>  GLIBC_2.0 free F
>  GLIBC_2.0 mallinfo F
>  GLIBC_2.0 malloc F
> +GLIBC_2.0 malloc_get_state F
> +GLIBC_2.0 malloc_set_state F
>  GLIBC_2.0 malloc_stats F
>  GLIBC_2.0 malloc_trim F
>  GLIBC_2.0 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index e16b738b22..6268875ba3 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -1226,8 +1226,6 @@ GLIBC_2.2 madvise F
>  GLIBC_2.2 makecontext F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> -GLIBC_2.2 malloc_get_state F
> -GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
> index 6d5574a760..554567ab85 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2 calloc F
>  GLIBC_2.2 free F
>  GLIBC_2.2 mallinfo F
>  GLIBC_2.2 malloc F
> +GLIBC_2.2 malloc_get_state F
> +GLIBC_2.2 malloc_set_state F
>  GLIBC_2.2 malloc_stats F
>  GLIBC_2.2 malloc_trim F
>  GLIBC_2.2 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 12cabf3f88..095e914b73 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -1188,8 +1188,6 @@ GLIBC_2.2.5 madvise F
>  GLIBC_2.2.5 makecontext F
>  GLIBC_2.2.5 mallinfo F
>  GLIBC_2.2.5 malloc F
> -GLIBC_2.2.5 malloc_get_state F
> -GLIBC_2.2.5 malloc_set_state F
>  GLIBC_2.2.5 malloc_stats F
>  GLIBC_2.2.5 malloc_trim F
>  GLIBC_2.2.5 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
> index 3b7b729d64..45dfcd31c5 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
> @@ -8,6 +8,8 @@ GLIBC_2.2.5 calloc F
>  GLIBC_2.2.5 free F
>  GLIBC_2.2.5 mallinfo F
>  GLIBC_2.2.5 malloc F
> +GLIBC_2.2.5 malloc_get_state F
> +GLIBC_2.2.5 malloc_set_state F
>  GLIBC_2.2.5 malloc_stats F
>  GLIBC_2.2.5 malloc_trim F
>  GLIBC_2.2.5 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 545af5a689..dd910f7fe9 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -1329,9 +1329,7 @@ GLIBC_2.16 madvise F
>  GLIBC_2.16 makecontext F
>  GLIBC_2.16 mallinfo F
>  GLIBC_2.16 malloc F
> -GLIBC_2.16 malloc_get_state F
>  GLIBC_2.16 malloc_info F
> -GLIBC_2.16 malloc_set_state F
>  GLIBC_2.16 malloc_stats F
>  GLIBC_2.16 malloc_trim F
>  GLIBC_2.16 malloc_usable_size F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
> index 91d737a7f8..821525018b 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
> @@ -7,7 +7,9 @@ GLIBC_2.16 calloc F
>  GLIBC_2.16 free F
>  GLIBC_2.16 mallinfo F
>  GLIBC_2.16 malloc F
> +GLIBC_2.16 malloc_get_state F
>  GLIBC_2.16 malloc_info F
> +GLIBC_2.16 malloc_set_state F
>  GLIBC_2.16 malloc_stats F
>  GLIBC_2.16 malloc_trim F
>  GLIBC_2.16 malloc_usable_size F
>
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index fa80c9685b..e26a9e2c17 100644
--- a/NEWS
+++ b/NEWS
@@ -138,6 +138,11 @@  Deprecated and removed features, and other changes affecting compatibility:
   features now need to preload a new debugging DSO libc_malloc_debug.so to get
   this functionality back.
 
+* The deprecated functions malloc_get_state and malloc_set_state have been
+  moved from the core C library into libc_malloc_debug.so.  Legacy applications
+  that still use these functions will now need to preload libc_malloc_debug.so
+  in their environment using the LD_PRELOAD environment variable.
+
 Changes to build and runtime requirements:
 
 * On Linux, the shm_open, sem_open, and related functions now expect the
diff --git a/malloc/Makefile b/malloc/Makefile
index 4099d63a2a..a2b4383b68 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -330,3 +330,8 @@  tst-compathooks-on-malloc-check-ENV = \
 	LD_PRELOAD=$(objpfx)libc_malloc_debug.so
 tst-mallocstate-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
 tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
+
+# The test needs malloc_get_state/malloc_set_state which is in
+# libc_malloc_debug.so.
+$(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so
+$(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so
diff --git a/malloc/Versions b/malloc/Versions
index cbb73d18c1..0a0bcf4bb5 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -25,7 +25,7 @@  libc {
     free;
 
     # m*
-    mallinfo; malloc; malloc_get_state; malloc_set_state; malloc_stats;
+    mallinfo; malloc; malloc_stats;
     malloc_trim; malloc_usable_size; mallopt; mcheck; memalign; mprobe; mtrace;
     muntrace;
 
@@ -121,6 +121,8 @@  libc_malloc_debug {
     muntrace;
 
     mallinfo;
+    malloc_get_state;
+    malloc_set_state;
     malloc_stats;
     malloc_trim;
     malloc_usable_size;
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 6c212fbc21..8e1afe55e5 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -39,120 +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;
 
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25)
-
-/* Support for restoring dumped heaps contained in historic Emacs
-   executables.  The heap saving feature (malloc_get_state) is no
-   longer implemented in this version of glibc, but we have a heap
-   rewriter in malloc_set_state which transforms the heap into a
-   version compatible with current malloc.  */
-
-#define MALLOC_STATE_MAGIC   0x444c4541l
-#define MALLOC_STATE_VERSION (0 * 0x100l + 5l) /* major*0x100 + minor */
-
-struct malloc_save_state
-{
-  long magic;
-  long version;
-  mbinptr av[NBINS * 2 + 2];
-  char *sbrk_base;
-  int sbrked_mem_bytes;
-  unsigned long trim_threshold;
-  unsigned long top_pad;
-  unsigned int n_mmaps_max;
-  unsigned long mmap_threshold;
-  int check_action;
-  unsigned long max_sbrked_mem;
-  unsigned long max_total_mem;	/* Always 0, for backwards compatibility.  */
-  unsigned int n_mmaps;
-  unsigned int max_n_mmaps;
-  unsigned long mmapped_mem;
-  unsigned long max_mmapped_mem;
-  int using_malloc_checking;
-  unsigned long max_fast;
-  unsigned long arena_test;
-  unsigned long arena_max;
-  unsigned long narenas;
-};
-
-/* Dummy implementation which always fails.  We need to provide this
-   symbol so that existing Emacs binaries continue to work with
-   BIND_NOW.  */
-void *
-attribute_compat_text_section
-malloc_get_state (void)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-compat_symbol (libc, malloc_get_state, malloc_get_state, GLIBC_2_0);
-
-int
-attribute_compat_text_section
-malloc_set_state (void *msptr)
-{
-  struct malloc_save_state *ms = (struct malloc_save_state *) msptr;
-
-  if (ms->magic != MALLOC_STATE_MAGIC)
-    return -1;
-
-  /* Must fail if the major version is too high. */
-  if ((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl))
-    return -2;
-
-  /* We do not need to perform locking here because malloc_set_state
-     must be called before the first call into the malloc subsytem
-     (usually via __malloc_initialize_hook).  pthread_create always
-     calls calloc and thus must be called only afterwards, so there
-     cannot be more than one thread when we reach this point.  */
-
-  /* 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
-     dumped_main_arena_end, realloc and free will recognize these
-     chunks as dumped fake mmapped chunks and never free them.  */
-
-  /* Find the chunk with the lowest address with the heap.  */
-  mchunkptr chunk = NULL;
-  {
-    size_t *candidate = (size_t *) ms->sbrk_base;
-    size_t *end = (size_t *) (ms->sbrk_base + ms->sbrked_mem_bytes);
-    while (candidate < end)
-      if (*candidate != 0)
-	{
-	  chunk = mem2chunk ((void *) (candidate + 1));
-	  break;
-	}
-      else
-	++candidate;
-  }
-  if (chunk == NULL)
-    return 0;
-
-  /* Iterate over the dumped heap and patch the chunks so that they
-     are treated as fake mmapped chunks.  */
-  mchunkptr top = ms->av[2];
-  while (chunk < top)
-    {
-      if (inuse (chunk))
-	{
-	  /* Mark chunk as mmapped, to trigger the fallback path.  */
-	  size_t size = chunksize (chunk);
-	  set_head (chunk, size | IS_MMAPPED);
-	}
-      chunk = next_chunk (chunk);
-    }
-
-  /* The dumped fake mmapped chunks all lie in this address range.  */
-  dumped_main_arena_start = (mchunkptr) ms->sbrk_base;
-  dumped_main_arena_end = top;
-
-  return 0;
-}
-compat_symbol (libc, malloc_set_state, malloc_set_state, GLIBC_2_0);
-
-#endif	/* SHLIB_COMPAT */
-
 /*
  * Local variables:
  * c-basic-offset: 2
diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
index f5290aaa6d..b7744460e9 100644
--- a/malloc/malloc-debug.c
+++ b/malloc/malloc-debug.c
@@ -145,6 +145,19 @@  memalign_hook_ini (size_t alignment, size_t sz, const void *caller)
 
 static size_t pagesize;
 
+/* These variables are used for undumping support.  Chunked are marked
+   as using mmap, but we leave them alone if they fall into this
+   range.  NB: The chunk size for these chunks only includes the
+   initial size field (of SIZE_SZ bytes), there is no trailing size
+   field (unlike with regular mmapped chunks).  */
+static mchunkptr dumped_main_arena_start; /* Inclusive.  */
+static mchunkptr dumped_main_arena_end;   /* Exclusive.  */
+
+/* True if the pointer falls into the dumped arena.  Use this after
+   chunk_is_mmapped indicates a chunk is mmapped.  */
+#define DUMPED_MAIN_ARENA_CHUNK(p) \
+  ((p) >= dumped_main_arena_start && (p) < dumped_main_arena_end)
+
 /* The allocator functions.  */
 
 static void *
@@ -184,7 +197,9 @@  __debug_free (void *mem)
   if (__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK))
     mem = free_mcheck (mem);
 
-  if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
+  if (DUMPED_MAIN_ARENA_CHUNK (mem2chunk (mem)))
+    /* Do nothing.  */;
+  else if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
     free_check (mem);
   else
     __libc_free (mem);
@@ -207,7 +222,32 @@  __debug_realloc (void *oldmem, size_t bytes)
   if ((!__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK)
        || !realloc_mcheck_before (&oldmem, &bytes, &oldsize, &victim)))
     {
-      if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
+      mchunkptr oldp = mem2chunk (oldmem);
+
+      /* If this is a faked mmapped chunk from the dumped main arena,
+	 always make a copy (and do not free the old chunk).  */
+      if (DUMPED_MAIN_ARENA_CHUNK (oldp))
+	{
+	  if (bytes == 0 && oldmem != NULL)
+	    victim = NULL;
+	  else
+	    {
+	      const INTERNAL_SIZE_T osize = chunksize (oldp);
+	      /* Must alloc, copy, free. */
+	      victim = __debug_malloc (bytes);
+	      /* Copy as many bytes as are available from the old chunk
+		 and fit into the new size.  NB: The overhead for faked
+		 mmapped chunks is only SIZE_SZ, not CHUNK_HDR_SZ as for
+		 regular mmapped chunks.  */
+	      if (victim != NULL)
+		{
+		  if (bytes > osize - SIZE_SZ)
+		    bytes = osize - SIZE_SZ;
+		  memcpy (victim, oldmem, bytes);
+		}
+	    }
+	}
+      else if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
 	victim =  realloc_check (oldmem, bytes);
       else
 	victim = __libc_realloc (oldmem, bytes);
@@ -357,6 +397,13 @@  malloc_usable_size (void *mem)
   if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
     return malloc_check_get_size (mem);
 
+  if (mem != NULL)
+    {
+      mchunkptr p = mem2chunk (mem);
+     if (DUMPED_MAIN_ARENA_CHUNK (p))
+       return chunksize (p) - SIZE_SZ;
+    }
+
   return musable (mem);
 }
 
@@ -453,3 +500,134 @@  malloc_trim (size_t s)
 
   return LIBC_SYMBOL (malloc_trim) (s);
 }
+
+#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_25)
+
+/* Support for restoring dumped heaps contained in historic Emacs
+   executables.  The heap saving feature (malloc_get_state) is no
+   longer implemented in this version of glibc, but we have a heap
+   rewriter in malloc_set_state which transforms the heap into a
+   version compatible with current malloc.  */
+
+#define MALLOC_STATE_MAGIC   0x444c4541l
+#define MALLOC_STATE_VERSION (0 * 0x100l + 5l) /* major*0x100 + minor */
+
+struct malloc_save_state
+{
+  long magic;
+  long version;
+  mbinptr av[NBINS * 2 + 2];
+  char *sbrk_base;
+  int sbrked_mem_bytes;
+  unsigned long trim_threshold;
+  unsigned long top_pad;
+  unsigned int n_mmaps_max;
+  unsigned long mmap_threshold;
+  int check_action;
+  unsigned long max_sbrked_mem;
+  unsigned long max_total_mem;	/* Always 0, for backwards compatibility.  */
+  unsigned int n_mmaps;
+  unsigned int max_n_mmaps;
+  unsigned long mmapped_mem;
+  unsigned long max_mmapped_mem;
+  int using_malloc_checking;
+  unsigned long max_fast;
+  unsigned long arena_test;
+  unsigned long arena_max;
+  unsigned long narenas;
+};
+
+/* Dummy implementation which always fails.  We need to provide this
+   symbol so that existing Emacs binaries continue to work with
+   BIND_NOW.  */
+void *
+malloc_get_state (void)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+compat_symbol (libc_malloc_debug, malloc_get_state, malloc_get_state,
+	       GLIBC_2_0);
+
+int
+malloc_set_state (void *msptr)
+{
+  struct malloc_save_state *ms = (struct malloc_save_state *) msptr;
+
+  if (ms->magic != MALLOC_STATE_MAGIC)
+    return -1;
+
+  /* Must fail if the major version is too high. */
+  if ((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl))
+    return -2;
+
+  if (debug_initialized == 1)
+    return -1;
+
+  bool check_was_enabled = __is_malloc_debug_enabled (MALLOC_CHECK_HOOK);
+
+  /* It's not too late, so disable MALLOC_CHECK_ and all of the hooks.  */
+  __malloc_hook = NULL;
+  __realloc_hook = NULL;
+  __free_hook = NULL;
+  __memalign_hook = NULL;
+  __malloc_debug_disable (MALLOC_CHECK_HOOK);
+
+  /* We do not need to perform locking here because malloc_set_state
+     must be called before the first call into the malloc subsytem (usually via
+     __malloc_initialize_hook).  pthread_create always calls calloc and thus
+     must be called only afterwards, so there cannot be more than one thread
+     when we reach this point.  Also handle initialization if either we ended
+     up being called before the first malloc or through the hook when
+     malloc-check was enabled.  */
+  if (debug_initialized < 0)
+    generic_hook_ini ();
+  else if (check_was_enabled)
+    __libc_free (__libc_malloc (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
+     dumped_main_arena_end, realloc and free will recognize these
+     chunks as dumped fake mmapped chunks and never free them.  */
+
+  /* Find the chunk with the lowest address with the heap.  */
+  mchunkptr chunk = NULL;
+  {
+    size_t *candidate = (size_t *) ms->sbrk_base;
+    size_t *end = (size_t *) (ms->sbrk_base + ms->sbrked_mem_bytes);
+    while (candidate < end)
+      if (*candidate != 0)
+	{
+	  chunk = mem2chunk ((void *) (candidate + 1));
+	  break;
+	}
+      else
+	++candidate;
+  }
+  if (chunk == NULL)
+    return 0;
+
+  /* Iterate over the dumped heap and patch the chunks so that they
+     are treated as fake mmapped chunks.  */
+  mchunkptr top = ms->av[2];
+  while (chunk < top)
+    {
+      if (inuse (chunk))
+	{
+	  /* Mark chunk as mmapped, to trigger the fallback path.  */
+	  size_t size = chunksize (chunk);
+	  set_head (chunk, size | IS_MMAPPED);
+	}
+      chunk = next_chunk (chunk);
+    }
+
+  /* The dumped fake mmapped chunks all lie in this address range.  */
+  dumped_main_arena_start = (mchunkptr) ms->sbrk_base;
+  dumped_main_arena_end = top;
+
+  return 0;
+}
+compat_symbol (libc_malloc_debug, malloc_set_state, malloc_set_state,
+	       GLIBC_2_0);
+#endif
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b8fcb2f2d3..38b649fcba 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1921,19 +1921,6 @@  static struct malloc_state main_arena =
   .attached_threads = 1
 };
 
-/* These variables are used for undumping support.  Chunked are marked
-   as using mmap, but we leave them alone if they fall into this
-   range.  NB: The chunk size for these chunks only includes the
-   initial size field (of SIZE_SZ bytes), there is no trailing size
-   field (unlike with regular mmapped chunks).  */
-static mchunkptr dumped_main_arena_start; /* Inclusive.  */
-static mchunkptr dumped_main_arena_end;   /* Exclusive.  */
-
-/* True if the pointer falls into the dumped arena.  Use this after
-   chunk_is_mmapped indicates a chunk is mmapped.  */
-#define DUMPED_MAIN_ARENA_CHUNK(p) \
-  ((p) >= dumped_main_arena_start && (p) < dumped_main_arena_end)
-
 /* There is only one instance of the malloc parameters.  */
 
 static struct malloc_par mp_ =
@@ -2083,7 +2070,7 @@  do_check_chunk (mstate av, mchunkptr p)
           assert (prev_inuse (p));
         }
     }
-  else if (!DUMPED_MAIN_ARENA_CHUNK (p))
+  else
     {
       /* address is outside main heap  */
       if (contiguous (av) && av->top != initial_top (av))
@@ -2948,11 +2935,6 @@  munmap_chunk (mchunkptr p)
 
   assert (chunk_is_mmapped (p));
 
-  /* Do nothing if the chunk is a faked mmapped chunk in the dumped
-     main arena.  We never free this memory.  */
-  if (DUMPED_MAIN_ARENA_CHUNK (p))
-    return;
-
   uintptr_t mem = (uintptr_t) chunk2mem (p);
   uintptr_t block = (uintptr_t) p - prev_size (p);
   size_t total_size = prev_size (p) + size;
@@ -3275,8 +3257,7 @@  __libc_free (void *mem)
 	 Dumped fake mmapped chunks do not affect the threshold.  */
       if (!mp_.no_dyn_threshold
           && chunksize_nomask (p) > mp_.mmap_threshold
-          && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX
-	  && !DUMPED_MAIN_ARENA_CHUNK (p))
+          && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX)
         {
           mp_.mmap_threshold = chunksize (p);
           mp_.trim_threshold = 2 * mp_.mmap_threshold;
@@ -3343,12 +3324,9 @@  __libc_realloc (void *oldmem, size_t bytes)
   /* Little security check which won't hurt performance: the allocator
      never wrapps around at the end of the address space.  Therefore
      we can exclude some size values which might appear here by
-     accident or by "design" from some intruder.  We need to bypass
-     this check for dumped fake mmap chunks from the old main arena
-     because the new malloc may provide additional alignment.  */
+     accident or by "design" from some intruder.  */
   if ((__builtin_expect ((uintptr_t) oldp > (uintptr_t) -oldsize, 0)
-       || __builtin_expect (misaligned_chunk (oldp), 0))
-      && !DUMPED_MAIN_ARENA_CHUNK (oldp))
+       || __builtin_expect (misaligned_chunk (oldp), 0)))
       malloc_printerr ("realloc(): invalid pointer");
 
   if (!checked_request2size (bytes, &nb))
@@ -3359,24 +3337,6 @@  __libc_realloc (void *oldmem, size_t bytes)
 
   if (chunk_is_mmapped (oldp))
     {
-      /* If this is a faked mmapped chunk from the dumped main arena,
-	 always make a copy (and do not free the old chunk).  */
-      if (DUMPED_MAIN_ARENA_CHUNK (oldp))
-	{
-	  /* Must alloc, copy, free. */
-	  void *newmem = __libc_malloc (bytes);
-	  if (newmem == 0)
-	    return NULL;
-	  /* Copy as many bytes as are available from the old chunk
-	     and fit into the new size.  NB: The overhead for faked
-	     mmapped chunks is only SIZE_SZ, not CHUNK_HDR_SZ as for
-	     regular mmapped chunks.  */
-	  if (bytes > oldsize - SIZE_SZ)
-	    bytes = oldsize - SIZE_SZ;
-	  memcpy (newmem, oldmem, bytes);
-	  return newmem;
-	}
-
       void *newmem;
 
 #if HAVE_MREMAP
@@ -5056,12 +5016,7 @@  musable (void *mem)
       p = mem2chunk (mem);
 
       if (chunk_is_mmapped (p))
-	{
-	  if (DUMPED_MAIN_ARENA_CHUNK (p))
-	    result = chunksize (p) - SIZE_SZ;
-	  else
-	    result = chunksize (p) - CHUNK_HDR_SZ;
-	}
+	result = chunksize (p) - CHUNK_HDR_SZ;
       else if (inuse (p))
 	result = memsize (p);
 
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index b337d0d45b..c5da10a0cd 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -1267,8 +1267,6 @@  GLIBC_2.2.6 madvise F
 GLIBC_2.2.6 makecontext F
 GLIBC_2.2.6 mallinfo F
 GLIBC_2.2.6 malloc F
-GLIBC_2.2.6 malloc_get_state F
-GLIBC_2.2.6 malloc_set_state F
 GLIBC_2.2.6 malloc_stats F
 GLIBC_2.2.6 malloc_trim F
 GLIBC_2.2.6 malloc_usable_size F
diff --git a/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist b/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
index c1ff86dfbd..e1d9b10b22 100644
--- a/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
+++ b/sysdeps/mach/hurd/i386/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2.6 calloc F
 GLIBC_2.2.6 free F
 GLIBC_2.2.6 mallinfo F
 GLIBC_2.2.6 malloc F
+GLIBC_2.2.6 malloc_get_state F
+GLIBC_2.2.6 malloc_set_state F
 GLIBC_2.2.6 malloc_stats F
 GLIBC_2.2.6 malloc_trim F
 GLIBC_2.2.6 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 8d49fc0835..21a2e50a88 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -1324,9 +1324,7 @@  GLIBC_2.17 madvise F
 GLIBC_2.17 makecontext F
 GLIBC_2.17 mallinfo F
 GLIBC_2.17 malloc F
-GLIBC_2.17 malloc_get_state F
 GLIBC_2.17 malloc_info F
-GLIBC_2.17 malloc_set_state F
 GLIBC_2.17 malloc_stats F
 GLIBC_2.17 malloc_trim F
 GLIBC_2.17 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
index 65fb5036bd..c82c88dcf7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.17 calloc F
 GLIBC_2.17 free F
 GLIBC_2.17 mallinfo F
 GLIBC_2.17 malloc F
+GLIBC_2.17 malloc_get_state F
 GLIBC_2.17 malloc_info F
+GLIBC_2.17 malloc_set_state F
 GLIBC_2.17 malloc_stats F
 GLIBC_2.17 malloc_trim F
 GLIBC_2.17 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index db496e108f..a201fd69ba 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -792,8 +792,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
index bdf3541c24..15b3293b03 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 1e73617837..eb3207400c 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -1757,8 +1757,6 @@  GLIBC_2.4 madvise F
 GLIBC_2.4 makecontext F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
-GLIBC_2.4 malloc_get_state F
-GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
index 81be491d53..e505469154 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc_malloc_debug.abilist
@@ -9,6 +9,8 @@  GLIBC_2.4 calloc F
 GLIBC_2.4 free F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
+GLIBC_2.4 malloc_get_state F
+GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 2bd1f4a0f4..cdf37e5a3b 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -1754,8 +1754,6 @@  GLIBC_2.4 madvise F
 GLIBC_2.4 makecontext F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
-GLIBC_2.4 malloc_get_state F
-GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
index 81be491d53..e505469154 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc_malloc_debug.abilist
@@ -9,6 +9,8 @@  GLIBC_2.4 calloc F
 GLIBC_2.4 free F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
+GLIBC_2.4 malloc_get_state F
+GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 230eb0c85a..7003962fe2 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1181,8 +1181,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
index 22d0bf2d8a..8798ca8653 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index d58620d817..89f8e13f50 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -774,8 +774,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 5b78b61d4c..dd3a56d3fe 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1197,8 +1197,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
index 6d5574a760..554567ab85 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 9b9d0dff9d..f0f25b9feb 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -1741,8 +1741,6 @@  GLIBC_2.4 madvise F
 GLIBC_2.4 makecontext F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
-GLIBC_2.4 malloc_get_state F
-GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
index 81be491d53..e505469154 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc_malloc_debug.abilist
@@ -9,6 +9,8 @@  GLIBC_2.4 calloc F
 GLIBC_2.4 free F
 GLIBC_2.4 mallinfo F
 GLIBC_2.4 malloc F
+GLIBC_2.4 malloc_get_state F
+GLIBC_2.4 malloc_set_state F
 GLIBC_2.4 malloc_stats F
 GLIBC_2.4 malloc_trim F
 GLIBC_2.4 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 6d48dc726c..ac70103870 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -773,8 +773,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 6abbed158e..e917e90c03 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -1326,9 +1326,7 @@  GLIBC_2.18 madvise F
 GLIBC_2.18 makecontext F
 GLIBC_2.18 mallinfo F
 GLIBC_2.18 malloc F
-GLIBC_2.18 malloc_get_state F
 GLIBC_2.18 malloc_info F
-GLIBC_2.18 malloc_set_state F
 GLIBC_2.18 malloc_stats F
 GLIBC_2.18 malloc_trim F
 GLIBC_2.18 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
index daa80c4772..a082e71f94 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.18 calloc F
 GLIBC_2.18 free F
 GLIBC_2.18 mallinfo F
 GLIBC_2.18 malloc F
+GLIBC_2.18 malloc_get_state F
 GLIBC_2.18 malloc_info F
+GLIBC_2.18 malloc_set_state F
 GLIBC_2.18 malloc_stats F
 GLIBC_2.18 malloc_trim F
 GLIBC_2.18 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 8b9ae1f072..c2e722596b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -1326,9 +1326,7 @@  GLIBC_2.18 madvise F
 GLIBC_2.18 makecontext F
 GLIBC_2.18 mallinfo F
 GLIBC_2.18 malloc F
-GLIBC_2.18 malloc_get_state F
 GLIBC_2.18 malloc_info F
-GLIBC_2.18 malloc_set_state F
 GLIBC_2.18 malloc_stats F
 GLIBC_2.18 malloc_trim F
 GLIBC_2.18 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
index daa80c4772..a082e71f94 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.18 calloc F
 GLIBC_2.18 free F
 GLIBC_2.18 mallinfo F
 GLIBC_2.18 malloc F
+GLIBC_2.18 malloc_get_state F
 GLIBC_2.18 malloc_info F
+GLIBC_2.18 malloc_set_state F
 GLIBC_2.18 malloc_stats F
 GLIBC_2.18 malloc_trim F
 GLIBC_2.18 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 095c2ea5da..153528de6d 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -771,8 +771,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index bc1a353726..e36d47bd32 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -771,8 +771,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 63db2192c9..e57dfb4165 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -771,8 +771,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 35372f6c1a..c68f7e3c6c 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -769,8 +769,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
index bdf3541c24..15b3293b03 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 2303e12935..451a7a4eb2 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -1369,9 +1369,7 @@  GLIBC_2.21 madvise F
 GLIBC_2.21 makecontext F
 GLIBC_2.21 mallinfo F
 GLIBC_2.21 malloc F
-GLIBC_2.21 malloc_get_state F
 GLIBC_2.21 malloc_info F
-GLIBC_2.21 malloc_set_state F
 GLIBC_2.21 malloc_stats F
 GLIBC_2.21 malloc_trim F
 GLIBC_2.21 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
index ce6c5f7631..de9a79a6dd 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.21 calloc F
 GLIBC_2.21 free F
 GLIBC_2.21 mallinfo F
 GLIBC_2.21 malloc F
+GLIBC_2.21 malloc_get_state F
 GLIBC_2.21 malloc_info F
+GLIBC_2.21 malloc_set_state F
 GLIBC_2.21 malloc_stats F
 GLIBC_2.21 malloc_trim F
 GLIBC_2.21 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index b51067a81f..84607fa77f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -782,8 +782,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index c5112da9e5..7c5f03520a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -782,8 +782,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 0b7700cb84..cf864632d0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -1301,8 +1301,6 @@  GLIBC_2.3 madvise F
 GLIBC_2.3 makecontext F
 GLIBC_2.3 mallinfo F
 GLIBC_2.3 malloc F
-GLIBC_2.3 malloc_get_state F
-GLIBC_2.3 malloc_set_state F
 GLIBC_2.3 malloc_stats F
 GLIBC_2.3 malloc_trim F
 GLIBC_2.3 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
index 7f134f9b48..9f54dfd562 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.3 calloc F
 GLIBC_2.3 free F
 GLIBC_2.3 mallinfo F
 GLIBC_2.3 malloc F
+GLIBC_2.3 malloc_get_state F
+GLIBC_2.3 malloc_set_state F
 GLIBC_2.3 malloc_stats F
 GLIBC_2.3 malloc_trim F
 GLIBC_2.3 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 47e5a5aa79..d566d675d0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -1412,9 +1412,7 @@  GLIBC_2.17 madvise F
 GLIBC_2.17 makecontext F
 GLIBC_2.17 mallinfo F
 GLIBC_2.17 malloc F
-GLIBC_2.17 malloc_get_state F
 GLIBC_2.17 malloc_info F
-GLIBC_2.17 malloc_set_state F
 GLIBC_2.17 malloc_stats F
 GLIBC_2.17 malloc_trim F
 GLIBC_2.17 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
index 65fb5036bd..c82c88dcf7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.17 calloc F
 GLIBC_2.17 free F
 GLIBC_2.17 mallinfo F
 GLIBC_2.17 malloc F
+GLIBC_2.17 malloc_get_state F
 GLIBC_2.17 malloc_info F
+GLIBC_2.17 malloc_set_state F
 GLIBC_2.17 malloc_stats F
 GLIBC_2.17 malloc_trim F
 GLIBC_2.17 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index f803a1093c..6d9e7c1463 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -772,8 +772,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 3ec521cf52..83e542aa8c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1191,8 +1191,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
index 6d5574a760..554567ab85 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index fcb9c99713..ebe10d06ed 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -1184,8 +1184,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
index 22d0bf2d8a..8798ca8653 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index aa294c7685..c5dfc4045a 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -1184,8 +1184,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
index 22d0bf2d8a..8798ca8653 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index f5f6bf24fd..e2c658d091 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -774,8 +774,6 @@  GLIBC_2.0 lseek F
 GLIBC_2.0 madvise F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
-GLIBC_2.0 malloc_get_state F
-GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
index 6b3c5bfd0b..55ef952885 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_malloc_debug.abilist
@@ -6,6 +6,8 @@  GLIBC_2.0 calloc F
 GLIBC_2.0 free F
 GLIBC_2.0 mallinfo F
 GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_get_state F
+GLIBC_2.0 malloc_set_state F
 GLIBC_2.0 malloc_stats F
 GLIBC_2.0 malloc_trim F
 GLIBC_2.0 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index e16b738b22..6268875ba3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1226,8 +1226,6 @@  GLIBC_2.2 madvise F
 GLIBC_2.2 makecontext F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_get_state F
-GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
index 6d5574a760..554567ab85 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2 calloc F
 GLIBC_2.2 free F
 GLIBC_2.2 mallinfo F
 GLIBC_2.2 malloc F
+GLIBC_2.2 malloc_get_state F
+GLIBC_2.2 malloc_set_state F
 GLIBC_2.2 malloc_stats F
 GLIBC_2.2 malloc_trim F
 GLIBC_2.2 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 12cabf3f88..095e914b73 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1188,8 +1188,6 @@  GLIBC_2.2.5 madvise F
 GLIBC_2.2.5 makecontext F
 GLIBC_2.2.5 mallinfo F
 GLIBC_2.2.5 malloc F
-GLIBC_2.2.5 malloc_get_state F
-GLIBC_2.2.5 malloc_set_state F
 GLIBC_2.2.5 malloc_stats F
 GLIBC_2.2.5 malloc_trim F
 GLIBC_2.2.5 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
index 3b7b729d64..45dfcd31c5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist
@@ -8,6 +8,8 @@  GLIBC_2.2.5 calloc F
 GLIBC_2.2.5 free F
 GLIBC_2.2.5 mallinfo F
 GLIBC_2.2.5 malloc F
+GLIBC_2.2.5 malloc_get_state F
+GLIBC_2.2.5 malloc_set_state F
 GLIBC_2.2.5 malloc_stats F
 GLIBC_2.2.5 malloc_trim F
 GLIBC_2.2.5 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 545af5a689..dd910f7fe9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -1329,9 +1329,7 @@  GLIBC_2.16 madvise F
 GLIBC_2.16 makecontext F
 GLIBC_2.16 mallinfo F
 GLIBC_2.16 malloc F
-GLIBC_2.16 malloc_get_state F
 GLIBC_2.16 malloc_info F
-GLIBC_2.16 malloc_set_state F
 GLIBC_2.16 malloc_stats F
 GLIBC_2.16 malloc_trim F
 GLIBC_2.16 malloc_usable_size F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
index 91d737a7f8..821525018b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc_malloc_debug.abilist
@@ -7,7 +7,9 @@  GLIBC_2.16 calloc F
 GLIBC_2.16 free F
 GLIBC_2.16 mallinfo F
 GLIBC_2.16 malloc F
+GLIBC_2.16 malloc_get_state F
 GLIBC_2.16 malloc_info F
+GLIBC_2.16 malloc_set_state F
 GLIBC_2.16 malloc_stats F
 GLIBC_2.16 malloc_trim F
 GLIBC_2.16 malloc_usable_size F