[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171213130135.GG25185@dhcp22.suse.cz>
Date: Wed, 13 Dec 2017 14:01:35 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-api@...r.kernel.org, Khalid Aziz <khalid.aziz@...cle.com>,
Michael Ellerman <mpe@...erman.id.au>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King - ARM Linux <linux@...linux.org.uk>,
Andrea Arcangeli <aarcange@...hat.com>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
Florian Weimer <fweimer@...hat.com>,
John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH 1/2] mm: introduce MAP_FIXED_SAFE
On Wed 13-12-17 04:50:53, Matthew Wilcox wrote:
> On Wed, Dec 13, 2017 at 10:25:49AM +0100, Michal Hocko wrote:
> > +++ b/mm/mmap.c
> > @@ -1342,6 +1342,10 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
> > if (!(file && path_noexec(&file->f_path)))
> > prot |= PROT_EXEC;
> >
> > + /* force arch specific MAP_FIXED handling in get_unmapped_area */
> > + if (flags & MAP_FIXED_SAFE)
> > + flags |= MAP_FIXED;
> > +
> > if (!(flags & MAP_FIXED))
> > addr = round_hint_to_min(addr);
> >
>
> We're up to 22 MAP_ flags now. We'll run out soon. Let's preserve half
> of a flag by giving userspace the definition:
>
> #define MAP_FIXED_SAFE (MAP_FIXED | _MAP_NOT_HINT)
I've already tried to explain why this cannot be a modifier for
MAP_FIXED. Read about the backward compatibility note...
Or do I misunderstand what you are saying here?
> then in here:
>
> if ((flags & _MAP_NOT_HINT) && !(flags & MAP_FIXED))
> return -EINVAL;
>
> Now we can use _MAP_NOT_HINT all by itself in the future to mean
> something else.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists