Bug#1078128: libc6: mtrace() + malloc() do not generate data
Package: libc6
Version: 2.39-6
Severity: normal
When testing the example given in the mtrace(3) man page,
no data are generated:
$ cat t_mtrace.c
#include <mcheck.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
mtrace();
for (unsigned int j = 0; j < 2; j++)
malloc(100); /* Never freed--a memory leak */
calloc(16, 16); /* Never freed--a memory leak */
exit(EXIT_SUCCESS);
}
$ cc -g t_mtrace.c -o t_mtrace
t_mtrace.c: In function ‘main’:
t_mtrace.c:11:5: warning: ignoring return value of ‘malloc’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | malloc(100); /* Never freed--a memory leak */
| ^~~~~~~~~~~
t_mtrace.c:13:3: warning: ignoring return value of ‘calloc’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | calloc(16, 16); /* Never freed--a memory leak */
| ^~~~~~~~~~~~~~
$ export MALLOC_TRACE=/tmp/t
$ ./t_mtrace
$ mtrace ./t_mtrace $MALLOC_TRACE
Cannot open mtrace data file at /bin/mtrace line 152, <locs> line 4.
$ ls $MALLOC_TRACE
ls: cannot access '/tmp/t': No such file or directory
-- System Information:
Debian Release: trixie/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates-debug'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 6.7.12-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libc6 depends on:
ii libgcc-s1 14.2.0-1
Versions of packages libc6 recommends:
ii libidn2-0 2.3.7-2
Versions of packages libc6 suggests:
ii debconf [debconf-2.0] 1.5.87
ii glibc-doc 2.39-6
ii libc-l10n 2.39-6
pn libnss-nis <none>
pn libnss-nisplus <none>
ii locales 2.39-6
-- debconf information:
glibc/disable-screensaver:
glibc/kernel-not-supported:
glibc/restart-services:
glibc/upgrade: true
glibc/kernel-too-old:
glibc/restart-failed:
* libraries/restart-without-asking: true
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Reply to: