< prev index next >

src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp

Print this page


   1 /*
   2  * Copyright (c) 2008, 2019, 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  *


 319       }
 320     }
 321   }
 322 
 323   address stub = NULL;
 324   address pc = NULL;
 325   bool unsafe_access = false;
 326 
 327   if (info != NULL && uc != NULL && thread != NULL) {
 328     pc = (address) os::Linux::ucontext_get_pc(uc);
 329 
 330     // Handle ALL stack overflow variations here
 331     if (sig == SIGSEGV) {
 332       address addr = (address) info->si_addr;
 333 
 334       if (StubRoutines::is_safefetch_fault(pc)) {
 335         os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 336         return 1;
 337       }
 338       // check if fault address is within thread stack
 339       if (addr < thread->stack_base() &&
 340           addr >= thread->stack_base() - thread->stack_size()) {
 341         // stack overflow
 342         if (thread->in_stack_yellow_reserved_zone(addr)) {
 343           thread->disable_stack_yellow_reserved_zone();
 344           if (thread->thread_state() == _thread_in_Java) {
 345             // Throw a stack overflow exception.  Guard pages will be reenabled
 346             // while unwinding the stack.
 347             stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
 348           } else {
 349             // Thread was in the vm or native code.  Return and try to finish.
 350             return 1;
 351           }
 352         } else if (thread->in_stack_red_zone(addr)) {
 353           // Fatal red zone violation.  Disable the guard pages and fall through
 354           // to handle_unexpected_exception way down below.
 355           thread->disable_stack_red_zone();
 356           tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
 357         } else {
 358           // Accessing stack address below sp may cause SEGV if current
 359           // thread has MAP_GROWSDOWN stack. This should only happen when
 360           // current thread was created by user code with MAP_GROWSDOWN flag


   1 /*
   2  * Copyright (c) 2008, 2020, 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  *


 319       }
 320     }
 321   }
 322 
 323   address stub = NULL;
 324   address pc = NULL;
 325   bool unsafe_access = false;
 326 
 327   if (info != NULL && uc != NULL && thread != NULL) {
 328     pc = (address) os::Linux::ucontext_get_pc(uc);
 329 
 330     // Handle ALL stack overflow variations here
 331     if (sig == SIGSEGV) {
 332       address addr = (address) info->si_addr;
 333 
 334       if (StubRoutines::is_safefetch_fault(pc)) {
 335         os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 336         return 1;
 337       }
 338       // check if fault address is within thread stack
 339       if (thread->on_local_stack(addr)) {

 340         // stack overflow
 341         if (thread->in_stack_yellow_reserved_zone(addr)) {
 342           thread->disable_stack_yellow_reserved_zone();
 343           if (thread->thread_state() == _thread_in_Java) {
 344             // Throw a stack overflow exception.  Guard pages will be reenabled
 345             // while unwinding the stack.
 346             stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
 347           } else {
 348             // Thread was in the vm or native code.  Return and try to finish.
 349             return 1;
 350           }
 351         } else if (thread->in_stack_red_zone(addr)) {
 352           // Fatal red zone violation.  Disable the guard pages and fall through
 353           // to handle_unexpected_exception way down below.
 354           thread->disable_stack_red_zone();
 355           tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
 356         } else {
 357           // Accessing stack address below sp may cause SEGV if current
 358           // thread has MAP_GROWSDOWN stack. This should only happen when
 359           // current thread was created by user code with MAP_GROWSDOWN flag


< prev index next >