From: Daniel Colascione <dancol@dancol.org>
To: Paul Eggert <eggert@cs.ucla.edu>, Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org
Subject: Re: Two issues with stack overflow protection
Date: Tue, 28 Jul 2015 23:10:45 -0700 [thread overview]
Message-ID: <55B86E65.6030000@dancol.org> (raw)
In-Reply-To: <55B85E43.6050306@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
On 07/28/2015 10:01 PM, Paul Eggert wrote:
> Eli Zaretskii wrote:
>> The implementation of stack_overflow on sysdep.c was recently changed
>> so as not to use sys/resource.h and getrlimit, but configure.ac still
>> insists on these two features in order to include the recovery code,
>> which I think should be fixed.
>
> Thanks, fixed with the attached patch.
>
>> More importantly, the recovery simply longjmps to command_loop,
>> whereas similar features like Fthrow and Fsignal do much more in
>> unwind_to_catch. Shouldn't stack overflow recovery do that as well?
>> Otherwise, the specpdl stack, byte_stack_list, lisp_eval_depth
>> etc. all stay at their values they had at stack overflow time, no?
>
> No, they are cleared back to top-level values, because when
> command_loop's call to sigsetjmp returns nonzero, it then calls
> init_eval and this resets them.
>
> There is a problem that the speclpdl stack's unwind-protect and
> dynamic-let-bindings are unceremoniously discarded on stack overflow. I
> suppose that should get fixed, though it may be a bit tricky to avoid
> looping.
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?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-07-29 6:10 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 [this message]
2015-07-29 7:06 ` Paul Eggert
2015-07-29 11:27 ` Daniel Colascione
2015-07-29 13:18 ` Paul Eggert
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=55B86E65.6030000@dancol.org \
--to=dancol@dancol.org \
--cc=eggert@cs.ucla.edu \
--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).