1.1 --- a/src/os_cpu/linux_mips/vm/os_linux_mips.cpp Fri Sep 01 10:28:22 2017 +0800 1.2 +++ b/src/os_cpu/linux_mips/vm/os_linux_mips.cpp Thu Sep 07 09:12:16 2017 +0800 1.3 @@ -23,7 +23,7 @@ 1.4 * 1.5 */ 1.6 1.7 -// do not include precompiled header file 1.8 +// no precompiled headers 1.9 #include "asm/macroAssembler.hpp" 1.10 #include "classfile/classLoader.hpp" 1.11 #include "classfile/systemDictionary.hpp" 1.12 @@ -132,7 +132,7 @@ 1.13 1.14 address pc = (address)os::Linux::ucontext_get_pc(uc); 1.15 1.16 - /* Jin: to capture invalid 32-bit PC, for debbuging */ 1.17 + /* Jin: to capture invalid 32-bit PC, for debbuging */ 1.18 if (((long)pc & 0xFFFFFFFF00000000UL) == 0) 1.19 { 1.20 pc = (address)((long)pc | 0x5500000000UL); 1.21 @@ -163,15 +163,10 @@ 1.22 // By default, gcc always save frame pointer (%ebp/%rbp) on stack. It may get 1.23 // turned off by -fomit-frame-pointer, 1.24 frame os::get_sender_for_C_frame(frame* fr) { 1.25 - //return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); 1.26 - //tty->print("c frame sp = 0x%lx, fp=0x%lx, pc=0x%lx \n", (int)fr->sp(),(int)fr->fp(),(int)fr->pc()); 1.27 - //tty->print("c frame send_sp =0x%lx, fp = 0x%lx, pc = 0x%lx \n", 1.28 - // (int) fr->sender_sp(), (int) fr->link(), (int)fr->sender_pc()); 1.29 return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); 1.30 } 1.31 1.32 //intptr_t* _get_previous_fp() { 1.33 -//see StubGenerator::generate_get_previous_fp in stubGenerator_gs2.cpp 1.34 jint* os::get_previous_fp() { 1.35 int *pc; 1.36 int sp; 1.37 @@ -201,14 +196,15 @@ 1.38 ShouldNotReachHere(); 1.39 } 1.40 1.41 + 1.42 frame os::current_frame() { 1.43 - //tty->print("@@@@@@@@@@@@@@@@@@@get_previous_fp = 0x%lx \n", (intptr_t)(get_previous_fp())); 1.44 + intptr_t* fp = (intptr_t*)get_previous_fp(); 1.45 frame myframe((intptr_t*)os::current_stack_pointer(), 1.46 - (intptr_t*)get_previous_fp(), 1.47 + (intptr_t*)fp, 1.48 CAST_FROM_FN_PTR(address, os::current_frame)); 1.49 if (os::is_first_C_frame(&myframe)) { 1.50 // stack is not walkable 1.51 - return frame(NULL, NULL, NULL); 1.52 + return frame(); 1.53 } else { 1.54 return os::get_sender_for_C_frame(&myframe); 1.55 } 1.56 @@ -288,16 +284,16 @@ 1.57 // Handle ALL stack overflow variations here 1.58 if (sig == SIGSEGV) { 1.59 address addr = (address) info->si_addr; 1.60 - // check if fault address is within thread stack 1.61 #ifdef PRINT_SIGNAL_HANDLE 1.62 //tty->print("handle all stack overflow variations: "); 1.63 - /*tty->print("addr = %lx, stack base = %lx, stack top = %lx\n", 1.64 - addr, 1.65 - thread->stack_base(), 1.66 + /*tty->print("addr = %lx, stack base = %lx, stack top = %lx\n", 1.67 + addr, 1.68 + thread->stack_base(), 1.69 thread->stack_base() - thread->stack_size()); 1.70 */ 1.71 #endif 1.72 1.73 + // check if fault address is within thread stack 1.74 if (addr < thread->stack_base() && 1.75 addr >= thread->stack_base() - thread->stack_size()) { 1.76 // stack overflow 1.77 @@ -330,9 +326,12 @@ 1.78 tty->print("exception addr is in red zone\n"); 1.79 #endif 1.80 thread->disable_stack_red_zone(); 1.81 -#ifdef PRINT_SIGNAL_HANDLE 1.82 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 1.83 -#endif 1.84 + 1.85 + // This is a likely cause, but hard to verify. Let's just print 1.86 + // it as a hint. 1.87 + tty->print_raw_cr("Please check if any of your loaded .so files has " 1.88 + "enabled executable stack (see man page execstack(8))"); 1.89 } else { 1.90 // Accessing stack address below sp may cause SEGV if current 1.91 // thread has MAP_GROWSDOWN stack. This should only happen when