Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2000 15:48:23 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Sebastiaan van Erk <sebster@sebster.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: argument list too long
Message-ID:  <20001116154822.B18037@fw.wintelcom.net>
In-Reply-To: <20001117004239.A3656@sebster.com>; from sebster@sebster.com on Fri, Nov 17, 2000 at 12:42:39AM %2B0100
References:  <00111621362707.00522@shalimar.net.au> <20001116122313.A69018@sebster.com> <00111700205500.61931@shalimar.net.au> <20001116145641.A22842@sebster.com> <20001116105654.G830@fw.wintelcom.net> <20001116231731.A14470@c187104187.telekabel.chello.nl> <20001116143843.S830@fw.wintelcom.net> <20001117000816.B15150@c187104187.telekabel.chello.nl> <20001116152421.A18037@fw.wintelcom.net> <20001117004239.A3656@sebster.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Sebastiaan van Erk <sebster@sebster.com> [001116 15:42] wrote:
> Alfred Perlstein wrote:
> 
> > And what about Bob down the hall that's screwed because your program
> > just allocated all the kernel memory to pass your super long arglist?
> > 
> > What about the next program you want to run?
> 
> What about them? Are you saying nobody can think up a way of passing
> long argument lists without crashing the machine?
> 
> What about:
> int main() { while(1) malloc(1024); }
> 
> THEN what about Bob? Why don't you limit argument lists in the same
> way that you limit users? The user allocates the list and passes
> a pointer to it to execve? I don't see any reason for the kernel
> ever needing to copy the list.

We limit the amount of memory a user can allocate.

See the manpage for limit.

> > I'm not assuming very little memory, I'm assuming that it wouldn't
> > be good if one was able to cause a machine to fail all further
> > execs by just passing a multimegabyte arglist.
> 
> True. That wouldn't be good. But it just wouldn't have to happen.

I don't see how one could allocate all this memory and not have
it happen.

> > So why not use the tools already available before trying to foster
> > these silly new ways apon us.
>  
> Well I think it's not so silly to be able to do a tar `find / -name '*.jsp'`.

I do, there's tools to address this issue.

> Actually what would really be neat in my opinion would be if you could
> specify (in a generic way) that you want to read your program to read the
> arguments from a file. That way you don't have to rely on the program
> to give you this option, and you don't have to be limitted by arg list
> lengths either, because you can actually implement something as
> 
> command `command1` fixed args `command 2`
> 
> (schematically) as
> 
> (command1; echo fixed args; command2) | command --args-from -
> 
> This would be a much more efficient (lazy evaluation and such) implementation
> of backquote substitution, and it would give you unlimitted argument lists
> as well! 

So write a library to do so, it'll take you a lot more time than
just using xargs.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001116154822.B18037>