[前][次][番号順一覧][スレッド一覧]

ruby-changes:38403

From: nagachika <ko1@a...>
Date: Thu, 14 May 2015 00:28:29 +0900 (JST)
Subject: [ruby-changes:38403] nagachika:r50484 (ruby_2_2): merge revision(s) 50316: [Backport #11030]

nagachika	2015-05-14 00:28:06 +0900 (Thu, 14 May 2015)

  New Revision: 50484

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50484

  Log:
    merge revision(s) 50316: [Backport #11030]
    
    * thread_pthread.c (reserve_stack): keep sp safe zone to get rid
      of crash by -fstack-check.  [ruby-core:68740] [Bug #11030]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/thread_pthread.c
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 50483)
+++ ruby_2_2/ChangeLog	(revision 50484)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Thu May 14 00:19:04 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* thread_pthread.c (reserve_stack): keep sp safe zone to get rid
+	  of crash by -fstack-check.  [ruby-core:68740] [Bug #11030]
+
 Tue Apr 14 23:33:39 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in: check also procstat_getvmmap, which is not
Index: ruby_2_2/thread_pthread.c
===================================================================
--- ruby_2_2/thread_pthread.c	(revision 50483)
+++ ruby_2_2/thread_pthread.c	(revision 50484)
@@ -662,11 +662,16 @@ reserve_stack(volatile char *limit, size https://github.com/ruby/ruby/blob/trunk/ruby_2_2/thread_pthread.c#L662
 # 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);
@@ -674,13 +679,14 @@ reserve_stack(volatile char *limit, size https://github.com/ruby/ruby/blob/trunk/ruby_2_2/thread_pthread.c#L679
 	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;
 	}
     }
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 50483)
+++ ruby_2_2/version.h	(revision 50484)
@@ -1,9 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
-#define RUBY_RELEASE_DATE "2015-04-14"
-#define RUBY_PATCHLEVEL 97
+#define RUBY_RELEASE_DATE "2015-05-14"
+#define RUBY_PATCHLEVEL 98
 
 #define RUBY_RELEASE_YEAR 2015
-#define RUBY_RELEASE_MONTH 4
+#define RUBY_RELEASE_MONTH 5
 #define RUBY_RELEASE_DAY 14
 
 #include "ruby/version.h"

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50316


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]