1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
249
250 // SafeFetch 32 handling:
251 // - make it work if _thread is null
252 // - make it use the standard os::...::ucontext_get/set_pc APIs
253 if (uc) {
254 address const pc = os::Aix::ucontext_get_pc(uc);
255 if (pc && StubRoutines::is_safefetch_fault(pc)) {
256 os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
257 return true;
258 }
259 }
260
261 if (info == NULL || uc == NULL || thread == NULL && vmthread == NULL) {
262 goto run_chained_handler;
263 }
264
265 // If we are a java thread...
266 if (thread != NULL) {
267
268 // Handle ALL stack overflow variations here
269 if (sig == SIGSEGV && thread->on_local_stack(addr)) {
270 // stack overflow
271 //
272 // If we are in a yellow zone and we are inside java, we disable the yellow zone and
273 // throw a stack overflow exception.
274 // If we are in native code or VM C code, we report-and-die. The original coding tried
275 // to continue with yellow zone disabled, but that doesn't buy us much and prevents
276 // hs_err_pid files.
277 if (thread->in_stack_yellow_reserved_zone(addr)) {
278 if (thread->thread_state() == _thread_in_Java) {
279 if (thread->in_stack_reserved_zone(addr)) {
280 frame fr;
281 if (os::Aix::get_frame_at_stack_banging_point(thread, uc, &fr)) {
282 assert(fr.is_java_frame(), "Must be a Javac frame");
283 frame activation =
284 SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
285 if (activation.sp() != NULL) {
286 thread->disable_stack_reserved_zone();
287 if (activation.is_interpreted_frame()) {
288 thread->set_reserved_stack_activation((address)activation.fp());
289 } else {
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
249
250 // SafeFetch 32 handling:
251 // - make it work if _thread is null
252 // - make it use the standard os::...::ucontext_get/set_pc APIs
253 if (uc) {
254 address const pc = os::Aix::ucontext_get_pc(uc);
255 if (pc && StubRoutines::is_safefetch_fault(pc)) {
256 os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
257 return true;
258 }
259 }
260
261 if (info == NULL || uc == NULL || thread == NULL && vmthread == NULL) {
262 goto run_chained_handler;
263 }
264
265 // If we are a java thread...
266 if (thread != NULL) {
267
268 // Handle ALL stack overflow variations here
269 if (sig == SIGSEGV && thread->is_in_full_stack(addr)) {
270 // stack overflow
271 //
272 // If we are in a yellow zone and we are inside java, we disable the yellow zone and
273 // throw a stack overflow exception.
274 // If we are in native code or VM C code, we report-and-die. The original coding tried
275 // to continue with yellow zone disabled, but that doesn't buy us much and prevents
276 // hs_err_pid files.
277 if (thread->in_stack_yellow_reserved_zone(addr)) {
278 if (thread->thread_state() == _thread_in_Java) {
279 if (thread->in_stack_reserved_zone(addr)) {
280 frame fr;
281 if (os::Aix::get_frame_at_stack_banging_point(thread, uc, &fr)) {
282 assert(fr.is_java_frame(), "Must be a Javac frame");
283 frame activation =
284 SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
285 if (activation.sp() != NULL) {
286 thread->disable_stack_reserved_zone();
287 if (activation.is_interpreted_frame()) {
288 thread->set_reserved_stack_activation((address)activation.fp());
289 } else {
|