From: Tom Hughes Date: Mon, 27 Sep 2010 15:08:34 +0000 (+0000) Subject: Calling VG_(am_relocate_nooverlap_client) will destroy the descriptor X-Git-Tag: svn/VALGRIND_3_6_0~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00ae2c5c8c2473faddb71ce31282a4cfc2d68a69;p=thirdparty%2Fvalgrind.git Calling VG_(am_relocate_nooverlap_client) will destroy the descriptor 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 --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 631a96f2e5..91e40df7e4 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -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)" );