diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-18 15:27:34 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-18 15:27:34 +0000 |
commit | ca310ba6f7a37d43ab977429081747bed44816e5 (patch) | |
tree | d2051fad9a1a01fb38501a376a0c4ed51a940e5e | |
parent | e9a9f674fb90266e7c6e2c1338883d2ea35142cc (diff) |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | thread_pthread.c | 5 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,16 @@ +Mon Mar 19 00:27:06 2018 Koichi Sasada <ko1@atdot.net> + + 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 + [Bug #13387] + Mon Mar 19 00:22:52 2018 Marc-Andre Lafortune <ruby-core@marc-andre.ca> TracePoint#enable, #disable: Don't yield any argument. [Bug #14057] diff --git a/thread_pthread.c b/thread_pthread.c index 58648975c9..91e6fcc925 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -836,8 +836,9 @@ native_thread_init_stack(rb_thread_t *th) 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) { @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-03-19" -#define RUBY_PATCHLEVEL 425 +#define RUBY_PATCHLEVEL 426 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 |