From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: MAX_ARG_PAGES has no effect?
Date: Thu, 1 Sep 2005 08:57:10 +0200 [thread overview]
Message-ID: <20050901065710.GB5179@elte.hu> (raw)
In-Reply-To: <p73psrtr8ho.fsf@verdi.suse.de>
* 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
next prev parent reply other threads:[~2005-09-01 6:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-31 0:18 Nick Matteo
2005-08-31 12:11 ` Ingo Molnar
2005-08-31 12:25 ` Jakub Jelinek
2005-08-31 23:29 ` Andi Kleen
2005-09-01 6:57 ` Ingo Molnar [this message]
2005-09-01 7:26 ` Andi Kleen
2005-09-01 8:30 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050901065710.GB5179@elte.hu \
--to=mingo@elte.hu \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®