mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 10:18:51 +00:00
Kernel: Sending a signal to a process now goes to the main thread
Instead of falling back to the suspicious "any_thread()" mechanism, just fail with ESRCH if you try to kill() a PID that doesn't have a corresponding TID.
This commit is contained in:
parent
c9e38c5255
commit
0e7f85c24a
Notes:
sideshowbarker
2024-07-19 06:36:42 +09:00
Author: https://github.com/awesomekling
Commit: 0e7f85c24a
2 changed files with 8 additions and 9 deletions
|
@ -2179,7 +2179,7 @@ KResult Process::do_kill(Process& process, int signal)
|
|||
return KResult(-EPERM);
|
||||
}
|
||||
if (signal != 0)
|
||||
process.send_signal(signal, this);
|
||||
return process.send_signal(signal, this);
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
@ -3781,15 +3781,14 @@ void Process::terminate_due_to_signal(u8 signal)
|
|||
die();
|
||||
}
|
||||
|
||||
void Process::send_signal(u8 signal, Process* sender)
|
||||
KResult Process::send_signal(u8 signal, Process* sender)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
if (!m_thread_count)
|
||||
return;
|
||||
auto* thread = Thread::from_tid(m_pid);
|
||||
if (!thread)
|
||||
thread = &any_thread();
|
||||
if (auto* thread = Thread::from_tid(m_pid)) {
|
||||
thread->send_signal(signal, sender);
|
||||
return KSuccess;
|
||||
}
|
||||
return KResult(-ESRCH);
|
||||
}
|
||||
|
||||
int Process::sys$create_thread(void* (*entry)(void*), const Syscall::SC_create_thread_params* user_params)
|
||||
|
|
|
@ -382,7 +382,7 @@ public:
|
|||
bool is_being_inspected() const { return m_inspector_count; }
|
||||
|
||||
void terminate_due_to_signal(u8 signal);
|
||||
void send_signal(u8, Process* sender);
|
||||
KResult send_signal(u8 signal, Process* sender);
|
||||
|
||||
u16 thread_count() const { return m_thread_count; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue