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

@ -1224,9 +1224,19 @@ void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int i
load_class_by_index(constant_pool, index, THREAD);
if (HAS_PENDING_EXCEPTION) {
// Exception happened during classloading. We ignore the exception here, since it
// is going to be rethrown since the current activation is going to be deoptimzied and
// is going to be rethrown since the current activation is going to be deoptimized and
// the interpreter will re-execute the bytecode.
CLEAR_PENDING_EXCEPTION;
// Class loading called java code which may have caused a stack
// overflow. If the exception was thrown right before the return
// to the runtime the stack is no longer guarded. Reguard the
// stack otherwise if we return to the uncommon trap blob and the
// stack bang causes a stack overflow we crash.
assert(THREAD->is_Java_thread(), "only a java thread can be here");
JavaThread* thread = (JavaThread*)THREAD;
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 uncommon trap blob may cause crash");
}
}