From owner-svn-src-head@freebsd.org Mon Jun 10 14:19:59 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 49B0E15C0776; Mon, 10 Jun 2019 14:19:59 +0000 (UTC) (envelope-from unkadoug@gmail.com) Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) (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 D808A754E4; Mon, 10 Jun 2019 14:19:58 +0000 (UTC) (envelope-from unkadoug@gmail.com) Received: by mail-oi1-x242.google.com with SMTP id e189so6332250oib.11; Mon, 10 Jun 2019 07:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=7KCGBB0pnkjWRrWFLi5sXN/Z/zEoLBQ5v+E0bTvu05o=; b=bxj+FflYCcVus0PTNDuP658OGW4F1ww2vOYhsWzBrZBITlihypyD4hdWw1MvUakapU 6BLTGI3LtEXA4bJNoMi44q22NHz+gqWVW6sY+aMDzsCPk32GF430ZW4O3MoiDugmbijY 22/tateN6m0P2uLSWsYYWrfBkPtMNMCv/jSaH4d7ABsx4hKgpdoPUEvsPrwR3Ai9jJVx 1IzgcHJwaiyo2gyyTgzi+BHrgBe/fKqNn7R59k/30jgWJNLRrFEyBpBgNWMWHV/znFYc zQ3AV8h/RsUAhOqETXF5b9pMcJc14+kDsCmiGufz/ubrgbmiwUft7VnKL/6e6NXQujCX huGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=7KCGBB0pnkjWRrWFLi5sXN/Z/zEoLBQ5v+E0bTvu05o=; b=Fogg+EYM80OgsyB+3+VKzzEdZ6B0DqyLVYL51qGSxi5BKL3Pby89kpYDePBmtjhmLx eO/tcU7O+iq5cIyeWGlVLH+jqAnYZfUnyfq2WNdCHP581QKjyA9dUqNBtNy8pnaUGAwM BLGH4ASaKvejWVLg2Sqkrf8Xm5el3DW4eQMSLij0U9k3oUeeuSiI4KjjpnQM6lzU9/iZ TFfdwQO3h/DiJJEzIHNTbX83m0I6Av5yVKpHczIfG82wPkauS8hZuijcyj3rBKKhY5Cw 7pKGfnZsRu37lYBGg8o92RdtLXsoSOZaxJFSfJ1N1mN0qJXECn6cnsIIbC9CsUddIxg6 aZqw== X-Gm-Message-State: APjAAAUZAYdneOYlWhzLjp4ngUQbI2V4KoL51ToBPRdYhtiINpRkdwpC xmf7V5ym/RGb8gQrJ0S31j80n8bz4Ks= X-Google-Smtp-Source: APXvYqyHuZJvPPkevy2szU9Xo9vDDy3DDzSxzesCeNtCbXhnRSF2/OQhW88lc/9CnnXKmslSFe8gKw== X-Received: by 2002:aca:ab57:: with SMTP id u84mr12441025oie.61.1560176397654; Mon, 10 Jun 2019 07:19:57 -0700 (PDT) Received: from 108-254-203-202.lightspeed.hstntx.sbcglobal.net (108-254-203-202.lightspeed.hstntx.sbcglobal.net. [108.254.203.202]) by smtp.gmail.com with ESMTPSA id w17sm1351453oia.24.2019.06.10.07.19.56 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 07:19:57 -0700 (PDT) From: Doug Moore X-Google-Original-From: Doug Moore Subject: Re: svn commit: r348843 - head/sys/vm To: Shawn Webb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, pho@freebsd.org References: <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> Message-ID: Date: Mon, 10 Jun 2019 09:19:55 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: D808A754E4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] 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: Mon, 10 Jun 2019 14:19:59 -0000 This comment appears in vm_mmap.c:      * Mapping of length 0 is only allowed for old binaries. 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. Doug Moore 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==0 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. >> >> 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 >> ============================================================================== >> --- 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 >> >> /* Adjust size for rounding (on both ends). */ >> size += pageoff; /* low end... */ >> - size = (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==0 results in EINVAL, so the manpage > needs updating. > > I'm curious what "there are times" refers to. Can you or the original > reporter elaborate those cases? > > Thanks a lot! >