[Mono-bugs] [Bug 77309][Maj] New - 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:29:42 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.3138 2006-01-19 16:29:42.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 77309
+Product: Mono: Runtime
+Version: 1.1
+OS: other
+OS Details: Red Hat Enterprise Linux 4 (x86)
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: GC
+AssignedTo: lupus at ximian.com
+ReportedBy: horst.reiterer at mind-breeze.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mono_jit_init called from non-main thread segfaults
+
+Description of Problem:
+
+I embed Mono in a custom Apache module (Linux x86). If Mono is initialized
+in a thread other than the main thread, e.g. an Apache worker thread, the
+initialization process causes a segmentation fault originating from GC
+initialization.
+
+Steps to reproduce the problem:
+1. Call mono_jit_init in a thread other than the main thread
+
+Actual Results:
+
+Segmentation Fault. pthread_push_all_stacks only takes the main thread's
+stack into account. As a result, wrong arguments are passed to
+GC_push_all_stack which in turn causes a segfault in GC_push_all_eager.
+
+Expected Results:
+
+Correct initialization of the GC and the runtime.
+
+How often does this happen?
+
+100 out of 100 times
+
+Additional Information:
+
+This issue can be fixed using the patch below (only works with NPTL at the
+very moment). What the new code does is checking if the
+pthread_push_all_stacks caller is the main thread. If it isn't, the stack
+address of the current thread is read using pthread_getattr_np and
+pthread_attrgetstack. Otherwise, the behaviour remains unchanged.
+
+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.
More information about the mono-bugs
mailing list