524 // At the stub it needs to look like a call from the caller of this
525 // method (not a call from the segv site).
526 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
527 return true;
528 }
529 #endif // COMPILER2
530 return false;
531 }
532
533 extern "C" JNIEXPORT int
534 JVM_handle_linux_signal(int sig,
535 siginfo_t* info,
536 void* ucVoid,
537 int abort_if_unrecognized) {
538 // in fact this isn't ucontext_t* at all, but struct sigcontext*
539 // but Linux porting layer uses ucontext_t, so to minimize code change
540 // we cast as needed
541 ucontext_t* ucFake = (ucontext_t*) ucVoid;
542 sigcontext* uc = (sigcontext*)ucVoid;
543
544 Thread* t = ThreadLocalStorage::get_thread_slow();
545
546 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
547 // (no destructors can be run)
548 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
549
550 SignalHandlerMark shm(t);
551
552 // Note: it's not uncommon that JNI code uses signal/sigset to install
553 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
554 // or have a SIGILL handler when detecting CPU type). When that happens,
555 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
556 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
557 // that do not require siginfo/ucontext first.
558
559 if (sig == SIGPIPE || sig == SIGXFSZ) {
560 // allow chained handler to go first
561 if (os::Linux::chained_handler(sig, info, ucVoid)) {
562 return true;
563 } else {
564 if (PrintMiscellaneous && (WizardMode || Verbose)) {
|
524 // At the stub it needs to look like a call from the caller of this
525 // method (not a call from the segv site).
526 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
527 return true;
528 }
529 #endif // COMPILER2
530 return false;
531 }
532
533 extern "C" JNIEXPORT int
534 JVM_handle_linux_signal(int sig,
535 siginfo_t* info,
536 void* ucVoid,
537 int abort_if_unrecognized) {
538 // in fact this isn't ucontext_t* at all, but struct sigcontext*
539 // but Linux porting layer uses ucontext_t, so to minimize code change
540 // we cast as needed
541 ucontext_t* ucFake = (ucontext_t*) ucVoid;
542 sigcontext* uc = (sigcontext*)ucVoid;
543
544 Thread* t = Thread::current_or_null_safe();
545
546 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
547 // (no destructors can be run)
548 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
549
550 SignalHandlerMark shm(t);
551
552 // Note: it's not uncommon that JNI code uses signal/sigset to install
553 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
554 // or have a SIGILL handler when detecting CPU type). When that happens,
555 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
556 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
557 // that do not require siginfo/ucontext first.
558
559 if (sig == SIGPIPE || sig == SIGXFSZ) {
560 // allow chained handler to go first
561 if (os::Linux::chained_handler(sig, info, ucVoid)) {
562 return true;
563 } else {
564 if (PrintMiscellaneous && (WizardMode || Verbose)) {
|