< prev index next >

src/hotspot/os/posix/signals_posix.cpp

Print this page

   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #include "jvm.h"



  28 #include "logging/log.hpp"
  29 #include "runtime/atomic.hpp"
  30 #include "runtime/globals.hpp"
  31 #include "runtime/interfaceSupport.inline.hpp"
  32 #include "runtime/java.hpp"
  33 #include "runtime/os.hpp"
  34 #include "runtime/osThread.hpp"
  35 #include "runtime/semaphore.inline.hpp"
  36 #include "runtime/stubRoutines.hpp"
  37 #include "runtime/thread.hpp"
  38 #include "signals_posix.hpp"
  39 #include "utilities/events.hpp"
  40 #include "utilities/ostream.hpp"
  41 #include "utilities/vmError.hpp"
  42 
  43 #ifdef ZERO
  44 // See stubGenerator_zero.cpp
  45 #include <setjmp.h>
  46 extern sigjmp_buf* get_jmp_buf_for_continuation();
  47 #endif

 605       }
 606     }
 607 #else
 608     // See JDK-8076185
 609     if (sig == SIGSEGV || sig == SIGBUS) {
 610       sigjmp_buf* const pjb = get_jmp_buf_for_continuation();
 611       if (pjb) {
 612         siglongjmp(*pjb, 1);
 613       }
 614     }
 615 #endif // ZERO
 616   }
 617 
 618   // Ignore SIGPIPE and SIGXFSZ (4229104, 6499219).
 619   if (!signal_was_handled &&
 620       (sig == SIGPIPE || sig == SIGXFSZ)) {
 621     PosixSignals::chained_handler(sig, info, ucVoid);
 622     signal_was_handled = true; // unconditionally.
 623   }
 624 
























 625   // Call platform dependent signal handler.
 626   if (!signal_was_handled) {
 627     JavaThread* const jt = (t != NULL && t->is_Java_thread()) ? (JavaThread*) t : NULL;
 628     signal_was_handled = PosixSignals::pd_hotspot_signal_handler(sig, info, uc, jt);
 629   }
 630 
 631   // From here on, if the signal had not been handled, it is a fatal error.
 632 
 633   // Give the chained signal handler - should it exist - a shot.
 634   if (!signal_was_handled) {
 635     signal_was_handled = PosixSignals::chained_handler(sig, info, ucVoid);
 636   }
 637 
 638   // Invoke fatal error handling.
 639   if (!signal_was_handled && abort_if_unrecognized) {
 640     // Extract pc from context for the error handler to display.
 641     address pc = NULL;
 642     if (uc != NULL) {
 643       // prepare fault pc address for error reporting.
 644       if (S390_ONLY(sig == SIGILL || sig == SIGFPE) NOT_S390(false)) {

   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #include "jvm.h"
  28 #include "code/codeCache.hpp"
  29 #include "code/compiledMethod.hpp"
  30 #include "code/nativeInst.hpp"
  31 #include "logging/log.hpp"
  32 #include "runtime/atomic.hpp"
  33 #include "runtime/globals.hpp"
  34 #include "runtime/interfaceSupport.inline.hpp"
  35 #include "runtime/java.hpp"
  36 #include "runtime/os.hpp"
  37 #include "runtime/osThread.hpp"
  38 #include "runtime/semaphore.inline.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 #include "runtime/thread.hpp"
  41 #include "signals_posix.hpp"
  42 #include "utilities/events.hpp"
  43 #include "utilities/ostream.hpp"
  44 #include "utilities/vmError.hpp"
  45 
  46 #ifdef ZERO
  47 // See stubGenerator_zero.cpp
  48 #include <setjmp.h>
  49 extern sigjmp_buf* get_jmp_buf_for_continuation();
  50 #endif

 608       }
 609     }
 610 #else
 611     // See JDK-8076185
 612     if (sig == SIGSEGV || sig == SIGBUS) {
 613       sigjmp_buf* const pjb = get_jmp_buf_for_continuation();
 614       if (pjb) {
 615         siglongjmp(*pjb, 1);
 616       }
 617     }
 618 #endif // ZERO
 619   }
 620 
 621   // Ignore SIGPIPE and SIGXFSZ (4229104, 6499219).
 622   if (!signal_was_handled &&
 623       (sig == SIGPIPE || sig == SIGXFSZ)) {
 624     PosixSignals::chained_handler(sig, info, ucVoid);
 625     signal_was_handled = true; // unconditionally.
 626   }
 627 
 628   // Check for UD trap caused by NOP patching.
 629   // If it is, patch return address to be deopt handler.
 630   if (!signal_was_handled) {
 631     address pc = os::Posix::ucontext_get_pc(uc);
 632     assert (pc != NULL, "");
 633     if (NativeDeoptInstruction::is_deopt_at(pc)) {
 634       CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 635       if (cb != NULL && cb->is_compiled()) {
 636         CompiledMethod* cm = cb->as_compiled_method();
 637         assert(cm->insts_contains_inclusive(pc), "");
 638         address deopt = cm->is_method_handle_return(pc) ?
 639           cm->deopt_mh_handler_begin() :
 640           cm->deopt_handler_begin();
 641         assert (deopt != NULL, "");
 642 
 643         frame fr = os::fetch_frame_from_context(uc);
 644         cm->set_original_pc(&fr, pc);
 645 
 646         os::Posix::ucontext_set_pc(uc, deopt);
 647         signal_was_handled = true;
 648       }
 649     }
 650   }
 651 
 652   // Call platform dependent signal handler.
 653   if (!signal_was_handled) {
 654     JavaThread* const jt = (t != NULL && t->is_Java_thread()) ? (JavaThread*) t : NULL;
 655     signal_was_handled = PosixSignals::pd_hotspot_signal_handler(sig, info, uc, jt);
 656   }
 657 
 658   // From here on, if the signal had not been handled, it is a fatal error.
 659 
 660   // Give the chained signal handler - should it exist - a shot.
 661   if (!signal_was_handled) {
 662     signal_was_handled = PosixSignals::chained_handler(sig, info, ucVoid);
 663   }
 664 
 665   // Invoke fatal error handling.
 666   if (!signal_was_handled && abort_if_unrecognized) {
 667     // Extract pc from context for the error handler to display.
 668     address pc = NULL;
 669     if (uc != NULL) {
 670       // prepare fault pc address for error reporting.
 671       if (S390_ONLY(sig == SIGILL || sig == SIGFPE) NOT_S390(false)) {
< prev index next >