Date: Mon, 10 Jun 2019 11:39:14 -0400 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Bruce Evans <brde@optusnet.com.au> 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: <20190610153914.o2n5yjgfu3ubzbbt@mutt-hbsd> In-Reply-To: <20190611010531.A3253@besplex.bde.org> References: <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> <20190611010531.A3253@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--lbusykrf4wkrwufc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 11, 2019 at 01:33:23AM +1000, Bruce Evans wrote: > On Mon, 10 Jun 2019, Shawn Webb wrote: >=20 > > On Mon, Jun 10, 2019 at 03:07:11AM +0000, Doug Moore wrote: > > > ... > > > 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, round= ed > > > up to a page boundary and hitting zero then, is not okay. Return > > > failure in that case. > > > ... > > > /* 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 manp= age > > needs updating. >=20 > The man page doesn't say that only len =3D=3D 0 results in EINVAL, so it = is > not incorrect. https://github.com/freebsd/freebsd/blob/master/lib/libc/sys/mmap.2#L451-L455 Tons of error conditions listed, one of which is len=3D=3D0. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --lbusykrf4wkrwufc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAlz+eZ0ACgkQ/y5nonf4 4foGeg//ZvKETORITTUsmr6yvKYO8iaX5VhaH+XVcfGBdNtOUzrTSV7SkkSQHhAc 5GwH9QEjjWC2+auZjzMuaDMhXGsvAmCcEleHjUmrEDJOeshobVAUkAv8knAyCsRR NtBF55dBnI+xceCXZ3X24OUdDPlyod29cDHdcE/oQhogYspegk/IGHJfqNARH7qj 8NlOa0ZvjkpaKxn7PAXecZDqt9Yi6A8bh1pOxdJ1IloVx3KeI7Bb9LaLueS8Vmmj YPh5FYiLyJ53BReYySZyvYdpSor7GwijVFILND3JT4t4tiD3VuAtxLh1WBgrf4mp rWOPNgNH8Phz1/HnGoGE9fv3SArGqmLW/FRQZXH4T4FhHhyztqjok6yT/5DDNLbf WPYtfAGVf/+01HrYn0Zjr+uqSkJHjpQnTJDqih/hRx91YI0rukmmvJ+ab9+51zJV 3fmdBS3mmKP+5IM98dZGsFRuF0T1SyDAkFDJ+qojd3VZscTVCNcIFdIvNyeg4f+0 e1I0CzZJNpGxyX4wVO7Wp76A8Ju7vmBpxYfWk9ZKb6dZbYtOal/im1mqM0ljn7Oe kfNjI07ZJLxbQ3brtB8Gew30j9GWSl54+ZVoM4xLeu6Sr9l8v51dr0XtzYHcYgO8 /pvfAOm31nY+yEGBeUiFchrMTWhFIXvLgMQxq5l1u90kHfCzWso= =yRer -----END PGP SIGNATURE----- --lbusykrf4wkrwufc--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190610153914.o2n5yjgfu3ubzbbt>