8004124: Handle and/or warn about SI_KERNEL

Fri, 21 Jun 2013 10:50:19 -0400

author
coleenp
date
Fri, 21 Jun 2013 10:50:19 -0400
changeset 5302
9ba41a4a71ff
parent 5301
b3cd8b58b798
child 5303
bed34a7a3b9b

8004124: Handle and/or warn about SI_KERNEL
Summary: Detect this crash in the signal handler and give a fatal error message instead of making us chase down bugs that don't reproduce
Reviewed-by: kvn, mgerdin, dholmes

src/os_cpu/linux_x86/vm/os_linux_x86.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/sharedRuntime.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Jun 20 11:53:51 2013 +0200
     1.2 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Jun 21 10:50:19 2013 -0400
     1.3 @@ -289,6 +289,16 @@
     1.4      }
     1.5  #endif // AMD64
     1.6  
     1.7 +#ifndef AMD64
     1.8 +    // Halt if SI_KERNEL before more crashes get misdiagnosed as Java bugs
     1.9 +    // This can happen in any running code (currently more frequently in
    1.10 +    // interpreter code but has been seen in compiled code)
    1.11 +    if (sig == SIGSEGV && info->si_addr == 0 && info->si_code == SI_KERNEL) {
    1.12 +      fatal("An irrecoverable SI_KERNEL SIGSEGV has occurred due "
    1.13 +            "to unstable signal handling in this distribution.");
    1.14 +    }
    1.15 +#endif // AMD64
    1.16 +
    1.17      // Handle ALL stack overflow variations here
    1.18      if (sig == SIGSEGV) {
    1.19        address addr = (address) info->si_addr;
     2.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Jun 20 11:53:51 2013 +0200
     2.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri Jun 21 10:50:19 2013 -0400
     2.3 @@ -813,8 +813,11 @@
     2.4            // 3. Implict null exception in nmethod
     2.5  
     2.6            if (!cb->is_nmethod()) {
     2.7 -            guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(),
     2.8 -                      "exception happened outside interpreter, nmethods and vtable stubs (1)");
     2.9 +            bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob();
    2.10 +            if (!is_in_blob) {
    2.11 +              cb->print();
    2.12 +              fatal(err_msg("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc));
    2.13 +            }
    2.14              Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc);
    2.15              // There is no handler here, so we will simply unwind.
    2.16              return StubRoutines::throw_NullPointerException_at_call_entry();

mercurial