merge revision(s) 54256: [Backport #12118]

* 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_2@54430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2016-03-29 21:19:35 +00:00
parent 3f7ce08537
commit 2725eed1dc
3 changed files with 26 additions and 7 deletions

View file

@ -1,3 +1,8 @@
Wed Mar 30 06:11:36 2016 NARUSE, Yui <naruse@ruby-lang.org>
* thread_pthread.c (reserve_stack): fix reserving position where
the stack growing bottom to top. [Bug #12118]
Wed Mar 30 06:04:18 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org> Wed Mar 30 06:04:18 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* .travis.yml: removed commented-out code. * .travis.yml: removed commented-out code.

View file

@ -680,17 +680,31 @@ reserve_stack(volatile char *limit, size_t size)
const volatile char *end = buf + sizeof(buf); const volatile char *end = buf + sizeof(buf);
limit += size; limit += size;
if (limit > end) { if (limit > end) {
size = limit - end; /* |<-bottom (=limit(a)) top->|
limit = alloca(size); * | .. |<-buf 256B |<-end | stack check |
limit[stack_check_margin+size-1] = 0; * | 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 { else {
limit -= size; limit -= size;
if (buf > limit) { if (buf > limit) {
limit = alloca(buf - limit); /* |<-top (=limit(a)) bottom->|
limit[0] = 0; /* ensure alloca is called */ * | .. | 256B buf->| | stack check |
limit -= stack_check_margin; * | 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;
} }
} }
} }

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.5" #define RUBY_VERSION "2.2.5"
#define RUBY_RELEASE_DATE "2016-03-30" #define RUBY_RELEASE_DATE "2016-03-30"
#define RUBY_PATCHLEVEL 288 #define RUBY_PATCHLEVEL 289
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3 #define RUBY_RELEASE_MONTH 3