Re: [PATCH] mcheck.3, mtrace.3: update examples for glibc 2.34

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 24/10/23 12:32, Alejandro Colomar wrote:
> 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?

The libc mcheck and mcheck_pedantic now return -1, while mprobe returns
MCHECK_DISABLED.  All the implementation that used to live in libc.so
were moved to libc_malloc_debug.so.

> 
> 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?

There is no deprecation because the functionality is still fully supported,
albeit in a different library. Setting to deprecated would require to move
the prototypes to a different header.

> 
> Should we document the need for LD_PRELOAD in the LIBRARY section?

Yes, I think it would be better.

> 
> 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@xxxxxxxxxx>
>> ---
>>  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
>>
> 



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux