Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2000 12:19:32 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Dungeonkeeper <zethix@sofiaonline.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: shell issue
Message-ID:  <20000324121932.R21029@fw.wintelcom.net>
In-Reply-To: <XFMail.000324183547.zethix@sofiaonline.com>; from zethix@sofiaonline.com on Fri, Mar 24, 2000 at 06:35:47PM %2B0200
References:  <XFMail.000324183547.zethix@sofiaonline.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Dungeonkeeper <zethix@sofiaonline.com> [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




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