valgrind and gmp

Niels Möller nisse at lysator.liu.se
Sat Feb 10 17:23:04 UTC 2018


Hi,

I just tried running some gmp tests under valgrind (or in my case,
mini-gmp tests, using EMULATOR=valgrind make check-mini-gmp). Using the
valgrind version in debian stable, 1:3.12.0~svn20160714-1+b1, it reports
that it doesn't understand some of the x86_64 instructions used in gmp
(possibly mulx and friends?), and crashes the process. The same problem
seems to break the oss-fuzzer tests of gnutls run by the google/chrome
people.

I tried upgrading to the debian testing version of valgrind, 1:3.13.0-2.
That doesn't complain about unknown instructions, but causes some
miscomputation. E.g.,

  ~/build/gmp/mini-gmp/tests/t-mul

succeeds when run normally, but running under valgrind fails like

==25470== Memcheck, a memory error detector
==25470== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25470== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==25470== Command: /home/nisse/build/gmp/mini-gmp/tests/t-mul
==25470== 
mpz_mul failed:
a: -ffffffffffffffffffffff00000007ffffffffffffff00000000000000fffffffffffffffffffff
b: 1fffffffffffffffffffffffffffffffffffffffe00007ffffffff
r: -1fffffffffffffffffffffe0000000ffffffffffdfffe7ffffffff000020001ffff7ff000040fffdfff81ffff800000000e00007ffffffff00000001ffff800000001
ref: -1ffffeffffffffffffffffe0000100fffff7ffffffffe00001000000001ffffefffffffffffffffe0000100000000000000010000000000000001001ffff800000001
==25470== 
==25470== Process terminating with default action of signal 6 (SIGABRT): dumping core
==25470==    at 0x516EFCF: raise (raise.c:51)
==25470==    by 0x51703F9: abort (abort.c:89)
==25470==    by 0x109BB8: testmain (t-mul.c:75)
==25470==    by 0x109793: main (testutils.c:122)

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list