diff src/share/vm/runtime/sharedRuntime.cpp @ 17620:69dc1be43fce

8029873: compiler/uncommontrap/TestStackBangRbp.java crashes with SIGSEGV Summary: May end up in uncommon trap blob/deopt blob with unguarded stack Reviewed-by: kvn, twisti
author roland
date Wed, 08 Jan 2014 09:49:31 +0100
parents d6e7180abab5
children 7b9127b17b7a
line wrap: on
line diff
--- a/src/share/vm/runtime/sharedRuntime.cpp	Tue Jan 07 16:02:10 2014 +0100
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Wed Jan 08 09:49:31 2014 +0100
@@ -494,6 +494,13 @@
     assert(!nm->is_native_method(), "no exception handler");
     assert(nm->header_begin() != nm->exception_begin(), "no exception handler");
     if (nm->is_deopt_pc(return_address)) {
+      // If we come here because of a stack overflow, the stack may be
+      // unguarded. Reguard the stack otherwise if we return to the
+      // deopt blob and the stack bang causes a stack overflow we
+      // crash.
+      bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
+      if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
+      assert(guard_pages_enabled, "stack banging in deopt blob may cause crash");
       return SharedRuntime::deopt_blob()->unpack_with_exception();
     } else {
       return nm->exception_begin();