From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Avoid C stack overflow Date: Fri, 14 Mar 2014 06:56:57 -0700 Organization: UCLA Computer Science Department Message-ID: <53230AA9.6030005@cs.ucla.edu> References: <5321E00C.2010107@yandex.ru> <5321F18D.5080008@cs.ucla.edu> <532297FB.7090608@yandex.ru> <5322A8DE.3080109@cs.ucla.edu> 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 1394805441 13957 80.91.229.3 (14 Mar 2014 13:57:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Mar 2014 13:57:21 +0000 (UTC) Cc: Dmitry Antipov , Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 14 14:57:29 2014 Return-path: Envelope-to: ged-emacs-devel@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 1WOSc4-0001X8-2E for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2014 14:57:28 +0100 Original-Received: from localhost ([::1]:44928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSc3-0003Nx-PM for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2014 09:57:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSbt-0003AD-Jw for emacs-devel@gnu.org; Fri, 14 Mar 2014 09:57:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOSbm-0000dh-4P for emacs-devel@gnu.org; Fri, 14 Mar 2014 09:57:17 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:51294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOSbl-0000dd-Uk for emacs-devel@gnu.org; Fri, 14 Mar 2014 09:57:10 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 21D61A60001; Fri, 14 Mar 2014 06:57:09 -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 uY75ZRbCxQSt; Fri, 14 Mar 2014 06:57:08 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-108-0-233-62.lsanca.fios.verizon.net [108.0.233.62]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id AD0DA39E8011; Fri, 14 Mar 2014 06:57:08 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:170358 Archived-At: Stefan Monnier wrote: > Currently, "MAX_ALLOCA = 16 * 1024", so yes, Emacs is expected to > occasionally allocate objects larger than your typical 4KB or 8KB > guard page. That's easily fixable by adjusting MAX_ALLOCA down to a bit less than 4 KiB (which is what Gnulib code does) or by arranging for more guard pages than usual (more hassle, but eminently doable on most platforms). Emacs already has a stack-overflow prevention mechanism, right? And we're talking about what to do when the user deliberately disables it? So the simplest answer is "don't do that".