]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add assertion that the munmap of the secmap succeeds.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 13 May 2012 22:58:09 +0000 (22:58 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 13 May 2012 22:58:09 +0000 (22:58 +0000)
It is suspected that there is a bug in the call to VG_(am_munmap_valgrind).

At first sight, it looks like a bug in gcc version 4.4.5 (Debian 4.4.5-8)
which seems to pass wrong arguments from mc_main.c to aspace mgr function.
Some tests are failing on gcc20 with this assert a.o.
  ./vg-in-place ./perf/bz2 x
gives an assert.
The bug does not happen if Valgrind is compiled with gcc 4.7.0.

On gcc20, the new tests failing with this assert are:
memcheck/tests/linux/lsframe1            (stderr)
memcheck/tests/linux/lsframe2            (stderr)
memcheck/tests/linux/stack_switch        (stderr)
memcheck/tests/origin5-bz2               (stdout)
memcheck/tests/vcpu_bz2                  (stdout)
memcheck/tests/vcpu_bz2                  (stderr)

The assert is committed so as to see other platforms
where this is failing.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12563

memcheck/mc_main.c

index 44514ee2f780eaaea35305381ffee7a8489e7aba..d481b5f5827679a8668eaac8c7b5f0de4ee1234b 100644 (file)
@@ -1532,7 +1532,8 @@ static void set_address_range_perms ( Addr a, SizeT lenT, UWord vabits16,
          PROF_EVENT(160, "set_address_range_perms-loop64K-free-dist-sm");
          // Free the non-distinguished sec-map that we're replacing.  This
          // case happens moderately often, enough to be worthwhile.
-         VG_(am_munmap_valgrind)((Addr)*sm_ptr, sizeof(SecMap));
+         SysRes sres = VG_(am_munmap_valgrind)((Addr)*sm_ptr, sizeof(SecMap));
+         tl_assert2(! sr_isError(sres), "SecMap valgrind munmap failure\n");
       }
       update_SM_counts(*sm_ptr, example_dsm);
       // Make the sec-map entry point to the example DSM