Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8253742: POSIX signal code cleanup #636

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions make/hotspot/symbols/symbols-aix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
# questions.
#

JVM_handle_posix_signal
JVM_handle_linux_signal
numa_error
numa_warn
sysThreadAvailableStackWithSlack
4 changes: 2 additions & 2 deletions make/hotspot/symbols/symbols-linux
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
# questions.
#

JVM_handle_posix_signal
JVM_handle_linux_signal
JVM_IsUseContainerSupport
numa_error
numa_warn
4 changes: 2 additions & 2 deletions make/hotspot/symbols/symbols-macosx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,4 +21,4 @@
# questions.
#

JVM_handle_posix_signal
JVM_handle_bsd_signal
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/vm_version_arm_32.cpp
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ class VM_Version_StubGenerator: public StubCodeGenerator {
__ pldw(Address(R0));
// Return true if instruction caused no signals
__ mov(R0, 1);
// JVM_handle_posix_signal moves PC here if SIGILL happens
// JVM_handle_linux_signal moves PC here if SIGILL happens
__ bx(LR);

return start;
27 changes: 22 additions & 5 deletions src/hotspot/os/posix/signals_posix.cpp
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ static sigset_t check_signal_done;
static bool check_signals = true;

// This boolean allows users to forward their own non-matching signals
// to JVM_handle_posix_signal harmlessly.
// to JVM_handle_bsd_signal/JVM_handle_linux_signal, harmlessly.
static bool signal_handlers_are_installed = false;

debug_only(static bool signal_sets_initialized = false);
@@ -432,9 +432,20 @@ bool PosixSignals::chained_handler(int sig, siginfo_t* siginfo, void* context) {
// Note that the VM will print warnings if it detects conflicting signal
// handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
//
extern "C" JNIEXPORT int JVM_handle_posix_signal(int signo, siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);

#if defined(BSD)
extern "C" JNIEXPORT int JVM_handle_bsd_signal(int signo, siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
#elif defined(AIX)
extern "C" JNIEXPORT int JVM_handle_aix_signal(int signo, siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
#else
extern "C" JNIEXPORT int JVM_handle_linux_signal(int signo, siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
#endif

// Function to unblock all signals which are, according
// to POSIX, typical program error signals. If they happen while being blocked,
@@ -459,7 +470,13 @@ static void javaSignalHandler(int sig, siginfo_t* info, void* uc) {
unblock_program_error_signals();

int orig_errno = errno; // Preserve errno value over signal handler.
JVM_handle_posix_signal(sig, info, uc, true);
#if defined(BSD)
JVM_handle_bsd_signal(sig, info, uc, true);
#elif defined(AIX)
JVM_handle_aix_signal(sig, info, uc, true);
#else
JVM_handle_linux_signal(sig, info, uc, true);
#endif
errno = orig_errno;
}

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ frame os::current_frame() {
// Utility functions

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) {
JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) {

ucontext_t* uc = (ucontext_t*) ucVoid;

@@ -211,7 +211,7 @@ JVM_handle_posix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unr
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_aix_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
Original file line number Diff line number Diff line change
@@ -422,7 +422,7 @@ enum {
};

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_bsd_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -439,7 +439,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_bsd_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
}

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_bsd_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -137,7 +137,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to
// install then restore certain signal handler (e.g. to temporarily
// block SIGPIPE, or have a SIGILL handler when detecting CPU
// type). When that happens, JVM_handle_posix_signal() might be
// type). When that happens, JVM_handle_bsd_signal() might be
// invoked with junk info/ucVoid. To avoid unnecessary crash when
// libjsig is not preloaded, try handle signals that do not require
// siginfo/ucontext first.
4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ NOINLINE frame os::current_frame() {
}

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -211,7 +211,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
Original file line number Diff line number Diff line change
@@ -243,7 +243,7 @@ address check_mp_ext_fault_instr = NULL;

// Utility functions

extern "C" int JVM_handle_posix_signal(int sig, siginfo_t* info,
extern "C" int JVM_handle_linux_signal(int sig, siginfo_t* info,
void* ucVoid, int abort_if_unrecognized) {
ucontext_t* uc = (ucontext_t*) ucVoid;

@@ -270,7 +270,7 @@ extern "C" int JVM_handle_posix_signal(int sig, siginfo_t* info,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@ frame os::current_frame() {
// Utility functions

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -233,7 +233,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
Original file line number Diff line number Diff line change
@@ -236,7 +236,7 @@ frame os::current_frame() {
// Utility functions

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -253,7 +253,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ enum {
};

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -250,7 +250,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
// JVM_handle_posix_signal() might be invoked with junk info/ucVoid. To
// JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
// that do not require siginfo/ucontext first.

4 changes: 2 additions & 2 deletions src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
}

extern "C" JNIEXPORT int
JVM_handle_posix_signal(int sig,
JVM_handle_linux_signal(int sig,
siginfo_t* info,
void* ucVoid,
int abort_if_unrecognized) {
@@ -133,7 +133,7 @@ JVM_handle_posix_signal(int sig,
// Note: it's not uncommon that JNI code uses signal/sigset to
// install then restore certain signal handler (e.g. to temporarily
// block SIGPIPE, or have a SIGILL handler when detecting CPU
// type). When that happens, JVM_handle_posix_signal() might be
// type). When that happens, JVM_handle_linux_signal() might be
// invoked with junk info/ucVoid. To avoid unnecessary crash when
// libjsig is not preloaded, try handle signals that do not require
// siginfo/ucontext first.