[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <289f0cc8-9e24-fc38-cb83-4223f9923940@redhat.com>
Date: Fri, 8 Dec 2017 21:47:21 +0100
From: Florian Weimer <fweimer@...hat.com>
To: Pavel Machek <pavel@....cz>, Michael Ellerman <mpe@...erman.id.au>
Cc: Matthew Wilcox <willy@...radead.org>,
Kees Cook <keescook@...omium.org>,
Cyril Hrubis <chrubis@...e.cz>,
Michal Hocko <mhocko@...nel.org>,
Linux API <linux-api@...r.kernel.org>,
Khalid Aziz <khalid.aziz@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King - ARM Linux <linux@...linux.org.uk>,
Andrea Arcangeli <aarcange@...hat.com>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
John Hubbard <jhubbard@...dia.com>,
Abdul Haleem <abdhalee@...ux.vnet.ibm.com>,
Joel Stanley <joel@....id.au>
Subject: Re: [PATCH 0/2] mm: introduce MAP_FIXED_SAFE
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)
> Actually, if we had a time machine... would we even provide
> MAP_REPLACE functionality?
Probably yes. ELF loading needs to construct a complex set of mappings
from a single file. munmap (to create a hole) followed by mmap would be
racy because another thread could have reused the gap in the meantime.
The only alternative to overriding existing mappings would be mremap
with MREMAP_FIXED, and that doesn't look like an improvement API-wise.
(The glibc dynamic linker uses an mmap call with an increased length to
reserve address space and then loads additional segments with MAP_FIXED
at the offsets specified in the program header.)
Thanks,
Florian
Powered by blists - more mailing lists