[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e301609c-b2ac-24d1-c349-8d25e5123258@redhat.com>
Date: Mon, 25 Sep 2017 14:40:42 +0200
From: Florian Weimer <fweimer@...hat.com>
To: Michal Hocko <mhocko@...nel.org>
Cc: Mike Kravetz <mike.kravetz@...cle.com>, mtk.manpages@...il.com,
linux-man@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, Andrea Arcangeli <aarcange@...hat.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Vlastimil Babka <vbabka@...e.cz>,
Anshuman Khandual <khandual@...ux.vnet.ibm.com>,
linux-mm@...ck.org
Subject: Re: [patch] mremap.2: Add description of old_size == 0 functionality
On 09/25/2017 02:35 PM, Michal Hocko wrote:
> What would be the usecase. I mean why don't you simply create a new
> mapping by a plain mmap when you have no guarantee about the same
> content?
I plan to use it for creating an unbounded number of callback thunks at
run time, from a single set of pages in libc.so, in case we need this
functionality.
The idea is to duplicate existing position-independent machine code in
libc.so, prefixed by a data mapping which controls its behavior. Each
data/code combination would only give us a fixed number of thunks, so
we'd need to create a new mapping to increase the total number.
Instead, we could re-map the code from the executable in disk, but not
if chroot has been called or glibc has been updated on disk. Creating
an alias mapping does not have these problems.
Another application (but that's for anonymous memory) would be to
duplicate class metadata in a Java-style VM, so that you can use bits in
the class pointer in each Java object (which is similar to the vtable
pointer in C++) for the garbage collector, without having to mask it
when accessing the class metadata in regular (mutator) code.
Thanks,
Florian
Powered by blists - more mailing lists