GNU bug report logs - #18410
Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Fri, 5 Sep 2014 06:10:02 UTC

Severity: wishlist

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18410 <at> debbugs.gnu.org
Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.
Date: Sun, 07 Sep 2014 13:33:10 -0700
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?




This bug report was last modified 10 years and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.