1 /*
2 * Copyright (c) 2003, 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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/filemap.hpp"
27 #include "runtime/arguments.hpp"
28 #include "runtime/os.hpp"
29 #include "runtime/thread.hpp"
30 #include "utilities/vmError.hpp"
31
32 #include <sys/types.h>
33 #include <sys/wait.h>
34 #include <signal.h>
35
36 #ifdef LINUX
37 #include <sys/syscall.h>
38 #include <unistd.h>
39 #endif
40 #ifdef SOLARIS
41 #include <thread.h>
42 #endif
43 #ifdef AIX
44 #include <unistd.h>
45 #endif
46 #ifdef BSD
136 sigemptyset(&newset);
137
138 for (int i = 0; i < NUM_SIGNALS; i++) {
139 save_signal(i, SIGNALS[i]);
140 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
141 sigaddset(&newset, SIGNALS[i]);
142 }
143 os::Posix::unblock_thread_signal_mask(&newset);
144
145 }
146
147 // Write a hint to the stream in case siginfo relates to a segv/bus error
148 // and the offending address points into CDS archive.
149 void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
150 #if INCLUDE_CDS
151 if (siginfo && UseSharedSpaces) {
152 const siginfo_t* const si = (siginfo_t*)siginfo;
153 if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
154 const void* const fault_addr = si->si_addr;
155 if (fault_addr != NULL) {
156 FileMapInfo* const mapinfo = FileMapInfo::current_info();
157 if (mapinfo->is_in_shared_space(fault_addr)) {
158 st->print("Error accessing class data sharing archive. "
159 "Mapped file inaccessible during execution, possible disk/network problem.");
160 }
161 }
162 }
163 }
164 #endif
165 }
166
|
1 /*
2 * Copyright (c) 2003, 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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/metaspaceShared.hpp"
27 #include "runtime/arguments.hpp"
28 #include "runtime/os.hpp"
29 #include "runtime/thread.hpp"
30 #include "utilities/vmError.hpp"
31
32 #include <sys/types.h>
33 #include <sys/wait.h>
34 #include <signal.h>
35
36 #ifdef LINUX
37 #include <sys/syscall.h>
38 #include <unistd.h>
39 #endif
40 #ifdef SOLARIS
41 #include <thread.h>
42 #endif
43 #ifdef AIX
44 #include <unistd.h>
45 #endif
46 #ifdef BSD
136 sigemptyset(&newset);
137
138 for (int i = 0; i < NUM_SIGNALS; i++) {
139 save_signal(i, SIGNALS[i]);
140 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
141 sigaddset(&newset, SIGNALS[i]);
142 }
143 os::Posix::unblock_thread_signal_mask(&newset);
144
145 }
146
147 // Write a hint to the stream in case siginfo relates to a segv/bus error
148 // and the offending address points into CDS archive.
149 void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
150 #if INCLUDE_CDS
151 if (siginfo && UseSharedSpaces) {
152 const siginfo_t* const si = (siginfo_t*)siginfo;
153 if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
154 const void* const fault_addr = si->si_addr;
155 if (fault_addr != NULL) {
156 if (MetaspaceShared::is_in_shared_metaspace(fault_addr)) {
157 st->print("Error accessing class data sharing archive. "
158 "Mapped file inaccessible during execution, possible disk/network problem.");
159 }
160 }
161 }
162 }
163 #endif
164 }
165
|