Package: valgrind
Version: 1:3.13.0-2+b1
Followup-For: Bug #903434

Dear Maintainer,

I observe approximately the same behavior with amd64 architecture.

Here is a small sample program written in C:

===========================================

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {

  char *str = malloc (1000);
  str[0] = 'A';
  str[1] = '\0';

  fprintf (stdout, "%s\n", str);

  return 0;
}

===========================================

I compile it with: gcc -Wall -Wextra -m64 -g3 -O0 -o sample sample.c

It should leak some memory, but here is the output I get on my machine:

===========================================

==22199== Memcheck, a memory error detector
==22199== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22199== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22199== Command: ./sample
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CB19D6: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CDDB84: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CDDC57: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0xE: ???
==22199==    by 0x10A003: ??? (in /tmp/sample)
==22199==    by 0x1FFEFFFF5F: ???
==22199==    by 0x1FFEFFFF6F: ???
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CDDC63: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0xE: ???
==22199==    by 0x10A003: ??? (in /tmp/sample)
==22199==    by 0x1FFEFFFF5F: ???
==22199==    by 0x1FFEFFFF6F: ???
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CDF9A3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CDDC78: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0xE: ???
==22199==    by 0x10A003: ??? (in /tmp/sample)
==22199==    by 0x1FFEFFFF5F: ???
==22199==    by 0x1FFEFFFF6F: ???
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CDF9EF: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1729F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CDF8F8: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1B75F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1B75F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Use of uninitialised value of size 8
==22199==    at 0x4CDFA07: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1729F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CDF8F8: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1B75F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4E1B75F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CB2C88: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CB2CA2: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CB18DE: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
A
==22199== Conditional jump or move depends on uninitialised value(s)
==22199==    at 0x4CB1937: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4CB9EA3: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==    by 0x4C85B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==22199==
==22199==
==22199== HEAP SUMMARY:
==22199==     in use at exit: 0 bytes in 0 blocks
==22199==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==22199==
==22199== All heap blocks were freed -- no leaks are possible
==22199==
==22199== For counts of detected and suppressed errors, rerun with: -v
==22199== Use --track-origins=yes to see where uninitialised values come
from
==22199== ERROR SUMMARY: 12 errors from 11 contexts (suppressed: 0 from 0)

===========================================


So, not only the memory leak is ignored but there is a lot of false
positive coming from outer-space.

To be totally complete, I also compiled the exact same program with
'-m32' and I got the following:


===========================================

==22265== Memcheck, a memory error detector
==22265== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22265== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22265== Command: ./sample
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401B921: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401B92E: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401BB0D: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401BB0D: ??? (in /lib32/ld-2.27.so)
==22265==    by 0x4008D85: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401B856: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401BABF: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x401BABF: ??? (in /lib32/ld-2.27.so)
==22265==    by 0x4008D85: ??? (in /lib32/ld-2.27.so)
==22265==
==22265== Conditional jump or move depends on uninitialised value(s)
==22265==    at 0x48FD32F: ??? (in /lib32/libc-2.27.so)
==22265==    by 0x48B5627: ??? (in /lib32/libc-2.27.so)
==22265==    by 0x487D9A0: ??? (in /lib32/libc-2.27.so)
==22265==
A
==22265==
==22265== HEAP SUMMARY:
==22265==     in use at exit: 0 bytes in 0 blocks
==22265==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==22265==
==22265== All heap blocks were freed -- no leaks are possible
==22265==
==22265== For counts of detected and suppressed errors, rerun with: -v
==22265== Use --track-origins=yes to see where uninitialised values come
from
==22265== ERROR SUMMARY: 9 errors from 8 contexts (suppressed: 2 from 2)

===========================================

Then, I tried: valgrind --leak-check=full --track-origins=yes ./sample

===========================================

==22353== Memcheck, a memory error detector
==22353== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==22353== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==22353== Command: ./sample
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401B921: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x4008A96: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401B92E: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x4008A96: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401BB0D: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x400236F: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401BB0D: ??? (in /lib32/ld-2.27.so)
==22353==    by 0x4008D85: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x400236F: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401B856: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x400236F: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401BABF: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x400236F: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x401BABF: ??? (in /lib32/ld-2.27.so)
==22353==    by 0x4008D85: ??? (in /lib32/ld-2.27.so)
==22353==  Uninitialised value was created by a stack allocation
==22353==    at 0x400236F: ??? (in /lib32/ld-2.27.so)
==22353==
==22353== Conditional jump or move depends on uninitialised value(s)
==22353==    at 0x48FD32F: ??? (in /lib32/libc-2.27.so)
==22353==    by 0x48B5627: ??? (in /lib32/libc-2.27.so)
==22353==    by 0x487D9A0: ??? (in /lib32/libc-2.27.so)
==22353==  Uninitialised value was created
==22353==    at 0x4001232: ??? (in /lib32/ld-2.27.so)
==22353==
A
==22353==
==22353== HEAP SUMMARY:
==22353==     in use at exit: 0 bytes in 0 blocks
==22353==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==22353==
==22353== All heap blocks were freed -- no leaks are possible
==22353==
==22353== For counts of detected and suppressed errors, rerun with: -v
==22353== ERROR SUMMARY: 9 errors from 8 contexts (suppressed: 2 from 2)

===========================================

Which tends to say that the problem occurs at stack allocation.

Finally, I also tried the exact same program on a Debian system in
"testing" and it worked like a charm... Note that the minimal example
seems to require a call to malloc().

I would recommend to mark this bug as "Important" as it renders this
package totally useless (memcheck did not detect the memory leak and
warned about a lot of false errors).

I volunteer to run any experiment on my machine if needed, if you cannot
reproduce the problem.

Thanks a lot in advance for your help to solve this out!

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.16.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages valgrind depends on:
ii  libc6      2.27-4
ii  libc6-dbg  2.27-4

Versions of packages valgrind recommends:
ii  gdb           7.12-6+b2
ii  valgrind-dbg  1:3.13.0-2+b1

Versions of packages valgrind suggests:
pn  alleyoop      <none>
pn  kcachegrind   <none>
pn  valgrind-mpi  <none>
pn  valkyrie      <none>

-- no debconf information

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to