]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fix 290974 vgdb must align pages to VKI_SHMLBA (16KB) on ARM
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 2 Feb 2012 21:33:55 +0000 (21:33 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 2 Feb 2012 21:33:55 +0000 (21:33 +0000)
In VG_(am_mmap_file_float_valgrind_flags),
when VKI_MAP_SHARED & flags, ensure the request length is big enough
to allow to roundup the returned advised to VKI_SHMLBA if needed.

Committed after regtest on f12/x86 and some limited validation on android arm
emulator.

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

NEWS
coregrind/m_aspacemgr/aspacemgr-linux.c

diff --git a/NEWS b/NEWS
index b46679758cceeb7dbb27cc84f9b0341e7279b926..19f892d7407bf77d32a684a79ceccf4c130a1d9e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ where XXXXXX is the bug number as listed below.
 287858  VG_(strerror): unknown error 
 289699  vgdb connection in relay mode erroneously closed due to buffer overrun 
 289939  wish: complete monitor cmd 'leak_check' with details about leaked or reachable blocks
+290974  vgdb must align pages to VKI_SHMLBA (16KB) on ARM 
 
 Release 3.7.0 (5 November 2011)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 8271cb099f5919e9085ea4a0e3afc2abf6fb6956..50b930d1ea81c1d7d09890a72e2375ab92a2a508 100644 (file)
@@ -2532,10 +2532,22 @@ static SysRes VG_(am_mmap_file_float_valgrind_flags) ( SizeT length, UInt prot,
    /* Ask for an advisory.  If it's negative, fail immediately. */
    req.rkind = MAny;
    req.start = 0;
-   req.len   = length;
+   #if defined(VGA_arm)
+   aspacem_assert(VKI_SHMLBA >= VKI_PAGE_SIZE);
+   #else
+   aspacem_assert(VKI_SHMLBA == VKI_PAGE_SIZE);
+   #endif
+   if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & flags)) {
+      /* arm-linux only. See ML_(generic_PRE_sys_shmat) and bug 290974 */
+      req.len = length + VKI_SHMLBA - VKI_PAGE_SIZE;
+   } else {
+      req.len = length;
+   }
    advised = VG_(am_get_advisory)( &req, False/*forClient*/, &ok );
    if (!ok)
       return VG_(mk_SysRes_Error)( VKI_EINVAL );
+   if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & flags))
+      advised = VG_ROUNDUP(advised, VKI_SHMLBA);
 
    /* We have been advised that the mapping is allowable at the
       specified address.  So hand it off to the kernel, and propagate