From: Paul Eggert <eggert@cs.ucla.edu>
To: Dmitry Antipov <dmantipov@yandex.ru>,
Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: [RFC] sigaltstack + longjmp to protect from C stack overflow
Date: Mon, 25 Aug 2014 08:06:09 -0700 [thread overview]
Message-ID: <53FB50E1.1040006@cs.ucla.edu> (raw)
In-Reply-To: <53FB4C3A.9050407@yandex.ru>
Thanks for looking into this. A few comments:
'handle_sigsegv' tries to guess direction of stack growth, but shouldn't
stack growth direction be determined at startup? That should be more
reliable than guessing from what may be a stray pointer reference.
init_signals need not use xmalloc to allocate the alternate stack, since
it's of fixed size and Emacs always needs it. We should be able to
allocate the stack statically.
sys/resource.h is not available everywhere; include it only if
HAVE_SYS_RESOURCE_H is defined. Similarly, use struct rlimit and
getrlimit only if HAVE_GETRLIMIT is defined, and use sigaltstack only if
HAVE_SIGALTSTACK is defined (you'll need to modify configure.ac for
that). And the code should do the right thing (i.e., stick with
thread_fatal_action instead of sigsegv_action) if SA_SIGINFO and/or
SA_ONSTACK are not defined. Come to think of it, check for all the
above issues and do the sigsegv_action stuff only if all the macros
check out.
There's no need to abort if sigaltstack fails. Just let Emacs go on as
it does now, and use thread_fatal_action.
prev parent reply other threads:[~2014-08-25 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 14:46 [RFC] sigaltstack + longjmp to protect from C stack overflow Dmitry Antipov
2014-08-25 15:06 ` Paul Eggert [this message]
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=53FB50E1.1040006@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 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.