From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuVvq-0002aN-TY for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:31:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuVvp-0002aB-Ac for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:31:10 -0400 Received: from [199.232.76.173] (port=59569 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuVvp-0002a8-8e for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:31:09 -0400 Received: from ey-out-1920.google.com ([74.125.78.146]:13364) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KuVvo-0006an-Ol for qemu-devel@nongnu.org; Mon, 27 Oct 2008 13:31:09 -0400 Received: by ey-out-1920.google.com with SMTP id 4so837824eyk.4 for ; Mon, 27 Oct 2008 10:31:07 -0700 (PDT) Date: Mon, 27 Oct 2008 19:32:42 +0200 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] [PATCH] mmap: add check if requested memory area fits target address space Message-ID: <20081027173242.GB10763@localhost.localdomain> References: <1223892640-15545-13-git-send-email-kirill@shutemov.name> <1224225264-8483-1-git-send-email-kirill@shutemov.name> <20081027154835.GA10763@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U+BazGySraz5kW0T" Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --U+BazGySraz5kW0T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 27, 2008 at 04:55:07PM +0100, Andreas Schwab wrote: > "Kirill A. Shutemov" writes: >=20 > > On Mon, Oct 27, 2008 at 02:08:52PM +0100, andrzej zaborowski wrote: > >> On 17/10/2008, Kirill A. Shutemov wrote: > >> > Signed-off-by: Kirill A. Shutemov > >> > --- > >> > linux-user/mmap.c | 5 +++++ > >> > 1 files changed, 5 insertions(+), 0 deletions(-) > >> > > >> > diff --git a/linux-user/mmap.c b/linux-user/mmap.c > >> > index bc20f4b..9a2f355 100644 > >> > --- a/linux-user/mmap.c > >> > +++ b/linux-user/mmap.c > >> > @@ -388,6 +388,11 @@ abi_long target_mmap(abi_ulong start, abi_ulon= g len, int prot, > >> > end =3D start + len; > >> > real_end =3D HOST_PAGE_ALIGN(end); > >> > > >> > + if ((unsigned long)start + len > (abi_ulong) -1) { > >> > + errno =3D EINVAL; > >> > + goto fail; > >> > + } > >>=20 > >> I'm being picky but this would prevent the last byte from being used? > >> :p (or the last page because len is aligned?) > > > > No, it returns error if start + len is more than 0xFFFFFFFF (32-bit > > target). >=20 > start + len is one past the last used address. Oops.. You are right. I'll post updated patches soon. --=20 Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/ --U+BazGySraz5kW0T Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkkF+zoACgkQbWYnhzC5v6psAgCfVP5LDFn6E/BswYH6iSEUhm5W eO8AnRwJDhtIHZ6q+QrucsXOlTcSeX9h =8l8t -----END PGP SIGNATURE----- --U+BazGySraz5kW0T--