Re: [RFC/PATCH] RLIMIT_ARG_MAX

From: Alan Cox
Date: Fri Feb 29 2008 - 13:53:17 EST


On Fri, 29 Feb 2008 18:55:56 +0100
Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:

>
> On Fri, 2008-02-29 at 09:35 -0800, Linus Torvalds wrote:
> >
> > On Fri, 29 Feb 2008, Peter Zijlstra wrote:
> > >
> > > You fail to mention that <23 will still fault the first time it tries to
> > > grow the stack when you set rlimit_stack to 128k and actually supply
> > > 128k of env+arg.
> >
> > So? That's what rlimit_stack has always meant (and not just on Linux
> > either, afaik). That's not a bug, it's a feature. If the system has a
> > limited stack, it has a limited stack. That's what RLIMIT_STACK means.
>
> Well, I agree with that point. It just that apparently POSIX does not.
> According to Michael POSIX does not consider the arg+env array part of
> the stack proper.

As far as I can see POSIX and SuS do not care. In all the ABIs some of
your stack is already used by stuff. Posix doesn't seem to consider it
either way. By some undefined magic main() gets argc, argv, envp. Quite
frankly it could read them from a pipe before main is called.

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