[Mono-bugs] [Bug 52226][Maj] New - Fix for signal handling wrt NetBSD in libgc

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 16 Dec 2003 06:05:21 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by recht@netbsd.org.

http://bugzilla.ximian.com/show_bug.cgi?id=52226

--- shadow/52226	2003-12-16 06:05:21.000000000 -0500
+++ shadow/52226.tmp.1482	2003-12-16 06:05:21.000000000 -0500
@@ -0,0 +1,119 @@
+Bug#: 52226
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: NetBSD-current
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: recht@netbsd.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Fix for signal handling wrt NetBSD in libgc
+
+Description of Problem:
+The following patch is from another NetBSD developer (Christian Limpach
+<chris@pin.lu>). I only additionally turned of pthreads in libgc for NetBSD. 
+It fixes an endless loop caused by a longjmp out of the signal handler and
+which leaves a wrong signal mask for the thread.
+
+This patch has been integrated by Hans Boehm (in a more generalized way)
+and will be in the next alpha of boehm-gc. But since it isn't released yet
+it hasn't been tested on NetBSD-current yet. Because of that I recommend
+adding this patch first and use Hans Boehm's libgc will be synced with
+boehm-gc.
+
+Steps to reproduce the problem:
+run mono on NetBSD-current
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen? 
+everytime
+
+Additional Information:
+
+diff -ur mono-0.29.orig/configure mono-0.29/configure
+--- mono-0.29.orig/configure  2003-11-30 13:29:59.000000000 +0100
++++ mono-0.29/configure 2003-12-16 11:52:23.000000000 +0100
+@@ -1989,7 +1989,7 @@
+ _ACEOF
+ 
+      libdl=
+-     libgc_threads=pthreads
++     libgc_threads=no
+      ;;
+   *-*-*freebsd*|*-*-*openbsd*)
+      platform_win32=no
+Only in mono-0.29: configure~
+diff -ur mono-0.29.orig/libgc/os_dep.c mono-0.29/libgc/os_dep.c
+--- mono-0.29.orig/libgc/os_dep.c   2003-08-27 16:20:46.000000000 +0200
++++ mono-0.29/libgc/os_dep.c  2003-12-16 11:52:01.000000000 +0100
+@@ -121,7 +121,7 @@
+ # include <fcntl.h>
+ #endif
+ 
+-#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX)
++#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX) || defined(NETBSD)
+ # ifdef SUNOS5SIGS
+ #  include <sys/siginfo.h>
+ # endif
+@@ -688,9 +688,11 @@
+   typedef void (*handler)();
+ #   endif
+ 
+-#   if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) || defined(HURD)
++#   if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
++    || defined(HURD) || defined(NETBSD)
+   static struct sigaction old_segv_act;
+-# if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) || defined(HURD)
++# if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
++  || defined(HURD) || defined(NETBSD)
+       static struct sigaction old_bus_act;
+ # endif
+ #   else
+@@ -705,11 +707,11 @@
+ #   endif
+     {
+ # if defined(SUNOS5SIGS) || defined(IRIX5)  \
+-        || defined(OSF1) || defined(HURD)
++        || defined(OSF1) || defined(HURD) || defined(NETBSD)
+     struct sigaction   act;
+ 
+     act.sa_handler  = h;
+-#   ifdef SUNOS5SIGS
++#   if defined(SUNOS5SIGS) || defined(NETBSD)
+             act.sa_flags          = SA_RESTART | SA_NODEFER;
+ #         else
+             act.sa_flags          = SA_RESTART;
+@@ -729,7 +731,7 @@
+ #   else
+           (void) sigaction(SIGSEGV, &act, &old_segv_act);
+ #    if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
+-        || defined(HPUX) || defined(HURD)
++        || defined(HPUX) || defined(HURD) || defined(NETBSD)
+          /* Under Irix 5.x or HP/UX, we may get SIGBUS. */
+          /* Pthreads doesn't exist under Irix 5.x, so we   */
+          /* don't have to worry in the threads case.    */
+@@ -765,10 +767,10 @@
+     void GC_reset_fault_handler()
+     {
+ #       if defined(SUNOS5SIGS) || defined(IRIX5) \
+-     || defined(OSF1) || defined(HURD)
++     || defined(OSF1) || defined(HURD) || defined(NETBSD)
+     (void) sigaction(SIGSEGV, &old_segv_act, 0);
+ #   if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
+-       || defined(HPUX) || defined(HURD)
++       || defined(HPUX) || defined(HURD) || defined(NETBSD)
+         (void) sigaction(SIGBUS, &old_bus_act, 0);
+ #   endif
+ #       else