Broad valgrind run

Torbjörn Granlund tg at gmplib.org
Tue Jun 9 11:02:42 UTC 2015


tg at gmplib.org (Torbjörn Granlund) writes:

  I tried adding -fsanitize=address to the default options on the system
  ivyubu64v1504 (access via shell.gmplib.org as usually).  A 64-bit build
  passed all tests, but alas, a 32-bit build fails two tests:
  
  make[4]: Entering directory '/var/tmp/gmp-obj/otmp/tests/mpq'
  FAIL: t-get_d
  FAIL: reuse
  
  The complaints are the same.  This is likely a real GMP bug.
  
  ==7100==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xffba2d0c at pc 0xf70202e5 bp 0xffba2c14 sp 0xffba2c04
  WRITE of size 4 at 0xffba2d0c thread T0
      #0 0xf70202e4 in __gmpn_mod_1s_2p_cps (/var/tmp/gmp-obj/otmp/.libs/libgmp.so.10+0xec2e4)
      #1 0xf701f64a in __gmpn_mod_1 (/var/tmp/gmp-obj/otmp/.libs/libgmp.so.10+0xeb64a)
      #2 0xf703e216 in __gmpn_gcd_1 (/var/tmp/gmp-obj/otmp/.libs/libgmp.so.10+0x10a216)

I could see nothing wrong with the write complained about.  But the
gcd_1.asm in question did not align the stack properly, and after having
fixed that the checker is happier.

I have spotted the same ABI adherence error in other x86-32 assembly
files.  This sort of things should be caught by the calling_conventions
stuff of the test suite.  I'll fix that before fixing any other assembly
files.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list