8029873: compiler/uncommontrap/TestStackBangRbp.java crashes with SIGSEGV

May end up in uncommon trap blob/deopt blob with unguarded stack

Reviewed-by: kvn, twisti
This commit is contained in:
Roland Westrelin 2014-01-08 09:49:31 +01:00
parent dd042bf16e
commit cb7814987c
3 changed files with 373 additions and 1 deletions

View file

@ -494,6 +494,13 @@ address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thre
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();