Skip to content

Commit f5c3ada

Browse files
committed
merge revision(s) r46495,r46499: [Backport ruby#9971]
signal.c: no cfunc frame at stack overflow * signal.c (check_stack_overflow): avoid pushing a cfunc frame, trying to fix stack overflow deadlock. * signal.c (check_stack_overflow): drop the last tag too close to the fault page, to get rid of stack overflow deadlock. [Bug ruby#9971] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 4ad1bd4 commit f5c3ada

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Mon Sep 15 23:12:47 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* signal.c (check_stack_overflow): drop the last tag too close to
4+
the fault page, to get rid of stack overflow deadlock.
5+
[Bug #9971]
6+
17
Mon Sep 15 22:34:39 2014 Natalie Weizenbaum <[email protected]>
28

39
* ext/pathname/lib/pathname.rb (SAME_PATHS):

signal.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,22 @@ check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
711711
/* SP in ucontext is not decremented yet when `push` failed, so
712712
* the fault page can be the next. */
713713
if (sp_page == fault_page || sp_page == fault_page + 1) {
714-
ruby_thread_stack_overflow(GET_THREAD());
714+
rb_thread_t *th = ruby_current_thread;
715+
if ((uintptr_t)th->tag->buf / pagesize == sp_page) {
716+
/* drop the last tag if it is close to the fault,
717+
* otherwise it can cause stack overflow again at the same
718+
* place. */
719+
th->tag = th->tag->prev;
720+
}
721+
ruby_thread_stack_overflow(th);
715722
}
716723
}
717724
#else
718725
static void
719726
check_stack_overflow(const void *addr)
720727
{
721728
int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
722-
rb_thread_t *th = GET_THREAD();
729+
rb_thread_t *th = ruby_current_thread;
723730
if (ruby_stack_overflowed_p(th, addr)) {
724731
ruby_thread_stack_overflow(th);
725732
}

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-09-15"
3-
#define RUBY_PATCHLEVEL 240
3+
#define RUBY_PATCHLEVEL 241
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 9

0 commit comments

Comments
 (0)