summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-10 02:46:51 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-10 02:46:51 +0000
commit12fc812978a0d2cfbf4a40e392231303344ae68e (patch)
treeac6719b3cdab427bc9a0f28c9c0b7c62e083e5ef
parent3c35067cfc20c510f26d16466015d2195736801b (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_4@62712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--thread_pthread.c5
-rw-r--r--version.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 87d9220ea9..5295a52f28 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -841,8 +841,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) {
diff --git a/version.h b/version.h
index cca1ed4efa..dcd5c8ffb6 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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