]> git.baikalelectronics.ru Git - kernel.git/commit
Allow ARG_MAX execve string space even with a small stack limit
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 3 Mar 2008 18:12:14 +0000 (10:12 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 3 Mar 2008 18:12:14 +0000 (10:12 -0800)
commit65259a4f552f9180b033384f7afdeba350a56a5e
tree6a5dfc2b0ff946406082a8ad4dc046964d259dea
parent4faf78db23255ead902c2ea49130fa1d463efce3
Allow ARG_MAX execve string space even with a small stack limit

The new code that removed the limitation on the execve string size
(which was historically 32 pages) replaced it with a much softer limit
based on RLIMIT_STACK which is usually much larger than the traditional
limit.  See commit b73cdb49c6a7dbb6b90e7b3f1f010ce2a7ffe481 ("mm:
variable length argument support") for details.

However, if you have a small stack limit (perhaps because you need lots
of stacks in a threaded environment), the new heuristic of allowing up
to 1/4th of RLIMIT_STACK to be used for argument and environment strings
could actually be smaller than the old limit.

So just say that it's ok to have up to ARG_MAX strings regardless of the
value of RLIMIT_STACK, and check the rlimit only when going over that
traditional limit.

(Of course, if you actually have a *really* small stack limit, the whole
stack itself will be limited before you hit ARG_MAX, but that has always
been true and is clearly the right behaviour anyway).

Acked-by: Carlos O'Donell <carlos@codesourcery.com>
Cc: Michael Kerrisk <michael.kerrisk@googlemail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ollie Wild <aaw@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/exec.c