260 };
261
262 #ifdef BUILTIN_SIM
263 extern "C" void Fetch32PFI () ;
264 extern "C" void Fetch32Resume () ;
265 extern "C" void FetchNPFI () ;
266 extern "C" void FetchNResume () ;
267 #endif
268
269 extern "C" JNIEXPORT int
270 JVM_handle_linux_signal(int sig,
271 siginfo_t* info,
272 void* ucVoid,
273 int abort_if_unrecognized) {
274 ucontext_t* uc = (ucontext_t*) ucVoid;
275
276 Thread* t = Thread::current_or_null_safe();
277
278 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
279 // (no destructors can be run)
280 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
281
282 SignalHandlerMark shm(t);
283
284 // Note: it's not uncommon that JNI code uses signal/sigset to install
285 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
286 // or have a SIGILL handler when detecting CPU type). When that happens,
287 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
288 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
289 // that do not require siginfo/ucontext first.
290
291 if (sig == SIGPIPE || sig == SIGXFSZ) {
292 // allow chained handler to go first
293 if (os::Linux::chained_handler(sig, info, ucVoid)) {
294 return true;
295 } else {
296 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
297 return true;
298 }
299 }
300
|
260 };
261
262 #ifdef BUILTIN_SIM
263 extern "C" void Fetch32PFI () ;
264 extern "C" void Fetch32Resume () ;
265 extern "C" void FetchNPFI () ;
266 extern "C" void FetchNResume () ;
267 #endif
268
269 extern "C" JNIEXPORT int
270 JVM_handle_linux_signal(int sig,
271 siginfo_t* info,
272 void* ucVoid,
273 int abort_if_unrecognized) {
274 ucontext_t* uc = (ucontext_t*) ucVoid;
275
276 Thread* t = Thread::current_or_null_safe();
277
278 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
279 // (no destructors can be run)
280 os::ThreadCrashProtection::check_crash_protection(sig, t);
281
282 SignalHandlerMark shm(t);
283
284 // Note: it's not uncommon that JNI code uses signal/sigset to install
285 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
286 // or have a SIGILL handler when detecting CPU type). When that happens,
287 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
288 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
289 // that do not require siginfo/ucontext first.
290
291 if (sig == SIGPIPE || sig == SIGXFSZ) {
292 // allow chained handler to go first
293 if (os::Linux::chained_handler(sig, info, ucVoid)) {
294 return true;
295 } else {
296 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
297 return true;
298 }
299 }
300
|