summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 12:07:49 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 12:07:49 +0000
commitbcccff509d38fb162abda41df232e8f4f15821e9 (patch)
tree8c45e3d302fa2da196b163813983541713a460b7
parentd525dbd0d5ea6bdfe813a38cb6da4ae828b74c09 (diff)
merge revision(s) 54256: [Backport #12118] [Backport #12218]
* thread_pthread.c (reserve_stack): fix reserving position where the stack growing bottom to top. [Bug #12118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--thread_pthread.c26
-rw-r--r--version.h6
3 files changed, 28 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 64a390e9b9..9d124da903 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Mar 29 21:07:30 2016 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (reserve_stack): fix reserving position where
+ the stack growing bottom to top. [Bug #12118]
+
Fri Mar 25 18:42:46 2016 Koichi ITO <koic.ito@gmail.com>
* variable.c: Added documentation about order of `Module#constants`
diff --git a/thread_pthread.c b/thread_pthread.c
index 47e94156e1..31098ed4ed 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -675,17 +675,31 @@ reserve_stack(volatile char *limit, size_t size)
const volatile char *end = buf + sizeof(buf);
limit += size;
if (limit > end) {
- size = limit - end;
- limit = alloca(size);
- limit[stack_check_margin+size-1] = 0;
+ /* |<-bottom (=limit(a)) top->|
+ * | .. |<-buf 256B |<-end | stack check |
+ * | 256B | =size= | margin (4KB)|
+ * | =size= limit(b)->| 256B | |
+ * | | alloca(sz) | | |
+ * | .. |<-buf |<-limit(c) [sz-1]->0> | |
+ */
+ size_t sz = limit - end;
+ limit = alloca(sz);
+ limit[sz-1] = 0;
}
}
else {
limit -= size;
if (buf > limit) {
- limit = alloca(buf - limit);
- limit[0] = 0; /* ensure alloca is called */
- limit -= stack_check_margin;
+ /* |<-top (=limit(a)) bottom->|
+ * | .. | 256B buf->| | stack check |
+ * | 256B | =size= | margin (4KB)|
+ * | =size= limit(b)->| 256B | |
+ * | | alloca(sz) | | |
+ * | .. | buf->| limit(c)-><0> | |
+ */
+ size_t sz = buf - limit;
+ limit = alloca(sz);
+ limit[0] = 0;
}
}
}
diff --git a/version.h b/version.h
index 6780a2ae89..d4acd19748 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.9"
-#define RUBY_RELEASE_DATE "2016-03-26"
-#define RUBY_PATCHLEVEL 486
+#define RUBY_RELEASE_DATE "2016-03-29"
+#define RUBY_PATCHLEVEL 487
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 29
#include "ruby/version.h"