unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v7 3/8] Move malloc hooks into a compat DSO
Date: Fri, 09 Jul 2021 10:08:39 +0200	[thread overview]
Message-ID: <87czrrkiyg.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210708174325.3243721-4-siddhesh@sourceware.org> (Siddhesh Poyarekar's message of "Thu, 8 Jul 2021 23:13:20 +0530")

* Siddhesh Poyarekar:

> Remove all malloc hook uses from core malloc functions and move it
> into a new library libc_malloc_debug.so.  With this, the hooks now no
> longer have any effect on the core library.
>
> libc_malloc_debug.so is a malloc interposer that needs to be preloaded
> to get hooks functionality back so that the debugging features that
> depend on the hooks, i.e. malloc-check, mcheck and mtrace work again.
> Without the preloaded DSO these debugging features will be nops.
> These features will be ported away from hooks in subsequent patches.
>
> Similarly, legacy applications that need hooks functionality need to
> preload libc_malloc_debug.so.
>
> The symbols exported by libc_malloc_debug.so are maintained at exactly
> the same version as libc.so.
>
> Finally, static binaries will no longer be able to use malloc
> debugging features since they cannot preload the debugging DSO.

Commit subject could be adjusted because the DSO contains more than just
the hooks.

This patch needs to update the shlib-versions file on architectures
which do not use DEFAULT.  For example, on ia64-linux-gnu, there is a
malloc/check-abi-libc_malloc_debug failure that looks like this:

--- ../sysdeps/unix/sysv/linux/ia64/libc_malloc_debug.abilist   2021-07-09 02:20:33.198770372 -0400
+++ /home/bmg/build/glibcs/ia64-linux-gnu/glibc/malloc/libc_malloc_debug.symlist        2021-07-09 02:41:48.575228929 -0400
@@ -0,0 +1,20 @@
+GLIBC_2.0 __free_hook D 0x8
+GLIBC_2.0 __malloc_hook D 0x8
+GLIBC_2.0 __memalign_hook D 0x8
+GLIBC_2.0 __realloc_hook D 0x8
+GLIBC_2.0 calloc F
+GLIBC_2.0 free F
+GLIBC_2.0 mallinfo F
+GLIBC_2.0 malloc F
+GLIBC_2.0 malloc_stats F
+GLIBC_2.0 malloc_trim F
+GLIBC_2.0 malloc_usable_size F
+GLIBC_2.0 mallopt F
+GLIBC_2.0 mcheck F
+GLIBC_2.0 memalign F
+GLIBC_2.0 mprobe F
+GLIBC_2.0 mtrace F
+GLIBC_2.0 muntrace F
+GLIBC_2.0 pvalloc F
+GLIBC_2.0 realloc F
+GLIBC_2.0 valloc F
@@ -3,13 +22,0 @@ GLIBC_2.16 aligned_alloc F
-GLIBC_2.2 __free_hook D 0x8
-GLIBC_2.2 __malloc_hook D 0x8
-GLIBC_2.2 __memalign_hook D 0x8
-GLIBC_2.2 __realloc_hook D 0x8
-GLIBC_2.2 calloc F
-GLIBC_2.2 free F
-GLIBC_2.2 mallinfo F
-GLIBC_2.2 malloc F
-GLIBC_2.2 malloc_stats F
-GLIBC_2.2 malloc_trim F
-GLIBC_2.2 malloc_usable_size F
-GLIBC_2.2 mallopt F
-GLIBC_2.2 mcheck F
@@ -18,4 +24,0 @@ GLIBC_2.2 mcheck_pedantic F
-GLIBC_2.2 memalign F
-GLIBC_2.2 mprobe F
-GLIBC_2.2 mtrace F
-GLIBC_2.2 muntrace F
@@ -23,3 +25,0 @@ GLIBC_2.2 posix_memalign F
-GLIBC_2.2 pvalloc F
-GLIBC_2.2 realloc F
-GLIBC_2.2 valloc F

I expect this to fix ia64-linux-gnu:

diff --git a/sysdeps/unix/sysv/linux/ia64/shlib-versions b/sysdeps/unix/sysv/linux/ia64/shlib-versions
index 37374c0e20..c6d06480a1 100644
--- a/sysdeps/unix/sysv/linux/ia64/shlib-versions
+++ b/sysdeps/unix/sysv/linux/ia64/shlib-versions
@@ -1,4 +1,5 @@
 libc=6.1		GLIBC_2.2
+libc_malloc_debug=0	GLIBC_2.2
 libm=6.1		GLIBC_2.2
 
 ld=ld-linux-ia64.so.2	GLIBC_2.2

The other targets affected by this are:

hppa-linux-gnu
sh3eb-linux-gnu
sh3-linux-gnu
sh4eb-linux-gnu
sh4eb-linux-gnu-soft
sh4-linux-gnu
sh4-linux-gnu-soft
sparc64-linux-gnu
sparc64-linux-gnu-disable-multi-arch

Thanks,
Florian


  reply	other threads:[~2021-07-09  8:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 17:43 [PATCH v7 0/8] malloc hooks removal Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 1/8] Remove __after_morecore_hook Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 2/8] Remove __morecore and __default_morecore Siddhesh Poyarekar via Libc-alpha
2021-07-09  6:27   ` Florian Weimer via Libc-alpha
2021-07-09  7:02     ` Siddhesh Poyarekar via Libc-alpha
2021-07-09  7:46       ` Florian Weimer via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 3/8] Move malloc hooks into a compat DSO Siddhesh Poyarekar via Libc-alpha
2021-07-09  8:08   ` Florian Weimer via Libc-alpha [this message]
2021-07-09  8:13     ` Siddhesh Poyarekar via Libc-alpha
2021-07-09  8:17   ` Florian Weimer via Libc-alpha
2021-07-09  9:17     ` Siddhesh Poyarekar via Libc-alpha
2021-07-09  9:22       ` Florian Weimer via Libc-alpha
2021-07-09  8:26   ` Florian Weimer via Libc-alpha
2021-07-09  9:21     ` Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 4/8] mcheck: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 5/8] Simplify __malloc_initialized Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 6/8] mtrace: Wean away from malloc hooks Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 7/8] glibc.malloc.check: " Siddhesh Poyarekar via Libc-alpha
2021-07-08 17:43 ` [PATCH v7 8/8] Remove " 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=87czrrkiyg.fsf@oldenburg.str.redhat.com \
    --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).