https://bugs.kde.org/show_bug.cgi?id=470244

--- Comment #9 from Tom Hughes <t...@compton.nu> ---
Actually I can see the problem there - the following segment is an SkResvn not
SkFree.

Now VG_(am_get_advisory_client_simple) will allow a reservation to be used so
will accept the request, but VG_(am_covered_by_single_free_segment) will then
reject it as it only allows a free segment. If we got past that then
VG_(am_extend_map_client) would assert for the same reason...

I'm not really sure about the difference between the two but my reading is that
reservations are unused they're just in the top part of memory. I think the
idea is to discourage allocations there so that valgrind can use it for shadow
memory but still allow it if the caller insists by asking for a fixed address.

Try this patch and see if it helps:

--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -2213,7 +2213,7 @@ static NSegment const * VG_(am_find_free_nsegment) ( Addr
a )
    aspacem_assert(i >= 0 && i < nsegments_used);
    aspacem_assert(nsegments[i].start <= a);
    aspacem_assert(a <= nsegments[i].end);
-   if (nsegments[i].kind == SkFree) 
+   if (nsegments[i].kind == SkFree || nsegments[i].kind == SkResvn)
       return &nsegments[i];
    else
       return NULL;
@@ -3203,7 +3203,7 @@ const NSegment *VG_(am_extend_map_client)( Addr addr,
SizeT delta )
    /* The segment following the client segment must be a free segment and
       it must be large enough to cover the additional memory. */
    NSegment *segf = seg + 1;
-   aspacem_assert(segf->kind == SkFree);
+   aspacem_assert(segf->kind == SkFree || segf->kind == SkResvn);
    aspacem_assert(segf->start == xStart);

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to