Hi Adhemerval, On Tue, Oct 24, 2023 at 01:28:06PM -0300, Adhemerval Zanella Netto wrote: > On 24/10/23 12:32, Alejandro Colomar wrote: > > 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. Ok. This should probably be documented. > > > > > 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. Why was it moved to a different library? I guess it wasn't often used, maybe? This should probably go to a HISTORY section. Regarding the move, maybe I'm doing something wrong, but I'd expect the following to work (but it doesn't): $ cc -Wall -Wextra mcheck.c -lc_malloc_debug -lc mcheck.c: In function ‘main’: mcheck.c:21:12: warning: pointer ‘p’ used after ‘free’ [-Wuse-after-free] 21 | free(p); | ^~~~~~~ mcheck.c:19:12: note: call to ‘free’ here 19 | free(p); | ^~~~~~~ $ ./a.out mcheck() failed $ ldd ./a.out linux-vdso.so.1 (0x00007fff048de000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f82fe810000) /lib64/ld-linux-x86-64.so.2 (0x00007f82fea0c000) Do you know why this program isn't linking correctly to libc_malloc_debug? Thanks, Alex > > > > 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 --