Skip to content

Commit bcccff5

Browse files
committed
merge revision(s) 54256: [Backport ruby#12118] [Backport ruby#12218]
* thread_pthread.c (reserve_stack): fix reserving position where the stack growing bottom to top. [Bug ruby#12118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d525dbd commit bcccff5

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Tue Mar 29 21:07:30 2016 NARUSE, Yui <naruse@ruby-lang.org>
2+
3+
* thread_pthread.c (reserve_stack): fix reserving position where
4+
the stack growing bottom to top. [Bug #12118]
5+
16
Fri Mar 25 18:42:46 2016 Koichi ITO <koic.ito@gmail.com>
27

38
* variable.c: Added documentation about order of `Module#constants`

thread_pthread.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,17 +675,31 @@ reserve_stack(volatile char *limit, size_t size)
675675
const volatile char *end = buf + sizeof(buf);
676676
limit += size;
677677
if (limit > end) {
678-
size = limit - end;
679-
limit = alloca(size);
680-
limit[stack_check_margin+size-1] = 0;
678+
/* |<-bottom (=limit(a)) top->|
679+
* | .. |<-buf 256B |<-end | stack check |
680+
* | 256B | =size= | margin (4KB)|
681+
* | =size= limit(b)->| 256B | |
682+
* | | alloca(sz) | | |
683+
* | .. |<-buf |<-limit(c) [sz-1]->0> | |
684+
*/
685+
size_t sz = limit - end;
686+
limit = alloca(sz);
687+
limit[sz-1] = 0;
681688
}
682689
}
683690
else {
684691
limit -= size;
685692
if (buf > limit) {
686-
limit = alloca(buf - limit);
687-
limit[0] = 0; /* ensure alloca is called */
688-
limit -= stack_check_margin;
693+
/* |<-top (=limit(a)) bottom->|
694+
* | .. | 256B buf->| | stack check |
695+
* | 256B | =size= | margin (4KB)|
696+
* | =size= limit(b)->| 256B | |
697+
* | | alloca(sz) | | |
698+
* | .. | buf->| limit(c)-><0> | |
699+
*/
700+
size_t sz = buf - limit;
701+
limit = alloca(sz);
702+
limit[0] = 0;
689703
}
690704
}
691705
}

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.1.9"
2-
#define RUBY_RELEASE_DATE "2016-03-26"
3-
#define RUBY_PATCHLEVEL 486
2+
#define RUBY_RELEASE_DATE "2016-03-29"
3+
#define RUBY_PATCHLEVEL 487
44

55
#define RUBY_RELEASE_YEAR 2016
66
#define RUBY_RELEASE_MONTH 3
7-
#define RUBY_RELEASE_DAY 26
7+
#define RUBY_RELEASE_DAY 29
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)