Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx/




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux