ruby-changes:35515
From: nagachika <ko1@a...>
Date: Mon, 15 Sep 2014 23:23:23 +0900 (JST)
Subject: [ruby-changes:35515] nagachika:r47597 (ruby_2_1): merge revision(s) r46495, r46499: [Backport #9971]
nagachika 2014-09-15 23:23:13 +0900 (Mon, 15 Sep 2014) New Revision: 47597 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47597 Log: merge revision(s) r46495,r46499: [Backport #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 #9971] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/signal.c branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 47596) +++ ruby_2_1/ChangeLog (revision 47597) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Sep 15 23:12:47 2014 Nobuyoshi Nakada <nobu@r...> + + * signal.c (check_stack_overflow): drop the last tag too close to + the fault page, to get rid of stack overflow deadlock. + [Bug #9971] + Mon Sep 15 22:34:39 2014 Natalie Weizenbaum <nweiz@g...> * ext/pathname/lib/pathname.rb (SAME_PATHS): Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 47596) +++ ruby_2_1/version.h (revision 47597) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-09-15" -#define RUBY_PATCHLEVEL 240 +#define RUBY_PATCHLEVEL 241 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_1/signal.c =================================================================== --- ruby_2_1/signal.c (revision 47596) +++ ruby_2_1/signal.c (revision 47597) @@ -711,7 +711,14 @@ check_stack_overflow(const uintptr_t add https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L711 /* SP in ucontext is not decremented yet when `push` failed, so * the fault page can be the next. */ if (sp_page == fault_page || sp_page == fault_page + 1) { - ruby_thread_stack_overflow(GET_THREAD()); + 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); } } #else @@ -719,7 +726,7 @@ static void https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L726 check_stack_overflow(const void *addr) { int ruby_stack_overflowed_p(const rb_thread_t *, const void *); - rb_thread_t *th = GET_THREAD(); + rb_thread_t *th = ruby_current_thread; if (ruby_stack_overflowed_p(th, addr)) { ruby_thread_stack_overflow(th); } Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46495,46499 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/