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

ruby-changes:42356

From: nagachika <ko1@a...>
Date: Wed, 30 Mar 2016 06:19:41 +0900 (JST)
Subject: [ruby-changes:42356] nagachika:r54430 (ruby_2_2): merge revision(s) 54256: [Backport #12118]

nagachika	2016-03-30 06:19:35 +0900 (Wed, 30 Mar 2016)

  New Revision: 54430

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

  Log:
    merge revision(s) 54256: [Backport #12118]
    
    * thread_pthread.c (reserve_stack): fix reserving position where
      the stack growing bottom to top. [Bug #12118]

  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/version.h
===================================================================
--- ruby_2_2/version.h	(revision 54429)
+++ ruby_2_2/version.h	(revision 54430)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.5"
 #define RUBY_RELEASE_DATE "2016-03-30"
-#define RUBY_PATCHLEVEL 288
+#define RUBY_PATCHLEVEL 289
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_2/thread_pthread.c
===================================================================
--- ruby_2_2/thread_pthread.c	(revision 54429)
+++ ruby_2_2/thread_pthread.c	(revision 54430)
@@ -680,17 +680,31 @@ reserve_stack(volatile char *limit, size https://github.com/ruby/ruby/blob/trunk/ruby_2_2/thread_pthread.c#L680
 	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;
 	}
     }
 }
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 54429)
+++ ruby_2_2/ChangeLog	(revision 54430)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed Mar 30 06:11:36 2016  NARUSE, Yui  <naruse@r...>
+
+	* 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@r...>
 
 	* .travis.yml: removed commented-out code.

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


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

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