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

ruby-changes:36746

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 18:02:10 +0900 (JST)
Subject: [ruby-changes:36746] nobu:r48827 (trunk): signal.c: stack overflow on FreeBSD

nobu	2014-12-13 18:01:59 +0900 (Sat, 13 Dec 2014)

  New Revision: 48827

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

  Log:
    signal.c: stack overflow on FreeBSD
    
    * signal.c (check_stack_overflow): check sp also on i386/x86_64
      FreeBSD.

  Modified files:
    trunk/ChangeLog
    trunk/signal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48826)
+++ ChangeLog	(revision 48827)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Dec 13 18:01:57 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* signal.c (check_stack_overflow): check sp also on i386/x86_64
+	  FreeBSD.
+
 Sat Dec 13 09:58:41 2014  Eric Wong  <e@8...>
 
 	* gc.c (define_final0): avoid duplicate blocks
Index: signal.c
===================================================================
--- signal.c	(revision 48826)
+++ signal.c	(revision 48827)
@@ -732,11 +732,13 @@ rb_get_next_signal(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L732
 
 #if defined(USE_SIGALTSTACK) || defined(_WIN32)
 NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
-# if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__))
+# if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
 # elif defined __linux__
 #   define USE_UCONTEXT_REG 1
 # elif defined __APPLE__
 #   define USE_UCONTEXT_REG 1
+# elif defined __FreeBSD__
+#   define USE_UCONTEXT_REG 1
 # endif
 # ifdef USE_UCONTEXT_REG
 static void
@@ -755,6 +757,12 @@ check_stack_overflow(const uintptr_t add https://github.com/ruby/ruby/blob/trunk/signal.c#L757
 #   else
     const uintptr_t sp = mctx->__ss.__esp;
 #   endif
+# elif defined __FreeBSD__
+#   if defined(__amd64__)
+    const __register_t sp = mctx->mc_rsp;
+#   else
+    const __register_t sp = mctx->mc_esp;
+#   endif
 # endif
     enum {pagesize = 4096};
     const uintptr_t sp_page = (uintptr_t)sp / pagesize;

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

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