|
From: <sv...@va...> - 2006-06-21 08:01:23
|
Author: tom
Date: 2006-06-21 09:01:14 +0100 (Wed, 21 Jun 2006)
New Revision: 5974
Log:
Fix boundary case when trying to use brk() to expand right up to the
limit of the brk segment.
Because VG_(brk_limit) is the first address beyond the end of the
memory available to the caller of brk() we need to allow it to grow
up to and including the address one page below the end of the space
valgrind has reserved.
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-generic.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
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2006-06-16 21:39:08 UTC (=
rev 5973)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2006-06-21 08:01:14 UTC (=
rev 5974)
@@ -989,14 +989,14 @@
return newbrk;
}
=20
- if (newbrk >=3D rseg->end+1 - VKI_PAGE_SIZE) {
+ if (newbrk > rseg->end+1 - VKI_PAGE_SIZE) {
/* request is too large -- the resvn would fall below 1 page,
which isn't allowed. */
goto bad;
}
=20
newbrkP =3D VG_PGROUNDUP(newbrk);
- vg_assert(newbrkP > rseg->start && newbrkP < rseg->end+1 - VKI_PAGE_S=
IZE);
+ vg_assert(newbrkP > rseg->start && newbrkP <=3D rseg->end+1 - VKI_PAG=
E_SIZE);
delta =3D newbrkP - rseg->start;
vg_assert(delta > 0);
vg_assert(VG_IS_PAGE_ALIGNED(delta));
|