From owner-svn-src-all@freebsd.org Mon Jun 10 14:27:17 2019 Return-Path: Delivered-To: svn-src-all@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 6BBC115C09D8 for ; Mon, 10 Jun 2019 14:27:17 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04EE9759AA for ; Mon, 10 Jun 2019 14:27:17 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x841.google.com with SMTP id 33so2614379qtr.8 for ; Mon, 10 Jun 2019 07:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kVRUUM0Nz5KP6DmeStNXbEz7R8CCtid8iDOCIJ+JkUQ=; b=KcKaeRUfgHYhkLbdUTRF4k0EcefX4P2mpjo0KfaWmFwt1z3CCbI9SKKh6eozN0EPzO lgVse1mJb2/ez9ulCm89jCb9cvtsrFTKEF2RAhMI20LOqxpotaBaego0f8T4aw9eAcBm ohgyGbxn/i3hcCmyCnG0cek/SSadqmiW5jptffn3WdTI8MOifr5/uMqQQhylnF/G8YKl e5bZbbS7iuarAw9Abo1ROYEAANKqUymC4eGRhPQKWKpiyjED/UR0uAf7hNqQasM0YWH8 kgKoesV2xtT1mv3ZyCO/2rwSwrR3+KZV5WU6StEP0LhSqyDl9lOdpSzfRTx0zPiCJ5+v 9H0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kVRUUM0Nz5KP6DmeStNXbEz7R8CCtid8iDOCIJ+JkUQ=; b=dHRRFwL9AKX/ZP+VdvjfESfwfAR0G/c3tLunTMFqwd7qvLzQMktg0OnwWnMzDozkik Nkte3lJOg6ukB1j4GBOIY35FmudG/2UXycymBw0O4YPMVReqkFTu228abIhexQAiECvd rBT2F9HDHXXiKhKy103RZFrY48wzkQ7Vv3U4/AK7fe81QqIa0IRxRUH7Jbz4St/e2QoS 6fI4YRMG0g5zyBqdyEit+27QKZt674gAOdGasX68LzR3bMUxxE8zdgk522jNi9M8dReG ZG1PQCH+1gI6iL8/lGUOodoFFw8oZSG8736NbTIoWfvDkjxkHfaO2H67b+SQnFwcbMXQ jYyA== X-Gm-Message-State: APjAAAVNoKArjvfbMzaiW34u1Ez4hwnZa9ST8nvTDleEwHGSU/Rnjt2s yPIU8tWPTlHSkHoqXBfC7mUAGg== X-Google-Smtp-Source: APXvYqzJlyZKUbfvbzXUn7gtsxLddpJt9AvvI4+KmT5+gZdQ6+U6Qg7X2DsOMtxHGOB6GzZ9WJLVEw== X-Received: by 2002:ac8:96e:: with SMTP id z43mr59126687qth.55.1560176836328; Mon, 10 Jun 2019 07:27:16 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id p37sm6449996qtc.35.2019.06.10.07.27.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 07:27:15 -0700 (PDT) Date: Mon, 10 Jun 2019 10:27:15 -0400 From: Shawn Webb To: Doug Moore Cc: 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: <20190610142715.be254wljfrnetuom@mutt-hbsd> References: <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qtmrtafjtenr6vop" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD HARDENEDBSD-13-CURRENT amd64 X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 04EE9759AA X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 14:27:17 -0000 --qtmrtafjtenr6vop Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sounds good! I think the manpage still might still need a change to match the current behavior, or perhaps matching something similar to that vm_mmap.c comment. But that comment brings another question: what's the definition of "old binaries"? a.out? 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 On Mon, Jun 10, 2019 at 09:19:55AM -0500, Doug Moore wrote: > This comment appears in vm_mmap.c: >=20 > ???? * Mapping of length 0 is only allowed for old binaries. >=20 > and my intent was to say, to whoever wrote that comment, that I was not > disallowing the mapping of length zero with this change.? I was only > intending to affect a case in which the length was transformed to zero, > and which was the problem that Peter Holm reported. >=20 > Doug Moore >=20 > On 6/10/19 8:00 AM, 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 > >> > >> 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 > >> > >> Modified: > >> head/sys/vm/vm_mmap.c > >> > >> 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, siz= e_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); > > The mmap(2) manpage says that len=3D=3D0 results in EINVAL, so the manp= age > > needs updating. > > > > I'm curious what "there are times" refers to. Can you or the original > > reporter elaborate those cases? > > > > Thanks a lot! > > --qtmrtafjtenr6vop Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAlz+aL4ACgkQ/y5nonf4 4fp98A//SC8qaENnvUk/upV7gKz/oMYmqXIhvHXZMJgiXymtdRZKRW7RMVQrRYmb gbtl9uNLSbLKI88LILJ/0YjXxRieT2e+UaNHkwzitco+fkeUr9LhbqVOuGxPOpWs J9ckPPtZjvVpUXAjt43LC4s2OlM0zs1mpcq/e7Xw7bYHrUO0c6dPGhgCQGvxdWD1 EYnOsNF2n7Us+rpviVTeQVWyESXEkRGhNLKu9/OwVFiUUHGM6vvL5K7A8OEpaU62 8uabKumD3ZnrTJspAXWOBF31EzzzP41wR+yWekdlvdkS5gutBj0XNQ/XBhLQmIBe JCtjKRLHdXAWqfF3kGQs8xCYjlSiF677dDVSrC29lTO98oXcC0Q5HWPkuOxqPQCR ySjfst/6L+R/CnTwFlQpHfaMY5oPJ/qqlDhzvtKmAa/jnoe1Qszc6mRU8hRXmqdn rC4Bk9PnUjxpAu172zJNNP0T6pBi+3bZSbjU6GhPGnifxOy8RV7EEp8ktJ79WJZA cb+SCPGDTjnBElI/kYK54sJy0/t2radwsc/7DxOJiuE7fO/Pu9MkiwoKWFjs4OZw VVZgoFOxXEvb8nWkddEyBGWhYPjU4TgWMv9MBCKHlA+5fNQcXtBroYpg/AcxAUCA I0ZYpeMrqb9fC3XLPtkZMFFUqbQYT6tpT4PQX6KYWYHWTsDoS8g= =Tqvi -----END PGP SIGNATURE----- --qtmrtafjtenr6vop--