From c54195f10dc57895d5ce8f88844e9536ee52c334 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Wed, 17 Jul 2024 17:31:05 +0200 Subject: [PATCH] Ensure process signals can also interrupt. --- src/context/signal.rs | 4 ++-- src/sync/wait_condition.rs | 4 ++-- src/syscall/futex.rs | 4 ++-- src/syscall/time.rs | 4 ++-- syscall | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/context/signal.rs b/src/context/signal.rs index 78828c0a09..ec3ba35e73 100644 --- a/src/context/signal.rs +++ b/src/context/signal.rs @@ -21,12 +21,12 @@ pub fn signal_handler() { .and_then(|_| ptrace::next_breakpoint().map(|f| f.contains(PTRACE_FLAG_IGNORE)));*/ // TODO: thumbs_down - let Some((thread_ctl, _proc_ctl, st)) = context.sigcontrol() else { + let Some((thread_ctl, proc_ctl, st)) = context.sigcontrol() else { // Discard signal if sigcontrol is unset. log::trace!("no sigcontrol, returning"); return; }; - if thread_ctl.currently_pending_unblocked() == 0 { + if thread_ctl.currently_pending_unblocked(proc_ctl) == 0 { // The context is currently Runnable. When transitioning into Blocked, it will check for // signals (with the context lock held, which is required when sending signals). After // that, any detection of pending unblocked signals by the sender, will result in the diff --git a/src/sync/wait_condition.rs b/src/sync/wait_condition.rs index cd87151bd8..c3db8ac7ac 100644 --- a/src/sync/wait_condition.rs +++ b/src/sync/wait_condition.rs @@ -49,8 +49,8 @@ impl WaitCondition { { { let mut context = current_context_ref.write(); - if let Some((control, _, _)) = context.sigcontrol() - && control.currently_pending_unblocked() != 0 + if let Some((control, pctl, _)) = context.sigcontrol() + && control.currently_pending_unblocked(pctl) != 0 { return false; } diff --git a/src/syscall/futex.rs b/src/syscall/futex.rs index 32c9b059d9..2d053d4628 100644 --- a/src/syscall/futex.rs +++ b/src/syscall/futex.rs @@ -142,8 +142,8 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, _addr2: usize) -> context.wake = timeout_opt.map(|TimeSpec { tv_sec, tv_nsec }| { tv_sec as u128 * time::NANOS_PER_SEC + tv_nsec as u128 }); - if let Some((tctl, _pctl, _)) = context.sigcontrol() { - if tctl.currently_pending_unblocked() != 0 { + if let Some((tctl, pctl, _)) = context.sigcontrol() { + if tctl.currently_pending_unblocked(pctl) != 0 { return Err(Error::new(EINTR)); } } diff --git a/src/syscall/time.rs b/src/syscall/time.rs index 8052fa654b..ac81cab211 100644 --- a/src/syscall/time.rs +++ b/src/syscall/time.rs @@ -34,8 +34,8 @@ pub fn nanosleep(req_buf: UserSliceRo, rem_buf_opt: Option) -> Resu { let mut context = current_context.write(); - if let Some((tctl, _pctl, _)) = context.sigcontrol() { - if tctl.currently_pending_unblocked() != 0 { + if let Some((tctl, pctl, _)) = context.sigcontrol() { + if tctl.currently_pending_unblocked(pctl) != 0 { return Err(Error::new(EINTR)); } } diff --git a/syscall b/syscall index 6128f1acf0..99f49db824 160000 --- a/syscall +++ b/syscall @@ -1 +1 @@ -Subproject commit 6128f1acf0f9be7d28a091c1bf8b05b73885d72e +Subproject commit 99f49db8245c326295f10676832298d6f1e7ea2a