Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Matthew Wilcox
On Fri, Dec 08, 2017 at 12:13:31PM -0800, Kees Cook wrote: > On Fri, Dec 8, 2017 at 12:33 AM, Michal Hocko wrote: > > OK, this doesn't seem to lead to anywhere. The more this is discussed > > the more names we are getting. So you know what? I will resubmit and > > keep my original name. If somebod

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Florian Weimer
On 12/08/2017 03:27 PM, Pavel Machek wrote: On Fri 2017-12-08 22:08:07, Michael Ellerman wrote: If we had a time machine, the right set of flags would be: - MAP_FIXED: don't treat addr as a hint, fail if addr is not free - MAP_REPLACE: replace an existing mapping (or force or clobber)

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Cyril Hrubis
Hi! > > If we had a time machine, the right set of flags would be: > > > > - MAP_FIXED: don't treat addr as a hint, fail if addr is not free > > - MAP_REPLACE: replace an existing mapping (or force or clobber) > > Actually, if we had a time machine... would we even provide > MAP_REPLACE fun

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Kees Cook
On Fri, Dec 8, 2017 at 12:33 AM, Michal Hocko wrote: > OK, this doesn't seem to lead to anywhere. The more this is discussed > the more names we are getting. So you know what? I will resubmit and > keep my original name. If somebody really hates it then feel free to > nack the patch and push alter

