Merge branch 'fix_raise_sigrtmax' into 'master'

Remove incorrect sig number check in raise.

Closes #255

See merge request redox-os/relibc!959
This commit is contained in:
Jeremy Soller
2026-02-05 06:31:29 -07:00
3 changed files with 12 additions and 19 deletions
+3 -2
View File
@@ -351,11 +351,12 @@ fn modify_sigmask(old: Option<&mut u64>, op: Option<impl FnOnce(u64) -> u64>) ->
let next = !op(!prev);
let pending = set_allowset_raw(&ctl.word, prev, next);
let thread_pending = set_allowset_raw(&ctl.word, prev, next);
let proc_pending = PROC_CONTROL_STRUCT.pending.load(Ordering::Relaxed);
// POSIX requires that at least one pending unblocked signal be delivered before
// pthread_sigmask returns, if there is one.
if pending != 0 {
if (thread_pending | proc_pending) & next != 0 {
unsafe {
manually_enter_trampoline();
}
+7 -3
View File
@@ -387,9 +387,13 @@ pub unsafe extern "C" fn sigpending(set: *mut sigset_t) -> c_int {
.or_minus_one_errno()
}
const BELOW_SIGRTMIN_MASK: sigset_t = (1 << SIGRTMIN) - 1;
const STANDARD_SIG_MASK: sigset_t = (1 << 32) - 1;
const RLCT_SIGNAL_MASK: sigset_t = BELOW_SIGRTMIN_MASK & !STANDARD_SIG_MASK;
// TODO: Double-check this mask.
// This prevents the application from blocking the two signals SIGRTMIN - 1 and SIGRTMIN - 2 which
// are (at least meant to be) used internally for timers and pthread cancellation. On Linux this is
// 32 and 33 (same as NPTL reserves), whereas this on Redox is 33 and 34 (TODO: could this be
// changed to 32 and 33 for Redox too, since there's currently no support for "sigqueue" targeting
// specific threads).
const RLCT_SIGNAL_MASK: sigset_t = (1 << ((SIGRTMIN - 1) - 1)) | (1 << (SIGRTMIN - 2) - 1);
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigprocmask.html>.
#[unsafe(no_mangle)]
+2 -14
View File
@@ -7,8 +7,8 @@ use crate::{
header::{
errno::{EINVAL, ENOSYS},
signal::{
NSIG, SA_SIGINFO, SIG_BLOCK, SIG_DFL, SIG_IGN, SIG_SETMASK, SIG_UNBLOCK, SIGRTMIN,
SS_DISABLE, SS_ONSTACK, sigaction, siginfo_t, sigset_t, sigval, stack_t, ucontext_t,
NSIG, SA_SIGINFO, SIG_BLOCK, SIG_DFL, SIG_IGN, SIG_SETMASK, SIG_UNBLOCK, SS_DISABLE,
SS_ONSTACK, sigaction, siginfo_t, sigset_t, sigval, stack_t, ucontext_t,
},
sys_time::{ITIMER_REAL, itimerval},
time::timespec,
@@ -86,18 +86,6 @@ impl PalSignal for Sys {
fn raise(sig: c_int) -> Result<()> {
// TODO: Bypass kernel?
const n_sig: c_int = NSIG as c_int;
const rt_min: c_int = SIGRTMIN as c_int;
const rt_max: c_int = SIGRTMIN as c_int;
match sig {
0..n_sig => {}
rt_min..=rt_max => {}
_ => {
return Err(Errno(EINVAL));
}
}
unsafe { Self::rlct_kill(Self::current_os_tid(), sig as _) }
}