From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation. Date: Sun, 07 Sep 2014 13:33:10 -0700 Organization: UCLA Computer Science Department Message-ID: <540CC106.8040705@cs.ucla.edu> References: <5409536B.5090201@cs.ucla.edu> <540C0741.8090900@cs.ucla.edu> <83bnqrcq7u.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1410122067 3948 80.91.229.3 (7 Sep 2014 20:34:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Sep 2014 20:34:27 +0000 (UTC) Cc: 18410@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 07 22:34:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XQjAC-0008Sz-2l for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Sep 2014 22:34:20 +0200 Original-Received: from localhost ([::1]:39520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQjAB-00065H-Lu for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Sep 2014 16:34:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQjA1-00063g-Jq for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 16:34:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQj9u-0001NE-4F for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 16:34:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQj9u-0001NA-1J for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 16:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XQj9t-0000Gb-O4 for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 16:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Sep 2014 20:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18410 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 18410-submit@debbugs.gnu.org id=B18410.1410122008978 (code B ref 18410); Sun, 07 Sep 2014 20:34:01 +0000 Original-Received: (at 18410) by debbugs.gnu.org; 7 Sep 2014 20:33:28 +0000 Original-Received: from localhost ([127.0.0.1]:33036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XQj9L-0000Fh-8r for submit@debbugs.gnu.org; Sun, 07 Sep 2014 16:33:27 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:60284) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XQj9J-0000FS-P6 for 18410@debbugs.gnu.org; Sun, 07 Sep 2014 16:33:26 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C05AAA60006; Sun, 7 Sep 2014 13:33:19 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ceBfqNGHWxN9; Sun, 7 Sep 2014 13:33:11 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-71-177-17-123.lsanca.dsl-w.verizon.net [71.177.17.123]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 1174439E8012; Sun, 7 Sep 2014 13:33:11 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <83bnqrcq7u.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93118 Archived-At: Eli Zaretskii wrote: > MAX_ALLOCA is a relatively small number compared to the stack space > available on modern systems, so I see no reason to fail and exit in > these cases, it sounds too drastic. Usually MAX_ALLOCA-related code falls back on malloc, and does not exit merely because a request was larger. callproc.c's child_setup function is special, though, as it executes in a vforked child that cannot safely call malloc because that would screw up the parent's malloc arena. In this special case the child exits (Emacs itself doesn't), so it's not that drastic. It'd be nicer if Emacs would allocate the memory before vforking the child, as that would avoid the limitation, but I daresay it's not urgent to fix this. It should be commented better, though, and I gave that a shot in trunk bzr 117837. Quite possibly we should increase MAX_ALLOCA on many modern systems. As I recall we last discussed that in July, and Stefan was worried about max-lisp-eval-depth * MAX_ALLOCA * N overflowing the C stack, where N is the maximum nesting depth of SAFE_ALLOCA-using C functions between Lisp functions. Perhaps some of that discussion is moot now, with the stack overflow checking that Dmitry added last month?