Bug 5933 - Unable to catch segfault on altstack on Mac OS
Summary: Unable to catch segfault on altstack on Mac OS
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-06-29 23:44 UTC by Martin Baulig
Modified: 2012-07-02 12:58 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Martin Baulig 2012-06-29 23:44:28 UTC
On Mac OS 10.7.4, mono from master (commit cc224125) can't catch any NullReferenceException when sigaltstack is enabled:

using System;

namespace MiscTests
	public class MainClass
		public static void Main (string[] args)
			try {
				object o = null;
				o.GetType ();
			} catch (NullReferenceException) {
				Console.WriteLine ("CAUGHT NULL REF!");
[martin@nathan:MiscTests]$ mono ./bin/MiscTests.exe

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

Building Mono with --with-sigaltstack=no fixes the problem, so the following configuration works:

Mono JIT compiler version 2.11.3 (master/9afa824 Sat Jun 30 05:36:00 CEST 2012)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC)
Comment 1 Zoltan Varga 2012-06-30 18:36:02 UTC
This works for me with a 32 bit mono build, 64 bits on osx is still a bit flaky.
Comment 2 Zoltan Varga 2012-06-30 19:30:28 UTC
Fixed in master.
Comment 3 Martin Baulig 2012-07-02 12:58:59 UTC
Thanks for the quick fix !  I just checked and it's working fine now :-)