|
From: <sv...@va...> - 2007-01-09 20:40:51
|
Author: sewardj
Date: 2007-01-09 20:40:44 +0000 (Tue, 09 Jan 2007)
New Revision: 6497
Log:
Merge r6495 (handle hinted client mmaps more robustly)
Modified:
branches/VALGRIND_3_2_BRANCH/coregrind/m_syswrap/syswrap-generic.c
Modified: branches/VALGRIND_3_2_BRANCH/coregrind/m_syswrap/syswrap-generi=
c.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/VALGRIND_3_2_BRANCH/coregrind/m_syswrap/syswrap-generic.c 20=
07-01-09 17:09:59 UTC (rev 6496)
+++ branches/VALGRIND_3_2_BRANCH/coregrind/m_syswrap/syswrap-generic.c 20=
07-01-09 20:40:44 UTC (rev 6497)
@@ -1887,6 +1887,25 @@
arg4 | VKI_MAP_FIXED,
arg5, arg6);
=20
+ /* A refinement: it may be that the kernel refused aspacem's choice
+ of address. If we were originally asked for a hinted mapping,
+ there is still a last chance: try again at any address.
+ Hence: */
+ if (mreq.rkind =3D=3D MHint && sres.isError) {
+ mreq.start =3D 0;
+ mreq.len =3D arg2;
+ mreq.rkind =3D MAny;
+ advised =3D VG_(am_get_advisory)( &mreq, True/*client*/, &mreq_ok =
);
+ if (!mreq_ok) {
+ /* Our request was bounced, so we'd better fail. */
+ return VG_(mk_SysRes_Error)( VKI_EINVAL );
+ }
+ /* and try again with the kernel */
+ sres =3D VG_(am_do_mmap_NO_NOTIFY)(advised, arg2, arg3,
+ arg4 | VKI_MAP_FIXED,
+ arg5, arg6);
+ }
+
if (!sres.isError) {
/* Notify aspacem and the tool. */
ML_(notify_aspacem_and_tool_of_mmap)(=20
|