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 tty->print("OK, we got the SIGSEGV,on address %p now what?\n", (address) info->si_addr);
442 ucontext_t* uc = (ucontext_t*) ucVoid;
443 address pc = (address) os::Linux::ucontext_get_pc(uc);
444 os::print_context(tty, ucVoid);
445 Universe::heap()->print();
446 if (ShenandoahVerifyReadsToFromSpace) {
447 assert(false, "Illegal read to From Space");
448 } else {
449 assert(false, "Illegal write to From Space");
450 }
451 }
452 }
453
454 #ifndef AMD64
455 // Execution protection violation
456 //
457 // This should be kept as the last step in the triage. We don't
458 // have a dedicated trap number for a no-execute fault, so be
459 // conservative and allow other handlers the first shot.
460 //
461 // Note: We don't test that info->si_code == SEGV_ACCERR here.
462 // this si_code is so generic that it is almost meaningless; and
463 // the si_code for this condition may change in the future.
464 // Furthermore, a false-positive should be harmless.
465 if (UnguardOnExecutionViolation > 0 &&
466 (sig == SIGSEGV || sig == SIGBUS) &&
467 uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) {
468 int page_size = os::vm_page_size();
469 address addr = (address) info->si_addr;
470 address pc = os::Linux::ucontext_get_pc(uc);
471 // Make sure the pc and the faulting address are sane.
472 //
473 // If an instruction spans a page boundary, and the page containing
|