You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nix::sys::signal::Signal enum type does not cover real-time signals.
In the current env code, this means that trying to block e.g. SIGRTMIN+7
is silently ignored, apply_signal_action() silently drops signals that
cannot be represented as that enum.
However, the enum cannot simply be extended to represent the real-time
signals, because SIGRTMIN and SIGRTMAX cannot be considered constants.
To workaround this, do not use the Signal enum type, and use libc where
needed instead of the wrappers.
Fixes: #11151
// On some platforms ALL_SIGNALS may contain values that are not valid in libc.
1079
1083
// Skip those invalid ones and continue (GNU env also ignores undefined signals).
1080
-
letOk(sig) = signal_from_value(sig_value)else{
1084
+
if !signal_is_valid(sig_value){
1081
1085
returnOk(());
1082
-
};
1083
-
signal_fn(sig)?;
1086
+
}
1087
+
1088
+
signal_fn(sig_value)?;
1084
1089
log.record(sig_value, action_kind, explicit);
1085
1090
1086
1091
// Set environment variable to communicate to Rust child processes
@@ -1096,9 +1101,14 @@ where
1096
1101
}
1097
1102
1098
1103
#[cfg(unix)]
1099
-
fnignore_signal(sig:Signal) -> UResult<()>{
1104
+
fnignore_signal(sig:usize) -> UResult<()>{
1100
1105
// SAFETY: This is safe because we write the handler for each signal only once, and therefore "the current handler is the default", as the documentation requires it.
1101
-
let result = unsafe{signal(sig,SigIgn)};
1106
+
// nix::sys::signal::Signal does not cover real-time signals, so we need to call
1107
+
// libc::signal directly.
1108
+
let result = unsafe{
1109
+
let res = libc::signal(sig as libc::c_int, libc::SIG_IGN);
0 commit comments