Re: svn commit: r348843 - head/sys/vm

2019-06-12 Thread Brooks Davis
On Mon, Jun 10, 2019 at 09:00:34AM -0400, Shawn Webb wrote: > On Mon, Jun 10, 2019 at 03:07:11AM +, 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

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Shawn Webb
On Tue, Jun 11, 2019 at 01:33:23AM +1000, Bruce Evans wrote: > On Mon, 10 Jun 2019, Shawn Webb wrote: > > > On Mon, Jun 10, 2019 at 03:07:11AM +, Doug Moore wrote: > > > ... > > > Log: > > > There are times when a len==0 parameter to mmap is okay. But on a > > > 32-bit machine, a len param

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Bruce Evans
On Mon, 10 Jun 2019, Shawn Webb wrote: On Mon, Jun 10, 2019 at 03:07:11AM +, Doug Moore wrote: ... 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,

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Doug Moore
The comment and the code that rejects size==0, or doesn't, are copied below.  Konstantin Belousov is the last person to have touched most of it, and can better explain its meaning than I. Doug Moore     /*      * Enforce the constraints.      * Mapping of length 0 is only allowed for old binaries

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Shawn Webb
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, -- Shawn Webb Cofounder / Security En

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Doug Moore
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 transform

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Shawn Webb
On Mon, Jun 10, 2019 at 03:07:11AM +, 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 param

Re: svn commit: r348843 - head/sys/vm

2019-06-10 Thread Andriy Gapon
On 10/06/2019 09:42, Doug Moore wrote: > -fwrapv concerns signed arithmetic.  This calculation is with unsigned > arithmetic, and the possibility of wrapping around to 0 is part of the > language. Oh, sorry for the noise! > On 6/10/19 1:35 AM, Andriy Gapon wrote: >> On 10/06/2019 06:07, Doug Moor

Re: svn commit: r348843 - head/sys/vm

2019-06-09 Thread Bruce Evans
On Mon, 10 Jun 2019, Doug Moore wrote: 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. Some overflows still oc

Re: svn commit: r348843 - head/sys/vm

2019-06-09 Thread Doug Moore
-fwrapv concerns signed arithmetic.  This calculation is with unsigned arithmetic, and the possibility of wrapping around to 0 is part of the language. Doug Moore On 6/10/19 1:35 AM, Andriy Gapon wrote: > On 10/06/2019 06:07, Doug Moore wrote: >> Author: dougm >> Date: Mon Jun 10 03:07:10 2019 >>

Re: svn commit: r348843 - head/sys/vm

2019-06-09 Thread Andriy Gapon
On 10/06/2019 06:07, 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

Re: svn commit: r348843 - head/sys/vm

2019-06-09 Thread Doug Moore
I understand that I ought to have included this in the previous checkin. MFC after: 3 days and that my description of the appropriateness of len==0 passed to mmap was imprecise.  I regret the error. Doug Moore On 6/9/19 10:07 PM, Doug Moore wrote: > Author: dougm > Date: Mon Jun 10 03:07:10 201

svn commit: r348843 - head/sys/vm

2019-06-09 Thread Doug Moore
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 hitti