Bug#925927: libgmp10:amd64: failure with Clang's memory sanitizer: use-of-uninitialized-value

Vincent Lefevre vincent at vinc17.net
Thu Mar 28 17:31:05 GMT 2019


Package: libgmp10
Version: 2:6.1.2+dfsg-4
Severity: important

The following program

#include <gmp.h>

int main (void)
{
  mpz_t z;

  mpz_init (z);
  mpz_set_ui (z, 1);
  mpz_dump (z);
  mpz_clear (z);

  return 0;
}

compiled with: clang-7 -fsanitize=memory -o tst tst.c -lgmp

gives the following error:

cventin:~> ./tst
Uninitialized bytes in __interceptor_puts at offset 1 inside [0x701000000010, 2)
==17647==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fbf03e6fe6a in __gmpz_dump (/usr/lib/x86_64-linux-gnu/libgmp.so.10+0x18e6a)
    #1 0x49518a in main (/home/vlefevre/tst+0x49518a)
    #2 0x7fbf03aeb09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #3 0x41e2b9 in _start (/home/vlefevre/tst+0x41e2b9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/usr/lib/x86_64-linux-gnu/libgmp.so.10+0x18e6a) in __gmpz_dump
Exiting
zsh: exit 77    ./tst

In particular, this failure prevents one from using -fsanitize=memory
with software that uses GMP.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-4-amd64 (SMP w/12 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libgmp10:amd64 depends on:
ii  libc6  2.28-8

libgmp10:amd64 recommends no packages.

libgmp10:amd64 suggests no packages.

-- no debconf information



More information about the debian-science-maintainers mailing list