321 "enabled executable stack (see man page execstack(8))"); 322 } else { 323 // Accessing stack address below sp may cause SEGV if current 324 // thread has MAP_GROWSDOWN stack. This should only happen when 325 // current thread was created by user code with MAP_GROWSDOWN flag 326 // and then attached to VM. See notes in os_linux.cpp. 327 if (thread->osthread()->expanding_stack() == 0) { 328 thread->osthread()->set_expanding_stack(); 329 if (os::Linux::manually_expand_stack(thread, addr)) { 330 thread->osthread()->clear_expanding_stack(); 331 return 1; 332 } 333 thread->osthread()->clear_expanding_stack(); 334 } else { 335 fatal("recursive segv. expanding stack."); 336 } 337 } 338 } 339 } 340 341 if (thread->thread_state() == _thread_in_Java) { 342 // Java thread running in Java code => find exception handler if any 343 // a fault inside compiled code, the interpreter, or a stub 344 345 if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 346 stub = SharedRuntime::get_poll_stub(pc); 347 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { 348 // BugId 4454115: A read from a MappedByteBuffer can fault 349 // here if the underlying file has been truncated. 350 // Do not crash the VM in such a case. 351 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 352 nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; 353 if (nm != NULL && nm->has_unsafe_access()) { 354 stub = StubRoutines::handler_for_unsafe_access(); 355 } 356 } 357 else 358 359 #ifdef AMD64 360 if (sig == SIGFPE && | 321 "enabled executable stack (see man page execstack(8))"); 322 } else { 323 // Accessing stack address below sp may cause SEGV if current 324 // thread has MAP_GROWSDOWN stack. This should only happen when 325 // current thread was created by user code with MAP_GROWSDOWN flag 326 // and then attached to VM. See notes in os_linux.cpp. 327 if (thread->osthread()->expanding_stack() == 0) { 328 thread->osthread()->set_expanding_stack(); 329 if (os::Linux::manually_expand_stack(thread, addr)) { 330 thread->osthread()->clear_expanding_stack(); 331 return 1; 332 } 333 thread->osthread()->clear_expanding_stack(); 334 } else { 335 fatal("recursive segv. expanding stack."); 336 } 337 } 338 } 339 } 340 341 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { 342 // Verify that OS save/restore AVX registers. 343 stub = VM_Version::cpuinfo_cont_addr(); 344 } 345 346 if (thread->thread_state() == _thread_in_Java) { 347 // Java thread running in Java code => find exception handler if any 348 // a fault inside compiled code, the interpreter, or a stub 349 350 if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { 351 stub = SharedRuntime::get_poll_stub(pc); 352 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { 353 // BugId 4454115: A read from a MappedByteBuffer can fault 354 // here if the underlying file has been truncated. 355 // Do not crash the VM in such a case. 356 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); 357 nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; 358 if (nm != NULL && nm->has_unsafe_access()) { 359 stub = StubRoutines::handler_for_unsafe_access(); 360 } 361 } 362 else 363 364 #ifdef AMD64 365 if (sig == SIGFPE && |