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