[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728134015.tmjy5hy4xden2v5h@wittgenstein>
Date: Tue, 28 Jul 2020 15:40:15 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Steven Sistare <steven.sistare@...cle.com>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
Anthony Yznaga <anthony.yznaga@...cle.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-arch@...r.kernel.org, mhocko@...nel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
hpa@...or.com, viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
arnd@...db.de, keescook@...omium.org, gerg@...ux-m68k.org,
ktkhai@...tuozzo.com, peterz@...radead.org, esyr@...hat.com,
jgg@...pe.ca, christian@...lner.me, areber@...hat.com,
cyphar@...har.com, linux-api@...r.kernel.org
Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC
On Mon, Jul 27, 2020 at 02:00:17PM -0400, Steven Sistare wrote:
> On 7/27/2020 1:07 PM, ebiederm@...ssion.com wrote:
> > Anthony Yznaga <anthony.yznaga@...cle.com> writes:
> >
> >> This patchset adds support for preserving an anonymous memory range across
> >> exec(3) using a new madvise MADV_DOEXEC argument. The primary benefit for
> >> sharing memory in this manner, as opposed to re-attaching to a named shared
> >> memory segment, is to ensure it is mapped at the same virtual address in
> >> the new process as it was in the old one. An intended use for this is to
> >> preserve guest memory for guests using vfio while qemu exec's an updated
> >> version of itself. By ensuring the memory is preserved at a fixed address,
> >> vfio mappings and their associated kernel data structures can remain valid.
> >> In addition, for the qemu use case, qemu instances that back guest RAM with
> >> anonymous memory can be updated.
> >
> > What is wrong with using a file descriptor to a possibly deleted file
> > and re-mmaping it?
> >
> > There is already MAP_FIXED that allows you to ensure you have the same
> > address.
>
> MAP_FIXED blows away any existing mapping in that range, which is not the
> desired behavior. We want to preserve the previously created mapping at
There's also MAP_FIXED_NOREPLACE since v4.17 in case that helps.
Note that this should really go to linux-api too. I won't argue to
resend it since that would mean spamming everyone's inbox with the same
thread again but in case you send a revised version, please ensure to Cc
linux-api. The glibc folks are listening on there too.
Thanks!
Christian
Powered by blists - more mailing lists