Invalid read in mpz_powm_ui

Sylvain Pion pion.sylvain at gmail.com
Fri Dec 7 08:55:23 CET 2012


2012/12/6 Emmanuel Thomé <emmanuel.thome at gmail.com>:
> My experience is that the valgrind developers are doing a very good
> job at supporting a fair share of the instructions which show up, but
> they can't always be exhaustive. If we, as users of gmp for instance,
> are impacted by some missing instructions, a nice thing to do is to
> provide the fix by ourselves. Especially if a single instruction is
> concerned (for a whole range of instruction encodings, it's a
> different issue). For example, I recall having helped in to get rclq
> supported on amd64, long ago. That was specifically for using gmp
> (Pierrick's asm patches, by then). Same for pclmulqdq, more recently
> (not gmp-related).

I have also faced the same problem with FPU rounding mode changes
instructions, as typically used by interval arithmetic.

In case you are not aware, I think the good news here is that
compilers (GCC and LLVM) are adding an equivalent feature named
AddressSanitizer.  It does not work by emulating the full CPU
instruction set, but by inserting instrumentation code only for memory
accesses, so it does not have the problem we are discussing, and it
also does not slow programs as much.  I have not tested it yet,
though.

Sylvain


More information about the gmp-bugs mailing list