499 thread->disable_stack_yellow_reserved_zone(); 500 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 501 } else { 502 // Thread was in the vm or native code. Return and try to finish. 503 thread->disable_stack_yellow_reserved_zone(); 504 return true; 505 } 506 } else if (thread->in_stack_red_zone(addr)) { 507 // Fatal red zone violation. Disable the guard pages and fall through 508 // to handle_unexpected_exception way down below. 509 thread->disable_stack_red_zone(); 510 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 511 } 512 } 513 514 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { 515 // Verify that OS save/restore AVX registers. 516 stub = VM_Version::cpuinfo_cont_addr(); 517 } 518 519 if (thread->thread_state() == _thread_in_vm) { 520 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { 521 address next_pc = Assembler::locate_next_instruction(pc); 522 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); 523 } 524 } 525 526 if (thread->thread_state() == _thread_in_Java) { 527 // Support Safepoint Polling 528 if ( sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 529 stub = SharedRuntime::get_poll_stub(pc); 530 } 531 else if (sig == SIGBUS && info->si_code == BUS_OBJERR) { 532 // BugId 4454115: A read from a MappedByteBuffer can fault 533 // here if the underlying file has been truncated. 534 // Do not crash the VM in such a case. 535 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 536 if (cb != NULL) { 537 CompiledMethod* nm = cb->as_compiled_method_or_null(); 538 if (nm != NULL && nm->has_unsafe_access()) { 539 address next_pc = Assembler::locate_next_instruction(pc); 540 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); 541 } 542 } 543 } | 499 thread->disable_stack_yellow_reserved_zone(); 500 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 501 } else { 502 // Thread was in the vm or native code. Return and try to finish. 503 thread->disable_stack_yellow_reserved_zone(); 504 return true; 505 } 506 } else if (thread->in_stack_red_zone(addr)) { 507 // Fatal red zone violation. Disable the guard pages and fall through 508 // to handle_unexpected_exception way down below. 509 thread->disable_stack_red_zone(); 510 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 511 } 512 } 513 514 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { 515 // Verify that OS save/restore AVX registers. 516 stub = VM_Version::cpuinfo_cont_addr(); 517 } 518 519 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { 520 address next_pc = Assembler::locate_next_instruction(pc); 521 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); 522 } 523 524 if (thread->thread_state() == _thread_in_Java) { 525 // Support Safepoint Polling 526 if ( sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 527 stub = SharedRuntime::get_poll_stub(pc); 528 } 529 else if (sig == SIGBUS && info->si_code == BUS_OBJERR) { 530 // BugId 4454115: A read from a MappedByteBuffer can fault 531 // here if the underlying file has been truncated. 532 // Do not crash the VM in such a case. 533 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 534 if (cb != NULL) { 535 CompiledMethod* nm = cb->as_compiled_method_or_null(); 536 if (nm != NULL && nm->has_unsafe_access()) { 537 address next_pc = Assembler::locate_next_instruction(pc); 538 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); 539 } 540 } 541 } |