Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.ripco.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: Konstantin Khlebnikov Newsgroups: gnu.bash.bug Subject: Re: memory hog script crashes bash with segfault Date: Fri, 11 Sep 2015 17:10:58 +0300 Lines: 19 Approved: bug-bash@gnu.org Message-ID: References: <55F2CEA7.9070404@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: usenet.stanford.edu 1441980666 24471 208.118.235.17 (11 Sep 2015 14:11:06 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: chet.ramey@case.edu Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iJe2f0Z60MTmHOlPSPb4rHfgwrFnKvS3+d/3hVewkpQ=; b=Pfsgciwq4N9qTrU2zGvyb38EdB+pSALoFW3VD5HlHEIXrxXDETY6fAel0AfimDwqaD fKkXZBN/WSDQ94VjggZF3IKscQ+iHG5ApoTBl/j1YOn+QY6yqWgDw0WV7AmgFKrFnDYX up8aLUuhB5c9ztOeY790KF9JbahgWHvW+JEn3T9ZoNMNulEk75gvDVmPGwRG0iDafUSQ 5aOqBXZ2p8j06Qa/IoFcd4n4lH6Zy/Lgl3c4IFZEO0QORbKZdpGZerDhuuF2jgSJCSoE xxU5Nh/w1dImEegaYDOUN4nC+Zbj7N2rXwz7Gcaee5gFFXV0rs6wGUNI8uFbXnem0Vpf 7/Pw== X-Received: by 10.152.20.228 with SMTP id q4mr40825381lae.74.1441980658288; Fri, 11 Sep 2015 07:10:58 -0700 (PDT) In-Reply-To: <55F2CEA7.9070404@case.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11488 On Fri, Sep 11, 2015 at 3:52 PM, Chet Ramey wrote: > On 9/11/15 2:19 AM, Konstantin Khlebnikov wrote: >> $ ./bash -c ":(){ : $@$@;};: :" >> Segmentation fault > > This is not a memory allocation problem. You have defined an infinitely > recursive function that, when executed, eventually exceeds your stack size > resource limit. When that happens, the kernel sends a SIGSEGV. Yep. But this not happens if command runs in interactive mode. Bash uses default stack (with MAP_GROWSDOWN) in interactive mode and fixed size stack for "-c" ? > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/