From: Paul Eggert <eggert@cs.ucla.edu>
To: Daniel Colascione <dancol@dancol.org>,
Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org
Subject: Re: Two issues with stack overflow protection
Date: Wed, 29 Jul 2015 06:18:17 -0700 [thread overview]
Message-ID: <55B8D299.9010704@cs.ucla.edu> (raw)
In-Reply-To: <55B8B899.8020508@dancol.org>
Daniel Colascione wrote:
>>> What's wrong with just mprotecting a guard page at the end of the stack,
>>> >>and on overflow, giving that region normal protection, unwinding as
>>> >>normal, then, at top level, restoring the guard page?
>> >
>> >Unwinding can grow the stack.
> Sure. That's why you open up more stack to do the unwinding. Having done
> that, if you still overflow, just abort.
Yes, that was my point. Emacs already does the business about the guard page,
and opening up more stack, and so forth. The tricky part is the "if you still
overflow, just abort", something that's easy enough to describe at the high
level but perhaps not so easy to actually write the code. Part of the issue is
that the guard page business is done under the covers by the OS, not by Emacs
directly -- in general Emacs doesn't know where the guard page(s) are.
I'm sure there are other issues that won't get discovered until someone actually
writes and tests something. For example, here's something I just thought of:
the conservative marking phase of the Emacs garbage collector may need to be
taught about the split stack (currently it assumes the C stack is contiguous).
next prev parent reply other threads:[~2015-07-29 13:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 17:23 Two issues with stack overflow protection Eli Zaretskii
2015-07-29 5:01 ` Paul Eggert
2015-07-29 6:10 ` Daniel Colascione
2015-07-29 7:06 ` Paul Eggert
2015-07-29 11:27 ` Daniel Colascione
2015-07-29 13:18 ` Paul Eggert [this message]
2015-07-29 16:24 ` Eli Zaretskii
2015-07-29 16:48 ` Paul Eggert
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=55B8D299.9010704@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=dancol@dancol.org \
--cc=eliz@gnu.org \
--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).