1 /*
2 * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
30 #include "classfile/vmSymbols.hpp"
31 #include "code/icBuffer.hpp"
32 #include "code/vtableStubs.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "nativeInst_arm.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/timer.hpp"
50 #include "utilities/events.hpp"
51 #include "utilities/vmError.hpp"
52
53 // put OS-includes here
54 # include <sys/types.h>
55 # include <sys/mman.h>
56 # include <pthread.h>
57 # include <signal.h>
58 # include <errno.h>
59 # include <dlfcn.h>
60 # include <stdlib.h>
61 # include <stdio.h>
62 # include <unistd.h>
63 # include <sys/resource.h>
64 # include <pthread.h>
65 # include <sys/stat.h>
66 # include <sys/time.h>
67 # include <sys/utsname.h>
68 # include <sys/socket.h>
69 # include <sys/wait.h>
293 uc->uc_mcontext.arm_r0 = 0;
294 return true;
295 }
296
297 // Note: it's not uncommon that JNI code uses signal/sigset to install
298 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
299 // or have a SIGILL handler when detecting CPU type). When that happens,
300 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
301 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
302 // that do not require siginfo/ucontext first.
303
304 if (sig == SIGPIPE || sig == SIGXFSZ) {
305 // allow chained handler to go first
306 if (os::Linux::chained_handler(sig, info, ucVoid)) {
307 return true;
308 } else {
309 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
310 return true;
311 }
312 }
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 address stub = NULL;
328 address pc = NULL;
329 bool unsafe_access = false;
330
331 if (info != NULL && uc != NULL && thread != NULL) {
332 pc = (address) os::Linux::ucontext_get_pc(uc);
|
1 /*
2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
30 #include "classfile/vmSymbols.hpp"
31 #include "code/icBuffer.hpp"
32 #include "code/vtableStubs.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "nativeInst_arm.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/timer.hpp"
50 #include "utilities/debug.hpp"
51 #include "utilities/events.hpp"
52 #include "utilities/vmError.hpp"
53
54 // put OS-includes here
55 # include <sys/types.h>
56 # include <sys/mman.h>
57 # include <pthread.h>
58 # include <signal.h>
59 # include <errno.h>
60 # include <dlfcn.h>
61 # include <stdlib.h>
62 # include <stdio.h>
63 # include <unistd.h>
64 # include <sys/resource.h>
65 # include <pthread.h>
66 # include <sys/stat.h>
67 # include <sys/time.h>
68 # include <sys/utsname.h>
69 # include <sys/socket.h>
70 # include <sys/wait.h>
294 uc->uc_mcontext.arm_r0 = 0;
295 return true;
296 }
297
298 // Note: it's not uncommon that JNI code uses signal/sigset to install
299 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
300 // or have a SIGILL handler when detecting CPU type). When that happens,
301 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
302 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
303 // that do not require siginfo/ucontext first.
304
305 if (sig == SIGPIPE || sig == SIGXFSZ) {
306 // allow chained handler to go first
307 if (os::Linux::chained_handler(sig, info, ucVoid)) {
308 return true;
309 } else {
310 // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
311 return true;
312 }
313 }
314
315 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
316 if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
317 handle_assert_poison_fault(ucVoid, info->si_addr);
318 return 1;
319 }
320 #endif
321
322 JavaThread* thread = NULL;
323 VMThread* vmthread = NULL;
324 if (os::Linux::signal_handlers_are_installed) {
325 if (t != NULL ){
326 if(t->is_Java_thread()) {
327 thread = (JavaThread*)t;
328 }
329 else if(t->is_VM_thread()){
330 vmthread = (VMThread *)t;
331 }
332 }
333 }
334
335 address stub = NULL;
336 address pc = NULL;
337 bool unsafe_access = false;
338
339 if (info != NULL && uc != NULL && thread != NULL) {
340 pc = (address) os::Linux::ucontext_get_pc(uc);
|