diff options
author | yyny <6576327+yyny@users.noreply.github.com> | 2022-12-19 21:27:58 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-03 18:13:11 +0100 |
commit | fb2be937ac0fb34b04733f26cd8494e1569669ee (patch) | |
tree | e27ead33ff65da36fb1817eb56f8dc58a87c83b8 /Kernel/Syscalls | |
parent | 9ca979846ca45871a2b97876d2bdb7cd623f1eb1 (diff) | |
download | serenity-fb2be937ac0fb34b04733f26cd8494e1569669ee.zip |
Kernel: Allow sending `SIGCONT` to processes in the same group
Allow sending `SIGCONT` to processes that share the same `pgid`.
This is allowed in Linux aswell.
Also fixes a FIXME :^)
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r-- | Kernel/Syscalls/kill.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/Syscalls/kill.cpp b/Kernel/Syscalls/kill.cpp index 84291d515e..a9b72d2e37 100644 --- a/Kernel/Syscalls/kill.cpp +++ b/Kernel/Syscalls/kill.cpp @@ -11,11 +11,15 @@ namespace Kernel { ErrorOr<void> Process::do_kill(Process& process, int signal) { - // FIXME: Allow sending SIGCONT to everyone in the process group. // FIXME: Should setuid processes have some special treatment here? auto credentials = this->credentials(); auto kill_process_credentials = process.credentials(); - if (!credentials->is_superuser() && credentials->euid() != kill_process_credentials->uid() && credentials->uid() != kill_process_credentials->uid()) + + bool can_send_signal = credentials->is_superuser() + || credentials->euid() == kill_process_credentials->uid() + || credentials->uid() == kill_process_credentials->uid() + || (signal == SIGCONT && credentials->pgid() == kill_process_credentials->pgid()); + if (!can_send_signal) return EPERM; if (process.is_kernel_process()) { dbgln("Attempted to send signal {} to kernel process {} ({})", signal, process.name(), process.pid()); |