Skip to content

Commit

Permalink
fix: do_signal函数在处理SIG_KILL时,有一处pcb强引用未归零的问题 (#1039)
Browse files Browse the repository at this point in the history
Signed-off-by: longjin <[email protected]>
  • Loading branch information
fslongjin authored Nov 11, 2024
1 parent f5c732d commit 20c5810
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/src/arch/x86_64/ipc/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,6 @@ impl SignalArch for X86_64SignalArch {
return;
}

let pcb = ProcessManager::current_pcb();

let mut sig_number: Signal;
let mut info: Option<SigInfo>;
let mut sigaction: Sigaction;
Expand Down Expand Up @@ -483,9 +481,13 @@ impl SignalArch for X86_64SignalArch {
//避免死锁
drop(siginfo_mut_guard);
drop(sig_guard);
drop(pcb);

// 做完上面的检查后,开中断
CurrentIrqArch::interrupt_enable();

// 注意!由于handle_signal里面可能会退出进程,
// 因此这里需要检查清楚:上面所有的锁、arc指针都被释放了。否则会产生资源泄露的问题!
let res: Result<i32, SystemError> =
handle_signal(sig_number, &mut sigaction, &info.unwrap(), &oldset, frame);
if res.is_err() {
Expand Down

0 comments on commit 20c5810

Please sign in to comment.