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
|
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->is_in_full_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
|