418 // and the heap gets shrunk before the field access. 419 if ((sig == SIGSEGV) || (sig == SIGBUS)) { 420 address addr = JNI_FastGetField::find_slowcase_pc(pc); 421 if (addr != (address)-1) { 422 stub = addr; 423 } 424 } 425 426 // Check to see if we caught the safepoint code in the 427 // process of write protecting the memory serialization page. 428 // It write enables the page immediately after protecting it 429 // so we can just return to retry the write. 430 if ((sig == SIGSEGV) && 431 os::is_memory_serialize_page(thread, (address) info->si_addr)) { 432 // Block current thread until the memory serialize page permission restored. 433 os::block_on_serialize_page_trap(); 434 return true; 435 } 436 } 437 438 #ifndef AMD64 439 // Execution protection violation 440 // 441 // This should be kept as the last step in the triage. We don't 442 // have a dedicated trap number for a no-execute fault, so be 443 // conservative and allow other handlers the first shot. 444 // 445 // Note: We don't test that info->si_code == SEGV_ACCERR here. 446 // this si_code is so generic that it is almost meaningless; and 447 // the si_code for this condition may change in the future. 448 // Furthermore, a false-positive should be harmless. 449 if (UnguardOnExecutionViolation > 0 && 450 (sig == SIGSEGV || sig == SIGBUS) && 451 uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { 452 int page_size = os::vm_page_size(); 453 address addr = (address) info->si_addr; 454 address pc = os::Linux::ucontext_get_pc(uc); 455 // Make sure the pc and the faulting address are sane. 456 // 457 // If an instruction spans a page boundary, and the page containing | 418 // and the heap gets shrunk before the field access. 419 if ((sig == SIGSEGV) || (sig == SIGBUS)) { 420 address addr = JNI_FastGetField::find_slowcase_pc(pc); 421 if (addr != (address)-1) { 422 stub = addr; 423 } 424 } 425 426 // Check to see if we caught the safepoint code in the 427 // process of write protecting the memory serialization page. 428 // It write enables the page immediately after protecting it 429 // so we can just return to retry the write. 430 if ((sig == SIGSEGV) && 431 os::is_memory_serialize_page(thread, (address) info->si_addr)) { 432 // Block current thread until the memory serialize page permission restored. 433 os::block_on_serialize_page_trap(); 434 return true; 435 } 436 } 437 438 if ((sig == SIGSEGV) && UseShenandoahGC 439 && (ShenandoahVerifyWritesToFromSpace || ShenandoahVerifyReadsToFromSpace)) { 440 if (Universe::heap()->is_in(info->si_addr)) { 441 ucontext_t* uc = (ucontext_t*) ucVoid; 442 address pc = (address) os::Linux::ucontext_get_pc(uc); 443 os::print_context(tty, ucVoid); 444 Universe::heap()->print(); 445 if (ShenandoahVerifyReadsToFromSpace) { 446 assert(false, "Illegal read to From Space"); 447 } else { 448 assert(false, "Illegal write to From Space"); 449 } 450 } 451 } 452 453 #ifndef AMD64 454 // Execution protection violation 455 // 456 // This should be kept as the last step in the triage. We don't 457 // have a dedicated trap number for a no-execute fault, so be 458 // conservative and allow other handlers the first shot. 459 // 460 // Note: We don't test that info->si_code == SEGV_ACCERR here. 461 // this si_code is so generic that it is almost meaningless; and 462 // the si_code for this condition may change in the future. 463 // Furthermore, a false-positive should be harmless. 464 if (UnguardOnExecutionViolation > 0 && 465 (sig == SIGSEGV || sig == SIGBUS) && 466 uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { 467 int page_size = os::vm_page_size(); 468 address addr = (address) info->si_addr; 469 address pc = os::Linux::ucontext_get_pc(uc); 470 // Make sure the pc and the faulting address are sane. 471 // 472 // If an instruction spans a page boundary, and the page containing |