From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dog.elm.relay.mailchannels.net (dog.elm.relay.mailchannels.net [23.83.212.48]) by sourceware.org (Postfix) with ESMTPS id 4A88A38515D6 for ; Thu, 24 Jun 2021 18:23:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A88A38515D6 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 144AD341644; Thu, 24 Jun 2021 18:23:32 +0000 (UTC) Received: from pdx1-sub0-mail-a66.g.dreamhost.com (100-96-18-93.trex.outbound.svc.cluster.local [100.96.18.93]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 74597341879; Thu, 24 Jun 2021 18:23:31 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a66.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.18.93 (trex/6.3.3); Thu, 24 Jun 2021 18:23:32 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Ski-Continue: 487094022bf09f85_1624559011871_789005300 X-MC-Loop-Signature: 1624559011871:4036068020 X-MC-Ingress-Time: 1624559011871 Received: from pdx1-sub0-mail-a66.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a66.g.dreamhost.com (Postfix) with ESMTP id 33A2A8DD5C; Thu, 24 Jun 2021 11:23:31 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a66.g.dreamhost.com (Postfix) with ESMTPSA id 4A3B08CE56; Thu, 24 Jun 2021 11:23:27 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a66 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: dj@redhat.com, carlos@redhat.com, fweimer@redhat.com Subject: [PATCH 0/8] Remove malloc hooks Date: Thu, 24 Jun 2021 23:53:04 +0530 Message-Id: <20210624182312.236596-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3487.1 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2021 18:23:35 -0000 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. 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. This patchset depends on the mcheck testing infrastructure I've proposed to expand coverage of tests: https://sourceware.org/pipermail/libc-alpha/2021-June/127861.html Siddhesh Poyarekar (8): 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 | 14 + include/malloc.h | 11 +- include/stdlib.h | 3 - malloc/Makefile | 19 +- malloc/Versions | 3 + malloc/arena.c | 26 +- malloc/hooks.c | 542 +++++++----------- malloc/malloc-check.c | 376 ++++++++++++ malloc/malloc-compathooks.c | 166 ++++++ malloc/malloc-internal.h | 6 + malloc/malloc.c | 233 ++++---- 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 | 233 +------- 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 + 53 files changed, 1526 insertions(+), 1305 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 --=20 2.31.1