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

ruby-changes:50662

From: usa <ko1@a...>
Date: Mon, 19 Mar 2018 00:27:38 +0900 (JST)
Subject: [ruby-changes:50662] usa:r62825 (ruby_2_3): merge revision(s) 60384: [Backport #13887]

usa	2018-03-19 00:27:34 +0900 (Mon, 19 Mar 2018)

  New Revision: 62825

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

  Log:
    merge revision(s) 60384: [Backport #13887]
    
    thread_pthread: do not corrupt stack
    
    This fixes stuck test/ruby/test_io.rb with FIBER_USE_NATIVE=0 on
    GNU/Linux because linked-list pointers used by glibc get
    corrupted when fiber stacks are copied.
    
    Thanks to wanabe for finding the bug and original patch.
    
    * thread_pthread (native_thread_init_stack): fix stack corruption
      [ruby-core:82737] [Bug #13387]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/thread_pthread.c
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62824)
+++ ruby_2_3/ChangeLog	(revision 62825)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Mar 19 00:27:06 2018  Koichi Sasada  <ko1@a...>
+
+	thread_pthread: do not corrupt stack
+
+	This fixes stuck test/ruby/test_io.rb with FIBER_USE_NATIVE=0 on
+	GNU/Linux because linked-list pointers used by glibc get
+	corrupted when fiber stacks are copied.
+
+	Thanks to wanabe for finding the bug and original patch.
+
+	* thread_pthread (native_thread_init_stack): fix stack corruption
+	  [Bug #13387]
+
 Mon Mar 19 00:22:52 2018  Marc-Andre Lafortune  <ruby-core@m...>
 
 	TracePoint#enable, #disable: Don't yield any argument. [Bug #14057]
Index: ruby_2_3/thread_pthread.c
===================================================================
--- ruby_2_3/thread_pthread.c	(revision 62824)
+++ ruby_2_3/thread_pthread.c	(revision 62825)
@@ -836,8 +836,9 @@ native_thread_init_stack(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_3/thread_pthread.c#L836
 	size_t size;
 
 	if (get_stack(&start, &size) == 0) {
-	    th->machine.stack_start = start;
-	    th->machine.stack_maxsize = size;
+	    uintptr_t diff = (uintptr_t)start - (uintptr_t)&curr;
+	    th->machine.stack_start = (VALUE *)&curr;
+	    th->machine.stack_maxsize = size - diff;
 	}
 #elif defined get_stack_of
 	if (!th->machine.stack_maxsize) {
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62824)
+++ ruby_2_3/version.h	(revision 62825)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-03-19"
-#define RUBY_PATCHLEVEL 425
+#define RUBY_PATCHLEVEL 426
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62824)
+++ ruby_2_3	(revision 62825)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r60384

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

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