From: Dejan Jevtic Date: Tue, 1 Oct 2013 10:34:54 +0000 (+0000) Subject: mips32: Fix the align problem with mmap. X-Git-Tag: svn/VALGRIND_3_9_0~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5944b58df7fb92a8671fe4c8d60b429ccba8926f;p=thirdparty%2Fvalgrind.git mips32: Fix the align problem with mmap. Valgrind is doing mmap always with MAP_FIXED. On mips32 we need to check arg4. If the arg4 is MAP_SHARED we need to align the address to SHMLBA. If the program tries to do mmap with VKI_FIXED Valgrind doesn't need to align the address to SHMLBA. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13593 --- diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 055306d4bd..d99d06b8d0 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -448,14 +448,15 @@ static SysRes mips_PRE_sys_mmap(ThreadId tid, mreq.rkind = MAny; } - if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & arg4)) { + if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & arg4) + && !(VKI_MAP_FIXED & arg4)) mreq.len = arg2 + VKI_SHMLBA - VKI_PAGE_SIZE; - } /* Enquire ... */ advised = VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok ); - if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & arg4)) + if ((VKI_SHMLBA > VKI_PAGE_SIZE) && (VKI_MAP_SHARED & arg4) + && !(VKI_MAP_FIXED & arg4)) advised = VG_ROUNDUP(advised, VKI_SHMLBA); if (!mreq_ok) {