unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org
Cc: fweimer@redhat.com
Subject: [PATCH v3 00/10] Remove malloc hooks
Date: Fri,  2 Jul 2021 08:05:36 +0530	[thread overview]
Message-ID: <20210702023546.3081774-1-siddhesh@sourceware.org> (raw)

This patchset removes the malloc hooks __malloc_hook, __free_hook,
__realloc_hook and __memalign_hook from the API and leaves compatibility
symbols so that existing applications can continue to link to them.  The
reading and execution of the hooks has been moved to a DSO
libmalloc_compathooks.so, which can be preloaded for applications that
need it.  By default these hooks no longer have any effect in the
library.

Further, the __morecore, __morecore_after_hook and __default_morecore
hooks have also been moved to compat symbols and removed from the API.
Existing applications will continue to link to them but they won't have
any effect on malloc behaviour.

Most of the malloc tests now run one additional time to verify mcheck()
behaviour, specifically with -lmcheck.

To enable this, the MALLOC_CHECK_, mcheck() and mtrace() hooks have been
weaned away from hooks.  In the process, some mcheck() failures have
been fixed and the overall behaviour is now simpler to follow.  Finally,
tr_break and mallwatch symbols have been deprecated and are not used
anywhere.  Users are advised to use gdb watchpoints and conditional
breakpoints to debug malloc internals since they ought to provide
equivalent functionality.

Changes from v2:
- Move hooks dependencies to malloc.o{,sS}

Changes from v1:

- Added makefile dependencies for the new hooks files
- Fixed memset call in calloc debugging hooks
- Added the tr_break deprecation patch and mcheck test patch to this
  series

Siddhesh Poyarekar (10):
  mtrace: Deprecate mallwatch and tr_break
  Add mcheck tests to malloc
  Move glibc.malloc.check implementation into its own file
  malloc: Move malloc hook references to hooks.c
  glibc.malloc.check: Wean away from malloc hooks
  mcheck: Wean away from malloc hooks
  mtrace: Wean away from malloc hooks
  Remove malloc hooks
  Remove __after_morecore_hook
  Remove __morecore and __default_morecore

 Makeconfig                                    |   2 +-
 NEWS                                          |  18 +
 Rules                                         |  15 +-
 include/malloc.h                              |  11 +-
 include/stdlib.h                              |   3 -
 malloc/Makefile                               |  53 +-
 malloc/Versions                               |   3 +
 malloc/arena.c                                |  26 +-
 malloc/hooks.c                                | 545 +++++++-----------
 malloc/malloc-check.c                         | 376 ++++++++++++
 malloc/malloc-compathooks.c                   | 166 ++++++
 malloc/malloc-internal.h                      |   6 +
 malloc/malloc.c                               | 235 ++++----
 malloc/malloc.h                               |  27 -
 malloc/mcheck-hooks.c                         | 411 +++++++++++++
 malloc/mcheck-init.c                          |  14 +-
 malloc/mcheck.c                               | 369 +-----------
 malloc/morecore.c                             |  15 +-
 malloc/mtrace-hooks.c                         | 137 +++++
 malloc/mtrace.c                               | 276 +--------
 manual/memory.texi                            | 191 +-----
 sysdeps/mach/hurd/i386/libc.abilist           |   1 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   1 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   1 +
 sysdeps/unix/sysv/linux/arc/libc.abilist      |   1 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   1 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |   1 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   1 +
 .../sysv/linux/microblaze/be/libc.abilist     |   1 +
 .../sysv/linux/microblaze/le/libc.abilist     |   1 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   1 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |   1 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   1 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   1 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   1 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |   1 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   1 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |   1 +
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |   1 +
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   1 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   1 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   1 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   1 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   1 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |   1 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |   1 +
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   1 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   1 +
 54 files changed, 1597 insertions(+), 1335 deletions(-)
 create mode 100644 malloc/malloc-check.c
 create mode 100644 malloc/malloc-compathooks.c
 create mode 100644 malloc/mcheck-hooks.c
 create mode 100644 malloc/mtrace-hooks.c

-- 
2.31.1


             reply	other threads:[~2021-07-02  2:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02  2:35 Siddhesh Poyarekar via Libc-alpha [this message]
2021-07-02  2:35 ` [PATCH v3 01/10] mtrace: Deprecate mallwatch and tr_break Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 02/10] Add mcheck tests to malloc Siddhesh Poyarekar via Libc-alpha
2021-07-06 14:50   ` Stefan Liebler via Libc-alpha
2021-07-06 15:54     ` Siddhesh Poyarekar
2021-07-08 23:37       ` H.J. Lu via Libc-alpha
2021-07-09  0:06         ` H.J. Lu via Libc-alpha
2021-07-09  1:46           ` Siddhesh Poyarekar
2021-07-09  3:53             ` [PATCH] Add a generic malloc test for MALLOC_ALIGNMENT H.J. Lu via Libc-alpha
2021-07-09  4:07               ` Siddhesh Poyarekar
2021-07-09 12:24                 ` [PATCH v2] " H.J. Lu via Libc-alpha
2021-07-09 13:00                   ` Siddhesh Poyarekar
2021-07-09 13:31                     ` [PATCH v3] " H.J. Lu via Libc-alpha
2021-07-09 13:34                       ` Siddhesh Poyarekar
2021-07-12 18:02             ` [PATCH v3 02/10] Add mcheck tests to malloc Matheus Castanho via Libc-alpha
2021-07-13  1:06               ` Siddhesh Poyarekar
2021-07-13 12:11                 ` Matheus Castanho via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 03/10] Move glibc.malloc.check implementation into its own file Siddhesh Poyarekar via Libc-alpha
2021-07-02  9:05   ` Andreas Schwab
2021-07-02  9:29     ` Siddhesh Poyarekar via Libc-alpha
2021-07-02  9:59       ` Andreas Schwab
2021-07-02  2:35 ` [PATCH v3 04/10] malloc: Move malloc hook references to hooks.c Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 05/10] glibc.malloc.check: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 06/10] mcheck: " Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 07/10] mtrace: " Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 08/10] Remove " Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 09/10] Remove __after_morecore_hook Siddhesh Poyarekar via Libc-alpha
2021-07-02  2:35 ` [PATCH v3 10/10] Remove __morecore and __default_morecore Siddhesh Poyarekar via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210702023546.3081774-1-siddhesh@sourceware.org \
    --to=libc-alpha@sourceware.org \
    --cc=fweimer@redhat.com \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).