unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Dmitry Antipov <dmantipov@yandex.ru>,
	 Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Avoid C stack overflow
Date: Thu, 13 Mar 2014 10:57:33 -0700	[thread overview]
Message-ID: <5321F18D.5080008@cs.ucla.edu> (raw)
In-Reply-To: <5321E00C.2010107@yandex.ru>

On 03/13/2014 09:42 AM, Dmitry Antipov wrote:
> What about an attempt to avoid such a mess by examining current C 
> stack depth and check it against system limits, like suggested in the 
> patch below?

Don't most systems solve the problem with guard pages these days? If so, 
Emacs should just rely on these pages, as that shouldn't require slowing 
down Ffuncall etc. And if not, if memory management is available Emacs 
could install a guard page of its own, again without slowing down the 
main interpreter loop.

Also, the code as given won't work on systems that have split stacks 
(e.g., gcc -fsplit-stack), and would need to be ported to them.

How about the following idea instead?  Assume that there are guard 
pages, and have Emacs trap the resulting signal and do the right thing.



  parent reply	other threads:[~2014-03-13 17:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-13 16:42 Avoid C stack overflow Dmitry Antipov
2014-03-13 17:38 ` Eli Zaretskii
2014-03-13 17:57 ` Paul Eggert [this message]
2014-03-13 20:56   ` Eli Zaretskii
2014-03-14  7:02     ` Paul Eggert
2014-03-14  5:47   ` Dmitry Antipov
2014-03-14  6:59     ` Paul Eggert
2014-03-14 11:27       ` Dmitry Antipov
2014-03-14 13:05       ` Stefan Monnier
2014-03-14 13:56         ` Paul Eggert
2014-03-14 16:45           ` Stefan
2014-03-15  1:38             ` Stephen J. Turnbull

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5321F18D.5080008@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).