From: Alejandro Colomar <alx@kernel.org>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: linux-man@vger.kernel.org, GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] mcheck.3, mtrace.3: update examples for glibc 2.34
Date: Tue, 24 Oct 2023 17:32:30 +0200 [thread overview]
Message-ID: <ZTfjnCHDc_meBr4S@debian> (raw)
In-Reply-To: <20231024143144.76490-1-vincent@vinc17.net>
[-- Attachment #1: Type: text/plain, Size: 1974 bytes --]
Hi Vincent,
On Tue, Oct 24, 2023 at 04:31:17PM +0200, Vincent Lefevre wrote:
> The glibc 2.34 NEWS file says that mtrace() and mcheck() have now been
> disabled in the main C library, and preloading libc_malloc_debug.so is
Can you please clarify "disabled"? What is the behavior if that library
is not preloaded? My attempt to run this program is that mcheck(3)
returns -1. So, the preload interposes the dummy function that only
returns -1 with an actual mcheck(3) implementation?
Are these functions deprecated by glibc? If so, we should probably use
[[deprecated]] in the SYNOPSIS. Or did they just move the functionality
for other reasons but without deprecating?
Should we document the need for LD_PRELOAD in the LIBRARY section?
Thanks,
Alex
> needed to get this functionality back.
>
> So the examples now need a "LD_PRELOAD=libc_malloc_debug.so".
>
> Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
> ---
> man3/mcheck.3 | 2 +-
> man3/mtrace.3 | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/man3/mcheck.3 b/man3/mcheck.3
> index 285ea946c..e17650a4c 100644
> --- a/man3/mcheck.3
> +++ b/man3/mcheck.3
> @@ -169,7 +169,7 @@ when running the program:
> .PP
> .in +4n
> .EX
> -.RB "$" " ./a.out"
> +.RB "$ " "LD_PRELOAD=libc_malloc_debug.so ./a.out"
> About to free
> \&
> About to free a second time
> diff --git a/man3/mtrace.3 b/man3/mtrace.3
> index f30511cd0..d0cde42c9 100644
> --- a/man3/mtrace.3
> +++ b/man3/mtrace.3
> @@ -153,7 +153,7 @@ diagnosed memory leaks at two different locations in the program:
> .EX
> .RB "$ " "cc \-g t_mtrace.c \-o t_mtrace"
> .RB "$ " "export MALLOC_TRACE=/tmp/t"
> -.RB "$ " "./t_mtrace"
> +.RB "$ " "LD_PRELOAD=libc_malloc_debug.so ./t_mtrace"
> .RB "$ " "mtrace ./t_mtrace $MALLOC_TRACE"
> Memory not freed:
> -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
> --
> 2.42.0
>
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-10-24 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 14:31 [PATCH] mcheck.3, mtrace.3: update examples for glibc 2.34 Vincent Lefevre
2023-10-24 15:32 ` Alejandro Colomar [this message]
2023-10-24 16:28 ` Adhemerval Zanella Netto
2023-10-24 18:44 ` Alejandro Colomar
2023-10-24 19:28 ` DJ Delorie
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZTfjnCHDc_meBr4S@debian \
--to=alx@kernel.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=vincent@vinc17.net \
/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