Fix kill deadlock.

This commit is contained in:
4lDO2
2024-07-16 13:05:10 +02:00
parent 6bd01513c5
commit cde108439c
4 changed files with 17 additions and 5 deletions
Generated
+1 -1
View File
@@ -226,7 +226,7 @@ checksum = "64072665120942deff5fd5425d6c1811b854f4939e7f1c01ce755f64432bbea7"
[[package]]
name = "redox_syscall"
version = "0.5.2"
version = "0.5.3"
dependencies = [
"bitflags 2.4.2",
]
+11 -2
View File
@@ -1,7 +1,12 @@
use crate::{
arch::paging::{Page, RmmA, RmmArch, VirtualAddress},
context::{
self, context::{HardBlockedReason, SignalState}, file::{FileDescriptor, InternalFlags}, memory::{handle_notify_files, AddrSpaceWrapper, Grant, PageSpan}, process::{self, Process, ProcessId, ProcessInfo}, Context, ContextRef, Status
self,
context::{HardBlockedReason, SignalState},
file::{FileDescriptor, InternalFlags},
memory::{handle_notify_files, AddrSpaceWrapper, Grant, PageSpan},
process::{self, Process, ProcessId, ProcessInfo},
Context, ContextRef, Status,
},
memory::PAGE_SIZE,
ptrace,
@@ -1419,7 +1424,11 @@ impl ContextHandle {
{
let process = Arc::clone(&context.read().process);
let mut process = process.write();
if let Some(pos) = process.threads.iter().position(|p| Weak::as_ptr(p) == Arc::as_ptr(&context)) {
if let Some(pos) = process
.threads
.iter()
.position(|p| Weak::as_ptr(p) == Arc::as_ptr(&context))
{
process.threads.remove(pos);
}
}
+4 -1
View File
@@ -7,7 +7,9 @@ use rmm::Arch;
use spin::RwLock;
use crate::context::{
memory::{AddrSpace, Grant, PageSpan}, process::{self, Process, ProcessId, ProcessInfo, ProcessStatus}, Context, ContextRef, WaitpidKey
memory::{AddrSpace, Grant, PageSpan},
process::{self, Process, ProcessId, ProcessInfo, ProcessStatus},
Context, ContextRef, WaitpidKey,
};
use crate::{
@@ -234,6 +236,7 @@ pub fn kill(pid: ProcessId, sig: usize, parent_sigchld: bool) -> Result<usize> {
pgid: proc_info.pgid,
};
}
drop(process_guard);
let mut context_guard = context_lock.write();
if sig == SIGSTOP
|| (matches!(sig, SIGTTIN | SIGTTOU | SIGTSTP)
+1 -1
Submodule syscall updated: 387f1c3326...6128f1acf0