lkml.org 
[lkml]   [2021]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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:
> 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/

\
 
 \ /
  Last update: 2021-07-12 03:31    [W:0.110 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site