From 93a3401df4c562e3cfaacec7faacd188e9e224e0 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Wed, 26 Jun 2024 22:26:19 +0200 Subject: [PATCH] Fix bug causing raise() to not deliver any signals. --- Cargo.lock | 2 +- src/context/signal.rs | 1 - src/syscall/process.rs | 7 ++++--- syscall | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68a134563c..7e7224f131 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,7 +226,7 @@ checksum = "64072665120942deff5fd5425d6c1811b854f4939e7f1c01ce755f64432bbea7" [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.2" dependencies = [ "bitflags 2.4.2", ] diff --git a/src/context/signal.rs b/src/context/signal.rs index 08de1da5fd..75736580cd 100644 --- a/src/context/signal.rs +++ b/src/context/signal.rs @@ -100,7 +100,6 @@ pub fn signal_handler() { thread_ctl.saved_scratch_b.set(scratch_b); thread_ctl.control_flags.store((control_flags | SigcontrolFlags::INHIBIT_DELIVERY).bits(), Ordering::Release); - log::info!("delivering"); } pub fn excp_handler(signal: usize) { let current = context::current().expect("CPU exception but not inside of context!"); diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 143a3e0e20..b6eb0be89f 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -6,8 +6,7 @@ use rmm::Arch; use spin::RwLock; use crate::context::{ - memory::{AddrSpace, PageSpan, Grant}, - ContextId, WaitpidKey, + memory::{AddrSpace, Grant, PageSpan}, switch::SwitchResult, ContextId, WaitpidKey }; use crate::{ @@ -251,7 +250,9 @@ pub fn kill(pid: ContextId, sig: usize) -> Result { Err(Error::new(EPERM)) } else { // Switch to ensure delivery to self - context::switch(); + if let SwitchResult::Switched { signal: true } = context::switch() { + context::signal::signal_handler(); + } Ok(0) } diff --git a/syscall b/syscall index bd60d67729..bf01feb121 160000 --- a/syscall +++ b/syscall @@ -1 +1 @@ -Subproject commit bd60d677291c5e4992296c12a91ce87d4066d345 +Subproject commit bf01feb12119e2ab39e60d8e7f7f257c41e7de6b