lkml.org 
[lkml]   [2005]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: MAX_ARG_PAGES has no effect?

    * Andi Kleen <ak@suse.de> wrote:

    > Ingo Molnar <mingo@elte.hu> writes:
    > >
    > > MAX_ARG_PAGES should work just fine. I think the 'getconf ARG_MAX'
    > > output is hardcoded. (because the kernel does not provide the
    > > information dynamically)
    >
    > Perhaps it would be a good idea to make it a sysctl. Is there any
    > reason it should be hardcoded? I cannot think of any.
    >
    > Ok if someone lowers the sysctl then execve has to handle the case of
    > the args/environment possibly not fitting anymore, but that should be
    > easy.

    the whole thing should be reworked, so that there is no artificial limit
    like MAX_ARG_PAGES. (it is after all just another piece of memory, in
    theory)

    I have tried this a couple of times but failed - it's a hard problem.
    Linus had the idea years ago to page-flip the argument data into the new
    process's address space, but that doesnt work out in practice due to the
    way glibc has to extend the environment space. (glibc extends it by
    modifying the environment array, or relocating it if it has to be grown.
    execve() currently automatically 'linearizes' the environment by copying
    both the array and the old and new environment strings to a linear piece
    of memory.)

    If we do unconditional page-flipping then we fragment the argument
    space, if we do both page-flipping if things are unfragmented and
    well-aligned, and 'compact' the layout otherwise, we havent solved the
    problem and have introduced a significant extra layer of complexity to
    an already security-sensitive and fragile piece of code.

    The best method i found was to get rid of bprm->pages[] and to directly
    copy strings into the new mm via kmap (and to follow whatever RAM
    allocation policies/limits there are for the new mm), but that's quite
    ugly.

    Ingo
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-09-01 08:58    [W:0.026 / U:33.028 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site