]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Calling VG_(am_relocate_nooverlap_client) will destroy the descriptor
authorTom Hughes <tom@compton.nu>
Mon, 27 Sep 2010 15:08:34 +0000 (15:08 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 27 Sep 2010 15:08:34 +0000 (15:08 +0000)
for the old segment so we need to save the permissions from it before
the call so that we can use them when notifying tools of the new space
afterwards, or we will notify them of the wrong permissions.

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

coregrind/m_syswrap/syswrap-generic.c

index 631a96f2e5bf446a2ddd7b070866189059ef1e65..91e40df7e4418a16dd204426e79ca7448721d4cb 100644 (file)
@@ -427,6 +427,9 @@ SysRes do_mremap( Addr old_addr, SizeT old_len,
    /* that failed.  Look elsewhere. */
    advised = VG_(am_get_advisory_client_simple)( 0, new_len, &ok );
    if (ok) {
+      Bool oldR = old_seg->hasR;
+      Bool oldW = old_seg->hasW;
+      Bool oldX = old_seg->hasX;
       /* assert new area does not overlap old */
       vg_assert(advised+new_len-1 < old_addr 
                 || advised > old_addr+old_len-1);
@@ -437,8 +440,7 @@ SysRes do_mremap( Addr old_addr, SizeT old_len,
                                    MIN_SIZET(old_len,new_len) );
          if (new_len > old_len)
             VG_TRACK( new_mem_mmap, advised+old_len, new_len-old_len,
-                      old_seg->hasR, old_seg->hasW, old_seg->hasX,
-                      0/*di_handle*/ );
+                      oldR, oldW, oldX, 0/*di_handle*/ );
          VG_TRACK(die_mem_munmap, old_addr, old_len);
          if (d) {
             VG_(discard_translations)( old_addr, old_len, "do_remap(4)" );