From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KjSAY-0006oz-I9 for qemu-devel@nongnu.org; Sat, 27 Sep 2008 01:16:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KjSAV-0006on-UK for qemu-devel@nongnu.org; Sat, 27 Sep 2008 01:16:37 -0400 Received: from [199.232.76.173] (port=46218 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KjSAV-0006ok-JU for qemu-devel@nongnu.org; Sat, 27 Sep 2008 01:16:35 -0400 Received: from ug-out-1314.google.com ([66.249.92.174]:19935) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KjSAV-0001k4-KD for qemu-devel@nongnu.org; Sat, 27 Sep 2008 01:16:35 -0400 Received: by ug-out-1314.google.com with SMTP id j3so44567ugf.36 for ; Fri, 26 Sep 2008 22:16:33 -0700 (PDT) Date: Sat, 27 Sep 2008 08:17:29 +0300 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] linux-user mremap() Message-ID: <20080927051727.GA31531@localhost.localdomain> References: <20080926142222.U24737@stanley.csl.cornell.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline In-Reply-To: <20080926142222.U24737@stanley.csl.cornell.edu> 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 --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2008 at 02:24:43PM -0400, Vince Weaver wrote: >=20 > Until the linux-user mremap() problem is fixed (the one where a 64-bit=20 > value can be returned even on a 32-bit target), might it make sense to=20 > apply a patch like this? >=20 > This will at least let users know what the problem is, instead of just=20 > segfaulting. >=20 > Vince If host is x86_64, use MAP_32BIT. >=20 >=20 >=20 >=20 > Index: mmap.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 > --- mmap.c (revision 5321) > +++ mmap.c (working copy) > @@ -538,6 +538,13 @@ > mmap_lock(); > /* XXX: use 5 args syscall */ > host_addr =3D (long)mremap(g2h(old_addr), old_size, new_size, flags= ); > +#if TARGET_ABI_BITS =3D=3D 32 > + if (host_addr > 0xffffffff) { > + printf("ERROR! mremap() returned 64-bit value on 32-bit target!\= n\n"); > + exit(-1);=20 > + } > +#endif=20 > + > if (host_addr =3D=3D -1) { > new_addr =3D -1; > } else { >=20 >=20 --=20 Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/ --SUOF0GtieIMvvwua 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) iEYEARECAAYFAkjdwecACgkQbWYnhzC5v6qtiwCeIS8RbcU3bV88aV0enXN/PzO8 RzAAn15cG79ibQrJSx2Ty3IIN5N2bWfv =58HI -----END PGP SIGNATURE----- --SUOF0GtieIMvvwua--