33 #include "code/icBuffer.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "code/nativeInst.hpp"
36 #include "interpreter/interpreter.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "os_share_linux.hpp"
39 #include "prims/jniFastGetField.hpp"
40 #include "prims/jvm_misc.hpp"
41 #include "runtime/arguments.hpp"
42 #include "runtime/extendedPC.hpp"
43 #include "runtime/frame.inline.hpp"
44 #include "runtime/interfaceSupport.inline.hpp"
45 #include "runtime/java.hpp"
46 #include "runtime/javaCalls.hpp"
47 #include "runtime/mutexLocker.hpp"
48 #include "runtime/osThread.hpp"
49 #include "runtime/sharedRuntime.hpp"
50 #include "runtime/stubRoutines.hpp"
51 #include "runtime/thread.inline.hpp"
52 #include "runtime/timer.hpp"
53 #include "utilities/events.hpp"
54 #include "utilities/vmError.hpp"
55 #ifdef BUILTIN_SIM
56 #include "../../../../../../simulator/simulator.hpp"
57 #endif
58
59 // put OS-includes here
60 # include <sys/types.h>
61 # include <sys/mman.h>
62 # include <pthread.h>
63 # include <signal.h>
64 # include <errno.h>
65 # include <dlfcn.h>
66 # include <stdlib.h>
67 # include <stdio.h>
68 # include <unistd.h>
69 # include <sys/resource.h>
70 # include <pthread.h>
71 # include <sys/stat.h>
72 # include <sys/time.h>
288 os::ThreadCrashProtection::check_crash_protection(sig, t);
289
290 SignalHandlerMark shm(t);
291
292 // Note: it's not uncommon that JNI code uses signal/sigset to install
293 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
294 // or have a SIGILL handler when detecting CPU type). When that happens,
295 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
296 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
297 // that do not require siginfo/ucontext first.
298
299 if (sig == SIGPIPE || sig == SIGXFSZ) {
300 // allow chained handler to go first
301 if (os::Linux::chained_handler(sig, info, ucVoid)) {
302 return true;
303 } else {
304 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
305 return true;
306 }
307 }
308
309 JavaThread* thread = NULL;
310 VMThread* vmthread = NULL;
311 if (os::Linux::signal_handlers_are_installed) {
312 if (t != NULL ){
313 if(t->is_Java_thread()) {
314 thread = (JavaThread*)t;
315 }
316 else if(t->is_VM_thread()){
317 vmthread = (VMThread *)t;
318 }
319 }
320 }
321 /*
322 NOTE: does not seem to work on linux.
323 if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
324 // can't decode this kind of signal
325 info = NULL;
326 } else {
327 assert(sig == info->si_signo, "bad siginfo");
|
33 #include "code/icBuffer.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "code/nativeInst.hpp"
36 #include "interpreter/interpreter.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "os_share_linux.hpp"
39 #include "prims/jniFastGetField.hpp"
40 #include "prims/jvm_misc.hpp"
41 #include "runtime/arguments.hpp"
42 #include "runtime/extendedPC.hpp"
43 #include "runtime/frame.inline.hpp"
44 #include "runtime/interfaceSupport.inline.hpp"
45 #include "runtime/java.hpp"
46 #include "runtime/javaCalls.hpp"
47 #include "runtime/mutexLocker.hpp"
48 #include "runtime/osThread.hpp"
49 #include "runtime/sharedRuntime.hpp"
50 #include "runtime/stubRoutines.hpp"
51 #include "runtime/thread.inline.hpp"
52 #include "runtime/timer.hpp"
53 #include "utilities/debug.hpp"
54 #include "utilities/events.hpp"
55 #include "utilities/vmError.hpp"
56 #ifdef BUILTIN_SIM
57 #include "../../../../../../simulator/simulator.hpp"
58 #endif
59
60 // put OS-includes here
61 # include <sys/types.h>
62 # include <sys/mman.h>
63 # include <pthread.h>
64 # include <signal.h>
65 # include <errno.h>
66 # include <dlfcn.h>
67 # include <stdlib.h>
68 # include <stdio.h>
69 # include <unistd.h>
70 # include <sys/resource.h>
71 # include <pthread.h>
72 # include <sys/stat.h>
73 # include <sys/time.h>
289 os::ThreadCrashProtection::check_crash_protection(sig, t);
290
291 SignalHandlerMark shm(t);
292
293 // Note: it's not uncommon that JNI code uses signal/sigset to install
294 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
295 // or have a SIGILL handler when detecting CPU type). When that happens,
296 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
297 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
298 // that do not require siginfo/ucontext first.
299
300 if (sig == SIGPIPE || sig == SIGXFSZ) {
301 // allow chained handler to go first
302 if (os::Linux::chained_handler(sig, info, ucVoid)) {
303 return true;
304 } else {
305 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
306 return true;
307 }
308 }
309
310 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
311 if ( (sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
312 handle_assert_poison_fault(ucVoid, info->si_addr);
313 return 1;
314 }
315 #endif
316
317 JavaThread* thread = NULL;
318 VMThread* vmthread = NULL;
319 if (os::Linux::signal_handlers_are_installed) {
320 if (t != NULL ){
321 if(t->is_Java_thread()) {
322 thread = (JavaThread*)t;
323 }
324 else if(t->is_VM_thread()){
325 vmthread = (VMThread *)t;
326 }
327 }
328 }
329 /*
330 NOTE: does not seem to work on linux.
331 if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
332 // can't decode this kind of signal
333 info = NULL;
334 } else {
335 assert(sig == info->si_signo, "bad siginfo");
|