RE: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread David Laight
From: Michael Ellerman > Sent: 08 December 2017 11:08 ... > If we had a time machine, the right set of flags would be: > > - MAP_FIXED: don't treat addr as a hint, fail if addr is not free > - MAP_REPLACE: replace an existing mapping (or force or clobber) > > But the two were conflated for

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Pavel Machek
On Fri 2017-12-08 22:08:07, Michael Ellerman wrote: > Matthew Wilcox writes: > > > On Thu, Dec 07, 2017 at 11:14:27AM -0800, Kees Cook wrote: > >> On Wed, Dec 6, 2017 at 9:46 PM, Michael Ellerman > >> wrote: > >> > Matthew Wilcox writes: > >> >> So, just like we currently say "exactly one of M

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Michael Ellerman
Matthew Wilcox writes: > On Thu, Dec 07, 2017 at 11:14:27AM -0800, Kees Cook wrote: >> On Wed, Dec 6, 2017 at 9:46 PM, Michael Ellerman wrote: >> > Matthew Wilcox writes: >> >> So, just like we currently say "exactly one of MAP_SHARED or MAP_PRIVATE", >> >> we could add a new paragraph saying "

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-08 Thread Michal Hocko
On Thu 07-12-17 11:57:27, Matthew Wilcox wrote: > On Thu, Dec 07, 2017 at 11:14:27AM -0800, Kees Cook wrote: > > On Wed, Dec 6, 2017 at 9:46 PM, Michael Ellerman > > wrote: > > > Matthew Wilcox writes: > > >> So, just like we currently say "exactly one of MAP_SHARED or > > >> MAP_PRIVATE", > >

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-07 Thread Matthew Wilcox
On Thu, Dec 07, 2017 at 11:14:27AM -0800, Kees Cook wrote: > On Wed, Dec 6, 2017 at 9:46 PM, Michael Ellerman wrote: > > Matthew Wilcox writes: > >> So, just like we currently say "exactly one of MAP_SHARED or MAP_PRIVATE", > >> we could add a new paragraph saying "at most one of MAP_FIXED or > >

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-07 Thread Kees Cook
On Wed, Dec 6, 2017 at 9:46 PM, Michael Ellerman wrote: > Matthew Wilcox writes: > >> On Tue, Dec 05, 2017 at 08:54:35PM -0800, Matthew Wilcox wrote: >>> On Wed, Dec 06, 2017 at 03:51:44PM +1100, Michael Ellerman wrote: >>> > Cyril Hrubis writes: >>> > >>> > > Hi! >>> > >> > MAP_FIXED_UNIQUE >>>

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread Michael Ellerman
Matthew Wilcox writes: > On Tue, Dec 05, 2017 at 08:54:35PM -0800, Matthew Wilcox wrote: >> On Wed, Dec 06, 2017 at 03:51:44PM +1100, Michael Ellerman wrote: >> > Cyril Hrubis writes: >> > >> > > Hi! >> > >> > MAP_FIXED_UNIQUE >> > >> > MAP_FIXED_ONCE >> > >> > MAP_FIXED_FRESH >> > >> >> > >>

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread John Hubbard
On 12/06/2017 04:19 PM, Kees Cook wrote: > On Wed, Dec 6, 2017 at 1:08 AM, Michal Hocko wrote: >> On Wed 06-12-17 08:33:37, Rasmus Villemoes wrote: >>> On 2017-12-06 05:50, Michael Ellerman wrote: Michal Hocko writes: > On Wed 29-11-17 14:25:36, Kees Cook wrote: > It is safe in

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread Kees Cook
On Wed, Dec 6, 2017 at 1:08 AM, Michal Hocko wrote: > On Wed 06-12-17 08:33:37, Rasmus Villemoes wrote: >> On 2017-12-06 05:50, Michael Ellerman wrote: >> > Michal Hocko writes: >> > >> >> On Wed 29-11-17 14:25:36, Kees Cook wrote: >> >> It is safe in a sense it doesn't perform any address space

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread Michal Hocko
On Wed 06-12-17 08:33:37, Rasmus Villemoes wrote: > On 2017-12-06 05:50, Michael Ellerman wrote: > > Michal Hocko writes: > > > >> On Wed 29-11-17 14:25:36, Kees Cook wrote: > >> It is safe in a sense it doesn't perform any address space dangerous > >> operations. mmap is _inherently_ about the a

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread Florian Weimer
On 12/06/2017 09:06 AM, John Hubbard wrote: On 12/05/2017 11:35 PM, Florian Weimer wrote: On 12/06/2017 08:33 AM, John Hubbard wrote: In that case, maybe: MAP_EXACT ? ...because that's the characteristic behavior. Is that true?  mmap still silently rounding up the length to the page s

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-06 Thread John Hubbard
On 12/05/2017 11:35 PM, Florian Weimer wrote: > On 12/06/2017 08:33 AM, John Hubbard wrote: >> In that case, maybe: >> >> MAP_EXACT >> >> ? ...because that's the characteristic behavior. > > Is that true?  mmap still silently rounding up the length to the page size, I > assume, so even that

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Florian Weimer
On 12/06/2017 08:33 AM, John Hubbard wrote: In that case, maybe: MAP_EXACT ? ...because that's the characteristic behavior. Is that true? mmap still silently rounding up the length to the page size, I assume, so even that name is misleading. Thanks, Florian

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread John Hubbard
On 12/05/2017 11:03 PM, Matthew Wilcox wrote: > On Tue, Dec 05, 2017 at 08:54:35PM -0800, Matthew Wilcox wrote: >> On Wed, Dec 06, 2017 at 03:51:44PM +1100, Michael Ellerman wrote: >>> Cyril Hrubis writes: >>> Hi! >> MAP_FIXED_UNIQUE >> MAP_FIXED_ONCE >> MAP_FIXED_FRESH >

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Rasmus Villemoes
On 2017-12-06 05:50, Michael Ellerman wrote: > Michal Hocko writes: > >> On Wed 29-11-17 14:25:36, Kees Cook wrote: >> It is safe in a sense it doesn't perform any address space dangerous >> operations. mmap is _inherently_ about the address space so the context >> should be kind of clear. > > S

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Matthew Wilcox
On Tue, Dec 05, 2017 at 08:54:35PM -0800, Matthew Wilcox wrote: > On Wed, Dec 06, 2017 at 03:51:44PM +1100, Michael Ellerman wrote: > > Cyril Hrubis writes: > > > > > Hi! > > >> > MAP_FIXED_UNIQUE > > >> > MAP_FIXED_ONCE > > >> > MAP_FIXED_FRESH > > >> > > >> Well, I can open a poll for the best

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Matthew Wilcox
On Wed, Dec 06, 2017 at 03:51:44PM +1100, Michael Ellerman wrote: > Cyril Hrubis writes: > > > Hi! > >> > MAP_FIXED_UNIQUE > >> > MAP_FIXED_ONCE > >> > MAP_FIXED_FRESH > >> > >> Well, I can open a poll for the best name, but none of those you are > >> proposing sound much better to me. Yeah, nam

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Michael Ellerman
Cyril Hrubis writes: > Hi! >> > MAP_FIXED_UNIQUE >> > MAP_FIXED_ONCE >> > MAP_FIXED_FRESH >> >> Well, I can open a poll for the best name, but none of those you are >> proposing sound much better to me. Yeah, naming sucks... > > Given that MAP_FIXED replaces the previous mapping MAP_FIXED_NOREPL

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-05 Thread Michael Ellerman
Michal Hocko writes: > On Wed 29-11-17 14:25:36, Kees Cook wrote: >> On Wed, Nov 29, 2017 at 6:42 AM, Michal Hocko wrote: >> > The first patch introduced MAP_FIXED_SAFE which enforces the given >> > address but unlike MAP_FIXED it fails with ENOMEM if the given range >> > conflicts with an exist

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-12-01 Thread Cyril Hrubis
Hi! > > MAP_FIXED_UNIQUE > > MAP_FIXED_ONCE > > MAP_FIXED_FRESH > > Well, I can open a poll for the best name, but none of those you are > proposing sound much better to me. Yeah, naming sucks... Given that MAP_FIXED replaces the previous mapping MAP_FIXED_NOREPLACE would probably be a best fit.

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Michal Hocko
On Wed 29-11-17 14:25:36, Kees Cook wrote: > On Wed, Nov 29, 2017 at 6:42 AM, Michal Hocko wrote: > > The first patch introduced MAP_FIXED_SAFE which enforces the given > > address but unlike MAP_FIXED it fails with ENOMEM if the given range > > conflicts with an existing one. The flag is introduc

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Kees Cook
On Wed, Nov 29, 2017 at 6:42 AM, Michal Hocko wrote: > The first patch introduced MAP_FIXED_SAFE which enforces the given > address but unlike MAP_FIXED it fails with ENOMEM if the given range > conflicts with an existing one. The flag is introduced as a completely I still think this name should

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Kees Cook
On Wed, Nov 29, 2017 at 7:13 AM, Rasmus Villemoes wrote: > On 2017-11-29 15:42, Michal Hocko wrote: >> >> The first patch introduced MAP_FIXED_SAFE which enforces the given >> address but unlike MAP_FIXED it fails with ENOMEM if the given range >> conflicts with an existing one. > > [s/ENOMEM/EEXI

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Kees Cook
On Wed, Nov 29, 2017 at 6:42 AM, Michal Hocko wrote: > Except we won't export expose the new semantic to the userspace at all. I'm confused: the changes in patch 1 are explicitly adding MAP_FIXED_SAFE to the uapi. If it's not supposed to be exposed, shouldn't it go somewhere else? -Kees -- Kee

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Michal Hocko
On Wed 29-11-17 16:13:53, Rasmus Villemoes wrote: > On 2017-11-29 15:42, Michal Hocko wrote: [...] > >The flag is introduced as a completely > > new one rather than a MAP_FIXED extension because of the backward > > compatibility. We really want a never-clobber semantic even on older > > kernels whi

Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE

2017-11-29 Thread Rasmus Villemoes
On 2017-11-29 15:42, Michal Hocko wrote: > > The first patch introduced MAP_FIXED_SAFE which enforces the given > address but unlike MAP_FIXED it fails with ENOMEM if the given range > conflicts with an existing one. [s/ENOMEM/EEXIST/, as it seems you also did in the actual patch and changelog]