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

--- Comment #3 from Martin Cermak <[email protected]> ---
Created attachment 197179
  --> https://bugs.kde.org/attachment.cgi?id=197179&action=edit
proposed patch

The LTP update was accepted and merged, great.  But there still is a problem
that mremap03 behaves differently with vs. without Valgrind.  I'm attaching a
proposed patch that fixes this on the Valgrind side.

The LTP  mremap03 essentially creates 1page VMA via tst_get_bad_addr().  Later
on it calls mremap(bad_addr, memsize, ...) where memsize is 1000 times larger
than that.  That's an invalid request, which in the kernel seems to be handled
in linux/mm/mremap.c:1850:

1836         /*
1837          * We can't remap across the end of VMAs, as another VMA may be
1838          * adjacent:
1839          *
1840          *       addr   vma->vm_end
1841          *  |-----.----------|
1842          *  |     .          |
1843          *  |-----.----------|
1844          *        .<--------->xxx>
1845          *            old_len
1846          *
1847          * We also require that vma->vm_start <= addr < vma->vm_end.
1848          */
1849         if (old_len > vma->vm_end - addr)
1850                 return -EFAULT; 

This also matches what the testcase expects (EFAULT).  Testing the attached
patch now...

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

Reply via email to