all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 18410@debbugs.gnu.org
Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.
Date: Sun, 07 Sep 2014 13:33:10 -0700	[thread overview]
Message-ID: <540CC106.8040705@cs.ucla.edu> (raw)
In-Reply-To: <83bnqrcq7u.fsf@gnu.org>

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?





  reply	other threads:[~2014-09-07 20:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05  6:08 bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation Paul Eggert
2014-09-05  8:45 ` Dmitry Antipov
2014-09-05 15:01   ` Paul Eggert
2014-09-05 15:44   ` Stefan Monnier
2014-09-05 16:04     ` Andreas Schwab
2014-09-05 17:22       ` Stefan Monnier
2014-09-05  8:59 ` Dmitry Antipov
2014-09-05 15:03   ` Paul Eggert
2014-09-07  7:20 ` Paul Eggert
2014-09-07 17:09   ` Eli Zaretskii
2014-09-07 20:33     ` Paul Eggert [this message]
2014-09-08  2:22       ` Stefan Monnier
2014-09-08  2:35         ` Eli Zaretskii
2014-09-08  2:43           ` Stefan Monnier
2014-09-08  2:38         ` Paul Eggert
2014-09-08  3:17           ` Demetrios Obenour
2014-09-08  3:19             ` Daniel Colascione
2014-09-08  3:20               ` Demetrios Obenour
2014-09-08  7:26           ` Dmitry Antipov
2014-09-08  2:36       ` Eli Zaretskii
2014-09-08 12:48         ` Stefan Monnier
2014-09-09 13:17           ` Eli Zaretskii
2014-09-09 13:49             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540CC106.8040705@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=18410@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.