diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | thread_pthread.c | 8 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 15 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Tue Apr 28 14:14:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * thread_pthread.c (reserve_stack): keep sp safe zone to get rid + of crash by -fstack-check. [ruby-core:68740] [Bug #11030] + Fri Apr 24 17:27:31 2015 Koichi Sasada <ko1@atdot.net> * test/fiddle/test_handle.rb: fix syntax. diff --git a/thread_pthread.c b/thread_pthread.c index f3cd8702f8..ed4880c40c 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -657,11 +657,16 @@ reserve_stack(volatile char *limit, size_t size) # endif struct rlimit rl; volatile char buf[0x100]; + enum {stack_check_margin = 0x1000}; /* for -fstack-check */ + STACK_GROW_DIR_DETECTION; if (!getrlimit(RLIMIT_STACK, &rl) && rl.rlim_cur == RLIM_INFINITY) return; + if (size < stack_check_margin) return; + size -= stack_check_margin; + size -= sizeof(buf); /* margin */ if (IS_STACK_DIR_UPPER()) { const volatile char *end = buf + sizeof(buf); @@ -669,13 +674,14 @@ reserve_stack(volatile char *limit, size_t size) if (limit > end) { size = limit - end; limit = alloca(size); - limit[size-1] = 0; + limit[stack_check_margin+size-1] = 0; } } else { limit -= size; if (buf > limit) { limit = alloca(buf - limit); + limit -= stack_check_margin; limit[0] = 0; } } @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.7" -#define RUBY_RELEASE_DATE "2015-04-24" -#define RUBY_PATCHLEVEL 338 +#define RUBY_RELEASE_DATE "2015-04-28" +#define RUBY_PATCHLEVEL 339 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 24 +#define RUBY_RELEASE_DAY 28 #include "ruby/version.h" |