[Mono-bugs] [Bug 77309][Maj] Changed - mono_jit_init called from non-main thread segfaults

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 19 16:33:17 EST 2006


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 horst.reiterer at mind-breeze.com.

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

--- shadow/77309	2006-01-19 16:29:42.000000000 -0500
+++ shadow/77309.tmp.3162	2006-01-19 16:33:17.000000000 -0500
@@ -2,13 +2,13 @@
 Product: Mono: Runtime
 Version: 1.1
 OS: other
 OS Details: Red Hat Enterprise Linux 4 (x86)
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Major
 Component: GC
 AssignedTo: lupus at ximian.com                            
 ReportedBy: horst.reiterer at mind-breeze.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -50,6 +50,48 @@
 
 Would you accept a fix along these lines? If yes, I'd be more than happy to
 prepare a production-ready patch that is valid for both NPTL and
 LinuxThreads. IMHO, it should be possible for a host to initialize Mono at
 any point-in-time, from any thread. Being able to do so means that the
 runtime can be initialized in a lazy manner.
+
+------- Additional Comments From horst.reiterer at mind-breeze.com  2006-01-19 16:33 -------
+The following patch works but is valid for NPTL only. I'd be more than
+happy to prepare a production-ready patch that is valid for both NPTL
+and LinuxThreads if I know whether or not you would accept it.
+
+--- mono-1.1.12.1/libgc/pthread_stop_world.c    2006-01-18
+14:13:18.979146129 +0100
++++ mono-1.1.12.1-dev/libgc/pthread_stop_world.c        2006-01-18
+14:12:50.586736171 +0100
+@@ -9,6 +9,9 @@
+ #include <errno.h>
+ #include <unistd.h>
+
++#include <linux/unistd.h>
++_syscall0(pid_t,gettid)
++
+ #if DEBUG_THREADS
+
+ #ifndef NSIG
+@@ -249,9 +252,18 @@
+             hi = p -> stack_end;
+             IF_IA64(bs_lo = p -> backing_store_end);
+         } else {
+-            /* The original stack. */
+-            hi = GC_stackbottom;
+-            IF_IA64(bs_lo = BACKING_STORE_BASE;)
++            if (gettid() != getpid()) {
++                size_t size;
++                pthread_attr_t attr;
++                pthread_getattr_np(p->id, &attr);
++                pthread_attr_getstack(&attr, &hi, &size);
++                hi += size;
++            }
++            else {
++                /* The original stack. */
++                hi = GC_stackbottom;
++                IF_IA64(bs_lo = BACKING_STORE_BASE;)
++            }
+         }
+         #if DEBUG_THREADS
+             GC_printf3("Stack for thread 0x%lx = [%lx,%lx)\n",


More information about the mono-bugs mailing list