Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-04 Thread Matthew Wilcox
On Tue, Aug 04, 2020 at 08:44:42AM +, David Laight wrote: > From: James Bottomley > > Sent: 03 August 2020 16:43 > > > > On Mon, 2020-08-03 at 10:28 -0500, Eric W. Biederman wrote: > > [...] > > > What is wrong with live migration between one qemu process and > > > another qemu process on the

RE: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-04 Thread David Laight
From: James Bottomley > Sent: 03 August 2020 16:43 > > On Mon, 2020-08-03 at 10:28 -0500, Eric W. Biederman wrote: > [...] > > What is wrong with live migration between one qemu process and > > another qemu process on the same machine not work for this use case? > > > > Just reusing live

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-03 Thread Steven Sistare
On 8/3/2020 11:42 AM, James Bottomley wrote: > On Mon, 2020-08-03 at 10:28 -0500, Eric W. Biederman wrote: > [...] >> What is wrong with live migration between one qemu process and >> another qemu process on the same machine not work for this use case? >> >> Just reusing live migration would seem

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-03 Thread Steven Sistare
On 8/3/2020 11:28 AM, ebied...@xmission.com wrote: > Steven Sistare writes: >> On 7/30/2020 5:58 PM, ebied...@xmission.com wrote: >>> Here is another suggestion. >>> >>> Have a very simple program that does: >>> >>> for (;;) { >>> handle = dlopen("/my/real/program"); >>>

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-03 Thread James Bottomley
On Mon, 2020-08-03 at 10:28 -0500, Eric W. Biederman wrote: [...] > What is wrong with live migration between one qemu process and > another qemu process on the same machine not work for this use case? > > Just reusing live migration would seem to be the simplest path of > all, as the code is

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-03 Thread Eric W. Biederman
Steven Sistare writes: > On 7/30/2020 5:58 PM, ebied...@xmission.com wrote: >> Here is another suggestion. >> >> Have a very simple program that does: >> >> for (;;) { >> handle = dlopen("/my/real/program"); >> real_main = dlsym(handle, "main"); >>

RE: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-08-03 Thread David Laight
> Maybe. We still need to preserve an anonymous segment, though. MADV_DOEXEC, > or mshare, > or something else. And I think the ability to preserve memory containing > pointers to itself > is an interesting use case, though not ours. Why does all this remind me of the old sendmail code.

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Steven Sistare
On 7/27/2020 1:11 PM, Anthony Yznaga wrote: > 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

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Steven Sistare
On 7/31/2020 1:48 PM, Jason Gunthorpe wrote: > On Fri, Jul 31, 2020 at 01:15:34PM -0400, Steven Sistare wrote: >> On 7/31/2020 12:56 PM, Jason Gunthorpe wrote: >>> On Fri, Jul 31, 2020 at 12:11:52PM -0400, Steven Sistare wrote: > Your preservation-across-exec use-case might or might not need

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Jason Gunthorpe
On Fri, Jul 31, 2020 at 01:15:34PM -0400, Steven Sistare wrote: > On 7/31/2020 12:56 PM, Jason Gunthorpe wrote: > > On Fri, Jul 31, 2020 at 12:11:52PM -0400, Steven Sistare wrote: > >>> Your preservation-across-exec use-case might or might not need the > >>> VMA to be mapped at the same address.

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Matthew Wilcox
On Fri, Jul 31, 2020 at 12:11:52PM -0400, Steven Sistare wrote: > On 7/31/2020 11:27 AM, Matthew Wilcox wrote: > > On Fri, Jul 31, 2020 at 10:57:44AM -0400, Steven Sistare wrote: > >> Matthews sileby/mshare proposal has the same issue. If a process opts-in > >> and mmap's an address in the shared

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Steven Sistare
On 7/31/2020 12:56 PM, Jason Gunthorpe wrote: > On Fri, Jul 31, 2020 at 12:11:52PM -0400, Steven Sistare wrote: >>> Your preservation-across-exec use-case might or might not need the >>> VMA to be mapped at the same address. >> >> It does. qemu registers memory with vfio which remembers the

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Jason Gunthorpe
On Fri, Jul 31, 2020 at 12:11:52PM -0400, Steven Sistare wrote: > > Your preservation-across-exec use-case might or might not need the > > VMA to be mapped at the same address. > > It does. qemu registers memory with vfio which remembers the va's in kernel > metadata for the device. Once the

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Steven Sistare
On 7/31/2020 11:27 AM, Matthew Wilcox wrote: > On Fri, Jul 31, 2020 at 10:57:44AM -0400, Steven Sistare wrote: >> Matthews sileby/mshare proposal has the same issue. If a process opts-in >> and mmap's an address in the shared region, then content becomes mapped at >> a VA that was known to the

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Matthew Wilcox
On Fri, Jul 31, 2020 at 10:57:44AM -0400, Steven Sistare wrote: > Matthews sileby/mshare proposal has the same issue. If a process opts-in > and mmap's an address in the shared region, then content becomes mapped at > a VA that was known to the pre-fork or pre-exec process. Trust must still > be

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Steven Sistare
On 7/30/2020 5:58 PM, ebied...@xmission.com wrote: > Steven Sistare writes: >> On 7/30/2020 1:49 PM, Matthew Wilcox wrote: >>> On Thu, Jul 30, 2020 at 01:35:51PM -0400, Steven Sistare wrote: mshare + VA reservation is another possible solution. Or MADV_DOEXEC alone, which is ready

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-31 Thread Stefan Hajnoczi
Hi, Sileby looks interesting! I had just written up the following idea which seems similar but includes a mechanism for revoking mappings. Alexander Graf recently brought up an idea that solves the following problem: When process A passes shared memory file descriptors to process B there is no

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Eric W. Biederman
Steven Sistare writes: > On 7/30/2020 1:49 PM, Matthew Wilcox wrote: >> On Thu, Jul 30, 2020 at 01:35:51PM -0400, Steven Sistare wrote: >>> mshare + VA reservation is another possible solution. >>> >>> Or MADV_DOEXEC alone, which is ready now. I hope we can get back to >>> reviewing that. >>

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Steven Sistare
On 7/30/2020 1:49 PM, Matthew Wilcox wrote: > On Thu, Jul 30, 2020 at 01:35:51PM -0400, Steven Sistare wrote: >> mshare + VA reservation is another possible solution. >> >> Or MADV_DOEXEC alone, which is ready now. I hope we can get back to >> reviewing that. > > We are. This is the part of

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Matthew Wilcox
On Thu, Jul 30, 2020 at 01:35:51PM -0400, Steven Sistare wrote: > mshare + VA reservation is another possible solution. > > Or MADV_DOEXEC alone, which is ready now. I hope we can get back to > reviewing that. We are. This is the part of the review process where we explore other solutions to

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Steven Sistare
On 7/30/2020 1:12 PM, Matthew Wilcox wrote: > On Thu, Jul 30, 2020 at 11:59:42AM -0400, Steven Sistare wrote: >> On 7/30/2020 11:22 AM, Matthew Wilcox wrote: >>> On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: This patchset adds support for preserving an anonymous memory range

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Matthew Wilcox
On Thu, Jul 30, 2020 at 11:59:42AM -0400, Steven Sistare wrote: > On 7/30/2020 11:22 AM, Matthew Wilcox wrote: > > On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: > >> This patchset adds support for preserving an anonymous memory range across > >> exec(3) using a new madvise

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Steven Sistare
On 7/30/2020 11:22 AM, Matthew Wilcox wrote: > On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: >> 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

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Christian Brauner
On Thu, Jul 30, 2020 at 04:34:50PM +0100, Matthew Wilcox wrote: > On Thu, Jul 30, 2020 at 05:27:05PM +0200, Christian Brauner wrote: > > On Thu, Jul 30, 2020 at 04:22:50PM +0100, Matthew Wilcox wrote: > > > On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: > > > > This patchset adds

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Matthew Wilcox
On Thu, Jul 30, 2020 at 05:27:05PM +0200, Christian Brauner wrote: > On Thu, Jul 30, 2020 at 04:22:50PM +0100, Matthew Wilcox wrote: > > On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: > > > This patchset adds support for preserving an anonymous memory range across > > > exec(3)

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Christian Brauner
On Thu, Jul 30, 2020 at 04:22:50PM +0100, Matthew Wilcox wrote: > On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: > > This patchset adds support for preserving an anonymous memory range across > > exec(3) using a new madvise MADV_DOEXEC argument. The primary benefit for > >

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-30 Thread Matthew Wilcox
On Mon, Jul 27, 2020 at 10:11:22AM -0700, Anthony Yznaga wrote: > 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 >

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Anthony Yznaga
On 7/28/20 4:34 AM, Kirill Tkhai wrote: > On 27.07.2020 20:11, Anthony Yznaga wrote: >> 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: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Steven Sistare
On 7/28/2020 10:23 AM, Andy Lutomirski wrote: >> On Jul 27, 2020, at 10:02 AM, Anthony Yznaga >> wrote: >> >> 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

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Andy Lutomirski
> On Jul 27, 2020, at 10:02 AM, Anthony Yznaga > wrote: > > 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 >

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Christian Brauner
On Mon, Jul 27, 2020 at 02:00:17PM -0400, Steven Sistare wrote: > On 7/27/2020 1:07 PM, ebied...@xmission.com wrote: > > Anthony Yznaga writes: > > > >> This patchset adds support for preserving an anonymous memory range across > >> exec(3) using a new madvise MADV_DOEXEC argument. The primary

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Kirill Tkhai
On 27.07.2020 20:11, Anthony Yznaga wrote: > 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

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-27 Thread Steven Sistare
On 7/27/2020 1:07 PM, ebied...@xmission.com wrote: > Anthony Yznaga 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

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-27 Thread Eric W. Biederman
Anthony Yznaga 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

[RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-27 Thread Anthony Yznaga
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