Thread (55 messages) 55 messages, 12 authors, 2021-08-17

RE: [RFC PATCH 0/5] madvise MADV_DOEXEC

From: Longpeng (Mike, Cloud Infrastructure Service Product Dept.) <hidden>
Date: 2021-07-13 00:58:10
Also in: lkml

Hi Matthew,
-----Original Message-----
From: Matthew Wilcox [mailto:willy@infradead.org]
Sent: Monday, July 12, 2021 9:30 AM
To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
[off-list ref]
Cc: Steven Sistare <redacted>; Anthony Yznaga
[off-list ref]; linux-kernel@vger.kernel.org;
linux-mm@kvack.org; Gonglei (Arei) [off-list ref]
Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

On Mon, Jul 12, 2021 at 09:05:45AM +0800, Longpeng (Mike, Cloud
Infrastructure Service Product Dept.) wrote:
quoted
Let me describe my use case more clearly (just ignore if you're not
interested in it):

1. Prog A mmap() 4GB memory (anon or file-mapping), suppose the
allocated VA range is [0x40000000,0x140000000)

2. Prog A specifies [0x48000000,0x50000000) and
[0x80000000,0x100000000) will be shared by its child.

3. Prog A fork() Prog B and then Prog B exec() a new ELF binary.

4. Prog B notice the shared ranges (e.g. by input parameters or ...)
and remap them to a continuous VA range.
This is dangerous.  There must be an active step for Prog B to accept Prog A's
ranges into its address space.  Otherwise Prog A could almost completely fill
Prog B's address space and so control where Prog B places its mappings.  It
could also provoke a latent bug in Prog B if it doesn't handle address space
exhaustion gracefully.

I had a proposal to handle this.  Would it meet your requirements?
https://lore.kernel.org/lkml/20200730152250.GG23808@casper.infradead.org/ (local)
I noticed your proposal of project Sileby and I think it can meet Steven's requirement, but I not sure whether it's suitable for mine because there's no sample code yet, is it in progress ?

According to the abstract of Sileby, I have two questions:
1. Would you plan to support the file-mapping memory sharing ? e.g. Prog A's 4G memory is backend with 2M hugetlb.
2. Does each mshare fd only containe one sharing VMA ? For large memory process (1T~4T in our env), maybe there is hundreds of memory ranges need to be shared, this will take too much fd space if so ?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help