< prev index next >

src/os_cpu/linux_x86/vm/os_linux_x86.cpp

Print this page
rev 8910 : full patch for jfr
   1 /*
   2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  *


 207 // Utility functions
 208 
 209 // From IA32 System Programming Guide
 210 enum {
 211   trap_page_fault = 0xE
 212 };
 213 
 214 extern "C" JNIEXPORT int
 215 JVM_handle_linux_signal(int sig,
 216                         siginfo_t* info,
 217                         void* ucVoid,
 218                         int abort_if_unrecognized) {
 219   ucontext_t* uc = (ucontext_t*) ucVoid;
 220 
 221   Thread* t = ThreadLocalStorage::get_thread_slow();
 222 
 223   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 224   // (no destructors can be run)
 225   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 226 


 227   SignalHandlerMark shm(t);
 228 
 229   // Note: it's not uncommon that JNI code uses signal/sigset to install
 230   // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
 231   // or have a SIGILL handler when detecting CPU type). When that happens,
 232   // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
 233   // avoid unnecessary crash when libjsig is not preloaded, try handle signals
 234   // that do not require siginfo/ucontext first.
 235 
 236   if (sig == SIGPIPE || sig == SIGXFSZ) {
 237     // allow chained handler to go first
 238     if (os::Linux::chained_handler(sig, info, ucVoid)) {
 239       return true;
 240     } else {
 241       if (PrintMiscellaneous && (WizardMode || Verbose)) {
 242         char buf[64];
 243         warning("Ignoring %s - see bugs 4229104 or 646499219",
 244                 os::exception_name(sig, buf, sizeof(buf)));
 245       }
 246       return true;


   1 /*
   2  * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  *


 207 // Utility functions
 208 
 209 // From IA32 System Programming Guide
 210 enum {
 211   trap_page_fault = 0xE
 212 };
 213 
 214 extern "C" JNIEXPORT int
 215 JVM_handle_linux_signal(int sig,
 216                         siginfo_t* info,
 217                         void* ucVoid,
 218                         int abort_if_unrecognized) {
 219   ucontext_t* uc = (ucontext_t*) ucVoid;
 220 
 221   Thread* t = ThreadLocalStorage::get_thread_slow();
 222 
 223   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 224   // (no destructors can be run)
 225   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 226 
 227   os::ThreadCrashProtection::check_crash_protection(sig, t);
 228 
 229   SignalHandlerMark shm(t);
 230 
 231   // Note: it's not uncommon that JNI code uses signal/sigset to install
 232   // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
 233   // or have a SIGILL handler when detecting CPU type). When that happens,
 234   // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
 235   // avoid unnecessary crash when libjsig is not preloaded, try handle signals
 236   // that do not require siginfo/ucontext first.
 237 
 238   if (sig == SIGPIPE || sig == SIGXFSZ) {
 239     // allow chained handler to go first
 240     if (os::Linux::chained_handler(sig, info, ucVoid)) {
 241       return true;
 242     } else {
 243       if (PrintMiscellaneous && (WizardMode || Verbose)) {
 244         char buf[64];
 245         warning("Ignoring %s - see bugs 4229104 or 646499219",
 246                 os::exception_name(sig, buf, sizeof(buf)));
 247       }
 248       return true;


< prev index next >