442 if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) { 443 address addr = (address) info->si_addr; 444 if (thread->in_stack_yellow_zone(addr)) { 445 thread->disable_stack_yellow_zone(); 446 if (thread->thread_state() == _thread_in_Java) { 447 // Throw a stack overflow exception. Guard pages will be reenabled 448 // while unwinding the stack. 449 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 450 } else { 451 // Thread was in the vm or native code. Return and try to finish. 452 return true; 453 } 454 } else if (thread->in_stack_red_zone(addr)) { 455 // Fatal red zone violation. Disable the guard pages and fall through 456 // to handle_unexpected_exception way down below. 457 thread->disable_stack_red_zone(); 458 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 459 } 460 } 461 462 if (thread->thread_state() == _thread_in_vm) { 463 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { 464 stub = StubRoutines::handler_for_unsafe_access(); 465 } 466 } 467 468 if (thread->thread_state() == _thread_in_Java) { 469 // Support Safepoint Polling 470 if ( sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 471 stub = SharedRuntime::get_poll_stub(pc); 472 } 473 else if (sig == SIGBUS && info->si_code == BUS_OBJERR) { 474 // BugId 4454115: A read from a MappedByteBuffer can fault 475 // here if the underlying file has been truncated. 476 // Do not crash the VM in such a case. 477 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 478 if (cb != NULL) { 479 nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; 480 if (nm != NULL && nm->has_unsafe_access()) { 481 stub = StubRoutines::handler_for_unsafe_access(); | 442 if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) { 443 address addr = (address) info->si_addr; 444 if (thread->in_stack_yellow_zone(addr)) { 445 thread->disable_stack_yellow_zone(); 446 if (thread->thread_state() == _thread_in_Java) { 447 // Throw a stack overflow exception. Guard pages will be reenabled 448 // while unwinding the stack. 449 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 450 } else { 451 // Thread was in the vm or native code. Return and try to finish. 452 return true; 453 } 454 } else if (thread->in_stack_red_zone(addr)) { 455 // Fatal red zone violation. Disable the guard pages and fall through 456 // to handle_unexpected_exception way down below. 457 thread->disable_stack_red_zone(); 458 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 459 } 460 } 461 462 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { 463 // Verify that OS save/restore AVX registers. 464 stub = VM_Version::cpuinfo_cont_addr(); 465 } 466 467 if (thread->thread_state() == _thread_in_vm) { 468 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { 469 stub = StubRoutines::handler_for_unsafe_access(); 470 } 471 } 472 473 if (thread->thread_state() == _thread_in_Java) { 474 // Support Safepoint Polling 475 if ( sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 476 stub = SharedRuntime::get_poll_stub(pc); 477 } 478 else if (sig == SIGBUS && info->si_code == BUS_OBJERR) { 479 // BugId 4454115: A read from a MappedByteBuffer can fault 480 // here if the underlying file has been truncated. 481 // Do not crash the VM in such a case. 482 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 483 if (cb != NULL) { 484 nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; 485 if (nm != NULL && nm->has_unsafe_access()) { 486 stub = StubRoutines::handler_for_unsafe_access(); |