From owner-svn-src-head@freebsd.org Wed Jun 12 21:09:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC4ED15C1DCF; Wed, 12 Jun 2019 21:09:33 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65E468D8CC; Wed, 12 Jun 2019 21:09:32 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id C646C3C0182; Wed, 12 Jun 2019 21:09:30 +0000 (UTC) Date: Wed, 12 Jun 2019 21:09:30 +0000 From: Brooks Davis To: Shawn Webb Cc: Doug Moore , 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> References: <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mhOzvPhkurUs4vA9" Content-Disposition: inline In-Reply-To: <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 65E468D8CC X-Spamd-Bar: ------- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.33 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: spindle.one-eyed-alien.net]; NEURAL_HAM_SHORT(-0.84)[-0.844,0]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; IP_SCORE(-3.58)[ip: (-9.31), ipnet: 199.48.128.0/22(-4.63), asn: 36236(-3.88), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jun 2019 21:09:34 -0000 --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--