232 static address handle_unsafe_access(JavaThread* thread, address pc) {
233 // pc is the instruction which we must emulate
234 // doing a no-op is fine: return garbage from the load
235 // therefore, compute npc
236 address npc = pc + NativeCall::instruction_size;
237
238 // request an async exception
239 thread->set_pending_unsafe_access_error();
240
241 // return address of next instruction to execute
242 return npc;
243 }
244
245 extern "C" JNIEXPORT int
246 JVM_handle_linux_signal(int sig,
247 siginfo_t* info,
248 void* ucVoid,
249 int abort_if_unrecognized) {
250 ucontext_t* uc = (ucontext_t*) ucVoid;
251
252 Thread* t = ThreadLocalStorage::get_thread_slow();
253
254 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
255 // (no destructors can be run)
256 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
257
258 SignalHandlerMark shm(t);
259
260 // Note: it's not uncommon that JNI code uses signal/sigset to install
261 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
262 // or have a SIGILL handler when detecting CPU type). When that happens,
263 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
264 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
265 // that do not require siginfo/ucontext first.
266
267 if (sig == SIGPIPE || sig == SIGXFSZ) {
268 // allow chained handler to go first
269 if (os::Linux::chained_handler(sig, info, ucVoid)) {
270 return true;
271 } else {
272 if (PrintMiscellaneous && (WizardMode || Verbose)) {
|
232 static address handle_unsafe_access(JavaThread* thread, address pc) {
233 // pc is the instruction which we must emulate
234 // doing a no-op is fine: return garbage from the load
235 // therefore, compute npc
236 address npc = pc + NativeCall::instruction_size;
237
238 // request an async exception
239 thread->set_pending_unsafe_access_error();
240
241 // return address of next instruction to execute
242 return npc;
243 }
244
245 extern "C" JNIEXPORT int
246 JVM_handle_linux_signal(int sig,
247 siginfo_t* info,
248 void* ucVoid,
249 int abort_if_unrecognized) {
250 ucontext_t* uc = (ucontext_t*) ucVoid;
251
252 Thread* t = Thread::current_or_null_safe();
253
254 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
255 // (no destructors can be run)
256 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
257
258 SignalHandlerMark shm(t);
259
260 // Note: it's not uncommon that JNI code uses signal/sigset to install
261 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
262 // or have a SIGILL handler when detecting CPU type). When that happens,
263 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
264 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
265 // that do not require siginfo/ucontext first.
266
267 if (sig == SIGPIPE || sig == SIGXFSZ) {
268 // allow chained handler to go first
269 if (os::Linux::chained_handler(sig, info, ucVoid)) {
270 return true;
271 } else {
272 if (PrintMiscellaneous && (WizardMode || Verbose)) {
|