From: Mark Wielaard Date: Tue, 7 Jul 2015 13:01:40 +0000 (+0000) Subject: 349941 di_notify_mmap might create wrong start/size DebugInfoMapping X-Git-Tag: svn/VALGRIND_3_11_0~247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c814eb6b3551e6fc8b2c9d569f745e62432f57bc;p=thirdparty%2Fvalgrind.git 349941 di_notify_mmap might create wrong start/size DebugInfoMapping Use seg->start instead of a as DebugInfoMapping avma. Normally seg->start equals a. But when it is not then the size of the map might extend beyond the segment (and not actually cover the start of the segment). When another ELF file is them mapped right after this then it triggers an overlap purge of the DebugInfo. In the case the mapping was for libc or ld.so this then removes all intercepts causing "bad things". git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15398 --- diff --git a/NEWS b/NEWS index 48fe21c82a..035de411e0 100644 --- a/NEWS +++ b/NEWS @@ -250,6 +250,7 @@ where XXXXXX is the bug number as listed below. 349626 Implemented additional Xen hypercalls 349874 Fix typos in source code 349828 memcpy intercepts memmove causing src/dst overlap error (ppc64 ld.so) +349941 di_notify_mmap might create wrong start/size DebugInfoMapping n-i-bz Provide implementations of certain compiler builtins to support compilers who may not provide those n-i-bz Old STABS code is still being compiled, but never used. Remove it. diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 8f2178e204..b69c1c8129 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1038,7 +1038,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) /* Note the details about the mapping. */ DebugInfoMapping map; - map.avma = a; + map.avma = seg->start; map.size = seg->end + 1 - seg->start; map.foff = seg->offset; map.rx = is_rx_map;