ruby-changes:50568
From: nagachika <ko1@a...>
Date: Sat, 10 Mar 2018 11:46:56 +0900 (JST)
Subject: [ruby-changes:50568] nagachika:r62712 (ruby_2_4): merge revision(s) 60384: [Backport #13887]
nagachika 2018-03-10 11:46:51 +0900 (Sat, 10 Mar 2018) New Revision: 62712 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62712 Log: merge revision(s) 60384: [Backport #13887] thread_pthread: do not corrupt stack This fixes stuck test/ruby/test_io.rb with FIBER_USE_NATIVE=0 on GNU/Linux because linked-list pointers used by glibc get corrupted when fiber stacks are copied. Thanks to wanabe for finding the bug and original patch. * thread_pthread (native_thread_init_stack): fix stack corruption [ruby-core:82737] [Bug #13387] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/thread_pthread.c branches/ruby_2_4/version.h Index: ruby_2_4/thread_pthread.c =================================================================== --- ruby_2_4/thread_pthread.c (revision 62711) +++ ruby_2_4/thread_pthread.c (revision 62712) @@ -841,8 +841,9 @@ native_thread_init_stack(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_4/thread_pthread.c#L841 size_t size; if (get_stack(&start, &size) == 0) { - th->machine.stack_start = start; - th->machine.stack_maxsize = size; + uintptr_t diff = (uintptr_t)start - (uintptr_t)&curr; + th->machine.stack_start = (VALUE *)&curr; + th->machine.stack_maxsize = size - diff; } #elif defined get_stack_of if (!th->machine.stack_maxsize) { Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 62711) +++ ruby_2_4/version.h (revision 62712) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2018-03-10" -#define RUBY_PATCHLEVEL 257 +#define RUBY_PATCHLEVEL 258 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 62711) +++ ruby_2_4 (revision 62712) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r60384 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/