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

ruby-changes:27602

From: nagachika <ko1@a...>
Date: Sat, 9 Mar 2013 21:35:10 +0900 (JST)
Subject: [ruby-changes:27602] nagachika:r39654 (ruby_2_0_0): merge revision(s) 39354,39356,39382: [Backport #5014]

nagachika	2013-03-09 21:33:26 +0900 (Sat, 09 Mar 2013)

  New Revision: 39654

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

  Log:
    merge revision(s) 39354,39356,39382: [Backport #5014]
    
    * signal.c (sigsegv): avoid to use async signal unsafe functions
      when nested sigsegv is happen.
      [Bug #5014] [ruby-dev:44082]
    
    * signal.c (check_stack_overflow): extract duplicated code and get rid
      of declaration-after-statement.  [Bug #5014]
    
    * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/signal.c
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 39653)
+++ ruby_2_0_0/ChangeLog	(revision 39654)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Mar  9 21:29:45 2013  Naohisa Goto  <ngotogenome@g...>
+
+	* signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
+
+Sat Mar  9 21:29:45 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* signal.c (check_stack_overflow): extract duplicated code and get rid
+	  of declaration-after-statement.  [Bug #5014]
+
+Sat Mar  9 21:29:45 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* signal.c (sigsegv): avoid to use async signal unsafe functions
+	  when nested sigsegv is happen.
+	  [Bug #5014] [ruby-dev:44082]
+
 Sat Mar  9 21:25:45 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* file.c (rb_group_member): added an error check. SUS says,
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 39653)
+++ ruby_2_0_0/version.h	(revision 39654)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-03-09"
-#define RUBY_PATCHLEVEL 23
+#define RUBY_PATCHLEVEL 24
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_0_0/signal.c
===================================================================
--- ruby_2_0_0/signal.c	(revision 39653)
+++ ruby_2_0_0/signal.c	(revision 39654)
@@ -604,6 +604,23 @@ rb_get_next_signal(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/signal.c#L604
     return sig;
 }
 
+
+#ifdef USE_SIGALTSTACK
+static void
+check_stack_overflow(const void *addr)
+{
+    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
+    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
+    rb_thread_t *th = GET_THREAD();
+    if (ruby_stack_overflowed_p(th, addr)) {
+	ruby_thread_stack_overflow(th);
+    }
+}
+#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr)
+#else
+#define CHECK_STACK_OVERFLOW() (void)0
+#endif
+
 #ifdef SIGBUS
 static RETSIGTYPE
 sigbus(int sig SIGINFO_ARG)
@@ -613,41 +630,44 @@ sigbus(int sig SIGINFO_ARG) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/signal.c#L630
  * and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
  * wrong IMHO. but anyway we have to care it. Sigh.
  */
-#if defined __APPLE__ && defined USE_SIGALTSTACK
-    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
-    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
-    rb_thread_t *th = GET_THREAD();
-    if (ruby_stack_overflowed_p(th, info->si_addr)) {
-	ruby_thread_stack_overflow(th);
-    }
+#if defined __APPLE__
+    CHECK_STACK_OVERFLOW();
 #endif
     rb_bug("Bus Error");
 }
 #endif
 
 #ifdef SIGSEGV
+static void ruby_abort(void)
+{
+#ifdef __sun
+    /* Solaris's abort() is async signal unsafe. Of course, it is not
+     *  POSIX compliant.
+     */
+    raise(SIGABRT);
+#else
+    abort();
+#endif
+
+}
+
 static int segv_received = 0;
+extern int ruby_disable_gc_stress;
+
 static RETSIGTYPE
 sigsegv(int sig SIGINFO_ARG)
 {
-#ifdef USE_SIGALTSTACK
-    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
-    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
-    rb_thread_t *th = GET_THREAD();
-    if (ruby_stack_overflowed_p(th, info->si_addr)) {
-	ruby_thread_stack_overflow(th);
-    }
-#endif
     if (segv_received) {
-	fprintf(stderr, "SEGV received in SEGV handler\n");
-	abort();
-    }
-    else {
-	extern int ruby_disable_gc_stress;
-	segv_received = 1;
-	ruby_disable_gc_stress = 1;
-	rb_bug("Segmentation fault");
+	char msg[] = "SEGV received in SEGV handler\n";
+	write(2, msg, sizeof(msg));
+	ruby_abort();
     }
+
+    CHECK_STACK_OVERFLOW();
+
+    segv_received = 1;
+    ruby_disable_gc_stress = 1;
+    rb_bug("Segmentation fault");
 }
 #endif
 

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39354,39356,39382


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

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