From owner-freebsd-hackers Fri Mar 24 11:57:13 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id DD5EC37BC87 for ; Fri, 24 Mar 2000 11:57:10 -0800 (PST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e2OKJWf25252; Fri, 24 Mar 2000 12:19:32 -0800 (PST) Date: Fri, 24 Mar 2000 12:19:32 -0800 From: Alfred Perlstein To: Dungeonkeeper Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: shell issue Message-ID: <20000324121932.R21029@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from zethix@sofiaonline.com on Fri, Mar 24, 2000 at 06:35:47PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Dungeonkeeper [000324 10:03] wrote: > > > Hi there, > > First of all: I want to apologise for my poor english. > > Today me and a few friends of mine discussed the shells' (well, shell is > actualy one of: sh/bash/csh/tcsh... not tested for ksh) command line expansion > routines, mainly because of a problem discovered by one of my friends. I'm not > sure if this is something new... So, let me explain what he found. It seems > that the shell wants to allocate enough memory to hold the entire command line > when expanding all of the arguments and we can force it to allocate hudge > ammount of memory with a tricky command like this: > > carnivoro# /bin/csh -c `cat /dev/urandom` > > (I use tcsh here (the carnivoro# prompt), but the same thing happens when > testing with sh/bash/tcsh) In this situation, the shell tries to allocate enough > memory to hold what it > reads from /dev/urandom, because it must be passed as a command line argument > to /bin/csh ( actually, any command will be ok ). So, the shell eats more and > more memory (on my machine (3.4-STABLE) - 251 MB) before the kernel decided to > take some action (like killing some processes... started by other users? > system services? or... in my case... crash :). My friend said that he sent a > mail to bugtraq describing this problem. Those who are interested can read it. > > I believe that the shells have a maximum command lenght, so... I'm trying now > to make the shell use the same command lenght when expanding such commands. I > think this is the best way to avoid this problem. Any ideas? Yes, that's a good idea, I'd file a problem report with send-pr and it will probably be addressed. thanks, -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message