summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 02:11:31 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 02:11:31 (GMT)
commit2bd9a198952800b81d47fa63db941aacdf1867cf (patch)
treef5bab868eef9afa5a683518e3bdd83b8393a077b /signal.c
parent2af4240fbb4f91dba2acee02e83d5f05627084fd (diff)
signal.c: drop dangerous tag
* signal.c (check_stack_overflow): drop the last tag too close to the fault page, to get rid of stack overflow deadlock. [Bug #9971] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 1833639..f49bd2a 100644
--- a/signal.c
+++ b/signal.c
@@ -738,6 +738,12 @@ check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
* the fault page can be the next. */
if (sp_page == fault_page || sp_page == fault_page + 1) {
rb_thread_t *th = ruby_current_thread;
+ if ((uintptr_t)th->tag->buf / pagesize == sp_page) {
+ /* drop the last tag if it is close to the fault,
+ * otherwise it can cause stack overflow again at the same
+ * place. */
+ th->tag = th->tag->prev;
+ }
ruby_thread_stack_overflow(th);
}
}