Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2019 21:09:30 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        Shawn Webb <shawn.webb@hardenedbsd.org>
Cc:        Doug Moore <dougm@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, pho@freebsd.org
Subject:   Re: svn commit: r348843 - head/sys/vm
Message-ID:  <20190612210930.GK64641@spindle.one-eyed-alien.net>
In-Reply-To: <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd>
References:  <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd>

next in thread | previous in thread | raw e-mail | index | archive | help

--mhOzvPhkurUs4vA9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 10, 2019 at 09:00:34AM -0400, Shawn Webb wrote:
> On Mon, Jun 10, 2019 at 03:07:11AM +0000, Doug Moore wrote:
> > Author: dougm
> > Date: Mon Jun 10 03:07:10 2019
> > New Revision: 348843
> > URL: https://svnweb.freebsd.org/changeset/base/348843
> >=20
> > Log:
> >   There are times when a len=3D=3D0 parameter to mmap is okay. But on a
> >   32-bit machine, a len parameter just a few bytes short of 4G, rounded
> >   up to a page boundary and hitting zero then, is not okay. Return
> >   failure in that case.
> >  =20
> >   Reported by: pho
> >   Reviewed by: alc, kib (mentor)
> >   Tested by: pho
> >   Differential Revision: https://reviews.freebsd.org/D20580
> >=20
> > Modified:
> >   head/sys/vm/vm_mmap.c
> >=20
> > Modified: head/sys/vm/vm_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=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/sys/vm/vm_mmap.c	Sun Jun  9 22:55:21 2019	(r348842)
> > +++ head/sys/vm/vm_mmap.c	Mon Jun 10 03:07:10 2019	(r348843)
> > @@ -257,7 +257,10 @@ kern_mmap(struct thread *td, uintptr_t addr0, size=
_t s
> > =20
> >  	/* Adjust size for rounding (on both ends). */
> >  	size +=3D pageoff;			/* low end... */
> > -	size =3D (vm_size_t) round_page(size);	/* hi end */
> > +	/* Check for rounding up to zero. */
> > +	if (round_page(size) < size)
> > +		return (EINVAL);
>=20
> The mmap(2) manpage says that len=3D=3D0 results in EINVAL, so the manpage
> needs updating.

The manpage is correct for ABIs people are actually writing code for
(ELF).  I suppose it could document the exception for a.out (see the
conditional containing SV_CURPROC_FLAG(SV_AOUT) in kern_mmap()), but it
should be in BUGS, HISTORY, or some such.

-- Brooks

--mhOzvPhkurUs4vA9
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJdAWoKAAoJEKzQXbSebgfAd5wIAJ8q1Nv3uNJSB2JZkCfk8rSr
7D8CpRyHqrzP1+ew7QrW8r53gqExbnwki01IloB9v27TuCmTALmDMpQFQalAHXsi
yrFlO/YuyhMW+Zfnrv6ym6PoYV6KzyoHN7W2r30ObKkJG4mqfjU6PWrKp8A1eIoh
VJYzlcbcXWooDTG5l1MIAeEVaxziUN61+WtXBsj5mBQd3ionbpJP9kMZxoMCbbqb
0iI+YJUETCLIF/BS6EcnIOJpVTChobJ5hk1LIOqRfU/I4uo+d1ThRbX+pYJy/TkS
03X5pcxKd5f6MPxvPZp2N2RB5rWizWj/HHzgLMoEyg1J34TR0/d5GmQk7h9DLaU=
=kkOR
-----END PGP SIGNATURE-----

--mhOzvPhkurUs4vA9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190612210930.GK64641>