[Mono-bugs] [Bug 324361] Stack Overflow detection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 12 12:05:03 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=324361

User kjambunathan.devel at gmail.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=324361#c4


Jambunathan Kalyanasundaram <kjambunathan.devel at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3 - Medium                 |P4 - Low
                 CC|                            |kjambunathan.devel at gmail.co
                   |                            |m
           Platform|Other                       |i686
            Version|1.2                         |2.4.x
           Severity|Enhancement                 |Normal




--- Comment #4 from Jambunathan Kalyanasundaram <kjambunathan.devel at gmail.com>  2009-05-12 10:05:00 MDT ---
I am using a hand-compiled mono-2.4 on ubuntu/i686.


// file: Recurse.cs

using System;

class T
{
    public static void Recurse ()
    {
        Recurse ();
    }

        public static void Main ()
        {
        Recurse ();
        }
}

$ mcs Recurse.cs
$ mono Recurse.exe

Stack overflow in unmanaged: IP: 0xb7dde5b9, fault addr: 0xbf692fd4
Stack overflow in unmanaged: IP: 0xb7e098dc, fault addr: 0xbf692fdc
Stack overflow in unmanaged: IP: 0xb7dde573, fault addr: 0xbf692f38
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0x81d7f10, fault addr: 0xbf691e88
Stack overflow in unmanaged: IP: 0x8107509, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692e9c
Stack overflow in unmanaged: IP: 0xb7dde573, fault addr: 0xbf692b68
Stack overflow in unmanaged: IP: 0x80e15ed, fault addr: 0xbf692ff0
Stack overflow in unmanaged: IP: 0x8107509, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0x813b112, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692fdc
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692fdc
Stack overflow in unmanaged: IP: 0xb7dde573, fault addr: 0xbf692b98
Stack overflow in unmanaged: IP: 0x81a4515, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692fec
Stack overflow in unmanaged: IP: 0x81074fc, fault addr: 0xbf692fec
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692fdc
Stack overflow in unmanaged: IP: 0xb7e098dc, fault addr: 0xbf692fa8
Stack overflow in unmanaged: IP: 0xb7f73d72, fault addr: 0xbf692fdc
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692f4c
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692e9c
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692e9c
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692eac
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692e5c
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692eac
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692eac
Stack overflow in unmanaged: IP: 0x8073bc8, fault addr: 0xbf692eac
Stack overflow in unmanaged: IP: 0xb7f1144c, fault addr: 0xbf692fcc
Stack overflow in unmanaged: IP: 0xb7df7946, fault addr: 0xbf691ffc
Stack overflow in unmanaged: IP: 0xb7f11445, fault addr: 0xbf692ffc
Stack overflow in unmanaged: IP: 0xb7dcd7f1, fault addr: 0xbf692ff8
Stack overflow in unmanaged: IP: 0x810ba6b, fault addr: 0xbf692d3c
Stack overflow in unmanaged: IP: 0x81074fc, fault addr: 0xbf692fdc

Unhandled Exception: System.StackOverflowException: The requested operation
caused a stack overflow.
  at (wrapper managed-to-native) System.MonoType:getFullName (bool,bool)
  at System.MonoType.ToString () [0x00000] 
  at System.Exception.get_ClassName () [0x00000] 
  at System.Exception.ToString () [0x00000] 

Observed Behaviour:
StackOverflowException reported in System.Exception.ToString () code path.

Required Behaviour:
Report StackOverflowException in Main ()

1.The first sigsegv -> altstack_handle_and_restore() -> mono_handle_exception
()

2. mono_handle_exception () triggers another sigsegv (in the runtime
   code)

3. mono_handle_soft_stack_ovf () finds no jit info and assumes that
   the fault is in an unmanaged code called from within the managed
   code. Installs a restore_stack_protection_tramp

4. mono_handle_exception () proceeds ahead (after some more faults and
   relaxed protection)

5. No user-specified handlers are available. Execution proceeds along
   mono_unhandled_exception () -> mono_print_unhandled_exception () ->
   mono_runtime_invoke (Exception.ToString ()).

6. JIT compilation is triggered for Exception.ToString () and
   Exception.ToString () is invoked. This call sequence has some
   managed-to-native wrappers.

7. When one of the managed-to-native wrappers return,
   restore_stack_protection_tramp () kicks in from the method epilog
   and does a mono_raise_exception (StackOverflowException). Note that
   this Exception is triggered in the context of Invoke() ->
   Exception.ToString (). 

  The stacktrace from the execution of the program clearly shows this
  unintended transference -


  Unhandled Exception: System.StackOverflowException: The requested operation
caused a stack overflow.
  at (wrapper managed-to-native) System.MonoType:getFullName (bool,bool)
  at System.MonoType.ToString () [0x00000] 
  at System.Exception.get_ClassName () [0x00000] 
  at System.Exception.ToString () [0x00000] 


8. The thread exits with above stack trace.


Comments

There are multiple assumptions that are broken in the above
path which needs to be addressed.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list