mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8170639: [Linux] jsig is limited to a maximum of 64 signals
Reviewed-by: dholmes, iklam
This commit is contained in:
parent
8ac55e2a99
commit
176e37f082
8 changed files with 29 additions and 64 deletions
|
@ -2996,8 +2996,6 @@ static void javaSignalHandler(int sig, siginfo_t* info, void* uc) {
|
||||||
bool os::Aix::signal_handlers_are_installed = false;
|
bool os::Aix::signal_handlers_are_installed = false;
|
||||||
|
|
||||||
// For signal-chaining
|
// For signal-chaining
|
||||||
struct sigaction sigact[NSIG];
|
|
||||||
sigset_t sigs;
|
|
||||||
bool os::Aix::libjsig_is_loaded = false;
|
bool os::Aix::libjsig_is_loaded = false;
|
||||||
typedef struct sigaction *(*get_signal_t)(int);
|
typedef struct sigaction *(*get_signal_t)(int);
|
||||||
get_signal_t os::Aix::get_signal_action = NULL;
|
get_signal_t os::Aix::get_signal_action = NULL;
|
||||||
|
@ -3011,7 +3009,7 @@ struct sigaction* os::Aix::get_chained_signal_action(int sig) {
|
||||||
}
|
}
|
||||||
if (actp == NULL) {
|
if (actp == NULL) {
|
||||||
// Retrieve the preinstalled signal handler from jvm
|
// Retrieve the preinstalled signal handler from jvm
|
||||||
actp = get_preinstalled_handler(sig);
|
actp = os::Posix::get_preinstalled_handler(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actp;
|
return actp;
|
||||||
|
@ -3074,19 +3072,6 @@ bool os::Aix::chained_handler(int sig, siginfo_t* siginfo, void* context) {
|
||||||
return chained;
|
return chained;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sigaction* os::Aix::get_preinstalled_handler(int sig) {
|
|
||||||
if (sigismember(&sigs, sig)) {
|
|
||||||
return &sigact[sig];
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void os::Aix::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
|
|
||||||
assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
|
|
||||||
sigact[sig] = oldAct;
|
|
||||||
sigaddset(&sigs, sig);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for diagnostic
|
// for diagnostic
|
||||||
int sigflags[NSIG];
|
int sigflags[NSIG];
|
||||||
|
|
||||||
|
@ -3118,7 +3103,7 @@ void os::Aix::set_signal_handler(int sig, bool set_installed) {
|
||||||
return;
|
return;
|
||||||
} else if (UseSignalChaining) {
|
} else if (UseSignalChaining) {
|
||||||
// save the old handler in jvm
|
// save the old handler in jvm
|
||||||
save_preinstalled_handler(sig, oldAct);
|
os::Posix::save_preinstalled_handler(sig, oldAct);
|
||||||
// libjsig also interposes the sigaction() call below and saves the
|
// libjsig also interposes the sigaction() call below and saves the
|
||||||
// old sigaction on it own.
|
// old sigaction on it own.
|
||||||
} else {
|
} else {
|
||||||
|
@ -3174,7 +3159,6 @@ void os::Aix::install_signal_handlers() {
|
||||||
(*begin_signal_setting)();
|
(*begin_signal_setting)();
|
||||||
}
|
}
|
||||||
|
|
||||||
::sigemptyset(&sigs);
|
|
||||||
set_signal_handler(SIGSEGV, true);
|
set_signal_handler(SIGSEGV, true);
|
||||||
set_signal_handler(SIGPIPE, true);
|
set_signal_handler(SIGPIPE, true);
|
||||||
set_signal_handler(SIGBUS, true);
|
set_signal_handler(SIGBUS, true);
|
||||||
|
|
|
@ -37,8 +37,6 @@ class Aix {
|
||||||
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
||||||
// __sigaction(), signal() is loaded
|
// __sigaction(), signal() is loaded
|
||||||
static struct sigaction *(*get_signal_action)(int);
|
static struct sigaction *(*get_signal_action)(int);
|
||||||
static struct sigaction *get_preinstalled_handler(int);
|
|
||||||
static void save_preinstalled_handler(int, struct sigaction&);
|
|
||||||
|
|
||||||
static void check_signal_handler(int sig);
|
static void check_signal_handler(int sig);
|
||||||
|
|
||||||
|
|
|
@ -2658,11 +2658,6 @@ static void signalHandler(int sig, siginfo_t* info, void* uc) {
|
||||||
bool os::Bsd::signal_handlers_are_installed = false;
|
bool os::Bsd::signal_handlers_are_installed = false;
|
||||||
|
|
||||||
// For signal-chaining
|
// For signal-chaining
|
||||||
struct sigaction sigact[NSIG];
|
|
||||||
uint32_t sigs = 0;
|
|
||||||
#if (32 < NSIG-1)
|
|
||||||
#error "Not all signals can be encoded in sigs. Adapt its type!"
|
|
||||||
#endif
|
|
||||||
bool os::Bsd::libjsig_is_loaded = false;
|
bool os::Bsd::libjsig_is_loaded = false;
|
||||||
typedef struct sigaction *(*get_signal_t)(int);
|
typedef struct sigaction *(*get_signal_t)(int);
|
||||||
get_signal_t os::Bsd::get_signal_action = NULL;
|
get_signal_t os::Bsd::get_signal_action = NULL;
|
||||||
|
@ -2676,7 +2671,7 @@ struct sigaction* os::Bsd::get_chained_signal_action(int sig) {
|
||||||
}
|
}
|
||||||
if (actp == NULL) {
|
if (actp == NULL) {
|
||||||
// Retrieve the preinstalled signal handler from jvm
|
// Retrieve the preinstalled signal handler from jvm
|
||||||
actp = get_preinstalled_handler(sig);
|
actp = os::Posix::get_preinstalled_handler(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actp;
|
return actp;
|
||||||
|
@ -2739,19 +2734,6 @@ bool os::Bsd::chained_handler(int sig, siginfo_t* siginfo, void* context) {
|
||||||
return chained;
|
return chained;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sigaction* os::Bsd::get_preinstalled_handler(int sig) {
|
|
||||||
if ((((uint32_t)1 << (sig-1)) & sigs) != 0) {
|
|
||||||
return &sigact[sig];
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void os::Bsd::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
|
|
||||||
assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
|
|
||||||
sigact[sig] = oldAct;
|
|
||||||
sigs |= (uint32_t)1 << (sig-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for diagnostic
|
// for diagnostic
|
||||||
int sigflags[NSIG];
|
int sigflags[NSIG];
|
||||||
|
|
||||||
|
@ -2783,7 +2765,7 @@ void os::Bsd::set_signal_handler(int sig, bool set_installed) {
|
||||||
return;
|
return;
|
||||||
} else if (UseSignalChaining) {
|
} else if (UseSignalChaining) {
|
||||||
// save the old handler in jvm
|
// save the old handler in jvm
|
||||||
save_preinstalled_handler(sig, oldAct);
|
os::Posix::save_preinstalled_handler(sig, oldAct);
|
||||||
// libjsig also interposes the sigaction() call below and saves the
|
// libjsig also interposes the sigaction() call below and saves the
|
||||||
// old sigaction on it own.
|
// old sigaction on it own.
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,8 +37,6 @@ class Bsd {
|
||||||
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
||||||
// __sigaction(), signal() is loaded
|
// __sigaction(), signal() is loaded
|
||||||
static struct sigaction *(*get_signal_action)(int);
|
static struct sigaction *(*get_signal_action)(int);
|
||||||
static struct sigaction *get_preinstalled_handler(int);
|
|
||||||
static void save_preinstalled_handler(int, struct sigaction&);
|
|
||||||
|
|
||||||
static void check_signal_handler(int sig);
|
static void check_signal_handler(int sig);
|
||||||
|
|
||||||
|
|
|
@ -4463,11 +4463,6 @@ static void signalHandler(int sig, siginfo_t* info, void* uc) {
|
||||||
bool os::Linux::signal_handlers_are_installed = false;
|
bool os::Linux::signal_handlers_are_installed = false;
|
||||||
|
|
||||||
// For signal-chaining
|
// For signal-chaining
|
||||||
struct sigaction sigact[NSIG];
|
|
||||||
uint64_t sigs = 0;
|
|
||||||
#if (64 < NSIG-1)
|
|
||||||
#error "Not all signals can be encoded in sigs. Adapt its type!"
|
|
||||||
#endif
|
|
||||||
bool os::Linux::libjsig_is_loaded = false;
|
bool os::Linux::libjsig_is_loaded = false;
|
||||||
typedef struct sigaction *(*get_signal_t)(int);
|
typedef struct sigaction *(*get_signal_t)(int);
|
||||||
get_signal_t os::Linux::get_signal_action = NULL;
|
get_signal_t os::Linux::get_signal_action = NULL;
|
||||||
|
@ -4481,7 +4476,7 @@ struct sigaction* os::Linux::get_chained_signal_action(int sig) {
|
||||||
}
|
}
|
||||||
if (actp == NULL) {
|
if (actp == NULL) {
|
||||||
// Retrieve the preinstalled signal handler from jvm
|
// Retrieve the preinstalled signal handler from jvm
|
||||||
actp = get_preinstalled_handler(sig);
|
actp = os::Posix::get_preinstalled_handler(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actp;
|
return actp;
|
||||||
|
@ -4545,19 +4540,6 @@ bool os::Linux::chained_handler(int sig, siginfo_t* siginfo, void* context) {
|
||||||
return chained;
|
return chained;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
|
|
||||||
if ((((uint64_t)1 << (sig-1)) & sigs) != 0) {
|
|
||||||
return &sigact[sig];
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void os::Linux::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
|
|
||||||
assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
|
|
||||||
sigact[sig] = oldAct;
|
|
||||||
sigs |= (uint64_t)1 << (sig-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for diagnostic
|
// for diagnostic
|
||||||
int sigflags[NSIG];
|
int sigflags[NSIG];
|
||||||
|
|
||||||
|
@ -4589,7 +4571,7 @@ void os::Linux::set_signal_handler(int sig, bool set_installed) {
|
||||||
return;
|
return;
|
||||||
} else if (UseSignalChaining) {
|
} else if (UseSignalChaining) {
|
||||||
// save the old handler in jvm
|
// save the old handler in jvm
|
||||||
save_preinstalled_handler(sig, oldAct);
|
os::Posix::save_preinstalled_handler(sig, oldAct);
|
||||||
// libjsig also interposes the sigaction() call below and saves the
|
// libjsig also interposes the sigaction() call below and saves the
|
||||||
// old sigaction on it own.
|
// old sigaction on it own.
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -38,8 +38,6 @@ class Linux {
|
||||||
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
|
||||||
// __sigaction(), signal() is loaded
|
// __sigaction(), signal() is loaded
|
||||||
static struct sigaction *(*get_signal_action)(int);
|
static struct sigaction *(*get_signal_action)(int);
|
||||||
static struct sigaction *get_preinstalled_handler(int);
|
|
||||||
static void save_preinstalled_handler(int, struct sigaction&);
|
|
||||||
|
|
||||||
static void check_signal_handler(int sig);
|
static void check_signal_handler(int sig);
|
||||||
|
|
||||||
|
|
|
@ -1673,6 +1673,24 @@ static void pthread_init_common(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SOLARIS
|
||||||
|
sigset_t sigs;
|
||||||
|
struct sigaction sigact[NSIG];
|
||||||
|
|
||||||
|
struct sigaction* os::Posix::get_preinstalled_handler(int sig) {
|
||||||
|
if (sigismember(&sigs, sig)) {
|
||||||
|
return &sigact[sig];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void os::Posix::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
|
||||||
|
assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
|
||||||
|
sigact[sig] = oldAct;
|
||||||
|
sigaddset(&sigs, sig);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Not all POSIX types and API's are available on all notionally "posix"
|
// Not all POSIX types and API's are available on all notionally "posix"
|
||||||
// platforms. If we have build-time support then we will check for actual
|
// platforms. If we have build-time support then we will check for actual
|
||||||
// runtime support via dlopen/dlsym lookup. This allows for running on an
|
// runtime support via dlopen/dlsym lookup. This allows for running on an
|
||||||
|
@ -1783,6 +1801,7 @@ void os::Posix::init_2(void) {
|
||||||
(_pthread_condattr_setclock != NULL ? "" : " not"));
|
(_pthread_condattr_setclock != NULL ? "" : " not"));
|
||||||
log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with %s",
|
log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with %s",
|
||||||
_use_clock_monotonic_condattr ? "CLOCK_MONOTONIC" : "the default clock");
|
_use_clock_monotonic_condattr ? "CLOCK_MONOTONIC" : "the default clock");
|
||||||
|
sigemptyset(&sigs);
|
||||||
#endif // !SOLARIS
|
#endif // !SOLARIS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1797,6 +1816,7 @@ void os::Posix::init_2(void) {
|
||||||
log_info(os)("Use of CLOCK_MONOTONIC is not supported");
|
log_info(os)("Use of CLOCK_MONOTONIC is not supported");
|
||||||
log_info(os)("Use of pthread_condattr_setclock is not supported");
|
log_info(os)("Use of pthread_condattr_setclock is not supported");
|
||||||
log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with the default clock");
|
log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with the default clock");
|
||||||
|
sigemptyset(&sigs);
|
||||||
#endif // !SOLARIS
|
#endif // !SOLARIS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,9 @@ public:
|
||||||
// effective gid, or if given uid is root.
|
// effective gid, or if given uid is root.
|
||||||
static bool matches_effective_uid_and_gid_or_root(uid_t uid, gid_t gid);
|
static bool matches_effective_uid_and_gid_or_root(uid_t uid, gid_t gid);
|
||||||
|
|
||||||
|
static struct sigaction *get_preinstalled_handler(int);
|
||||||
|
static void save_preinstalled_handler(int, struct sigaction&);
|
||||||
|
|
||||||
static void print_umask(outputStream* st, mode_t umsk);
|
static void print_umask(outputStream* st, mode_t umsk);
|
||||||
|
|
||||||
static void print_user_info(outputStream* st);
|
static void print_user_info(outputStream* st);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue