From a1937f438ca6ea0ff4edc7ea78000a50b2fd1de5 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Thu, 17 Apr 2025 12:03:59 +0200 Subject: [PATCH] Allow read-only sigaction for SIG{KILL,STOP}. --- redox-rt/src/signal.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs index 175a973e21..ae8af97fc1 100644 --- a/redox-rt/src/signal.rs +++ b/redox-rt/src/signal.rs @@ -397,8 +397,23 @@ fn convert_old(action: &RawAction) -> Sigaction { } pub fn sigaction(signal: u8, new: Option<&Sigaction>, old: Option<&mut Sigaction>) -> Result<()> { - if matches!(usize::from(signal), 0 | 32 | SIGKILL | SIGSTOP | 65..) { + if matches!(usize::from(signal), 0 | 32 | 65..) { return Err(Error::new(EINVAL)); + + } + if matches!(usize::from(signal), SIGKILL | SIGSTOP) { + if new.is_some() { + return Err(Error::new(EINVAL)); + } + if let Some(old) = old { + // TODO: Is this the correct value to set it to? + *old = Sigaction { + kind: SigactionKind::Default, + mask: 0, + flags: SigactionFlags::empty(), + }; + } + return Ok(()); } let _sigguard = tmp_disable_signals();